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 |
|---|---|---|---|---|---|
827 | We're building an application that reads data from an API and displays it in a frontend. Due to API limits, we have to cache the API calls meaning that we save the result of the API calls (both user information (first name, country, email etc.) and big sets of activity log data) in a database and only request new data ... | 2017/04/09 | [
"https://devops.stackexchange.com/questions/827",
"https://devops.stackexchange.com",
"https://devops.stackexchange.com/users/2233/"
] | I don't know much about Redis/ElasticSearch, but GCS is not really a database-like solution, it is closer to a file storage solution.
If you're looking for database-like storage Google Cloud offers:
* [Cloud SQL](https://cloud.google.com/sql/)
* [Cloud Bigtable](https://cloud.google.com/bigtable/)
* [Cloud Datastore]... | We had the similar requirement as there needs to be a set of data cached in a server for serving the application (fast processing) and also by end of the day, we would need to sync the data from the cache server to the origin server.
In the longer run, I would suggest to go for Redis as you can have Redis as an interm... |
37,166,147 | I have problem with management several tables using Angular DataTables.
Here are fragments of my html code:
```
<table datatable="ng" dt-options="dtOptions" dt-instance="dtInstance"
class="row-border hover table table-striped table-bordered">
<table datatable="ng" dt-options="dtOptions2" dt-ins... | 2016/05/11 | [
"https://Stackoverflow.com/questions/37166147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5983276/"
] | Let me see if I understand you correctly
you want to update the data in Table 2, you could do with creating a button to update dtInstance2.
```
<button ng-click="dtInstance2.rerender()">update</button>
``` | Encountered this problem before, refer to this url <https://github.com/l-lin/angular-datatables/issues/307> for the solution. |
2,391,595 | >
> If $x+y+z+w=29$ where x, y and z are real numbers greater than 2, then find the maximum possible value of $(x-1)(y+3)(z-1)(w-2)$.
>
>
>
$(x-1)+(y+3)+(z-1)+(w-2)=x+y+z+w-1=28$
Now $x-1=y+3=z-1=w-2=7$ since product is maximum when numbers are equal
My answer came out to be as $6\*10\*6\*5=1800$ but the answer... | 2017/08/12 | [
"https://math.stackexchange.com/questions/2391595",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/470543/"
] | Let $$f(x,y,z,w) = (x-1)(y+3)(z-1)(w-2)$$ and $$g(x,y,z,w) = x + y + w - 29$$
We want to $$\max\{f(x,y,x,w)\}$$
subject to:
$$g(x,y,z,w) = 0, \ \ \ x,y,z > 2$$
Let
\begin{align\*}
\mathcal{L}(x,y,z,\lambda) &= f(x,y,z,w) + \lambda g(x,y,z,w)\\ &= (x-1)(y+3)(z-1)(w-2) + \lambda(x + y + w - 29)
\end{align\*}
Then
$$\na... | $x=8, y=4, z=8, w=9$ is the solution.
edit:
your solution is also correct. I don't know why are you multiplying $6∗10∗6∗5$?
$x−1=y+3=z−1=w−2=7$ means 7\*7\*7\*7=2401 |
4,048,633 | $$\frac{dP}{dt}=\frac{1}{2}\left(2P^{2}-P\right)\cos t$$
I can simply integrate both sides to obtain $$\frac{\left(2P-1\right)^{2}}{P}=ke^{\frac{1}{2}\sin t}$$ I have troubles from here on. I need to separate it to be in terms of a single $P$, and I've tried completing the square, quadratic formula (after timesing up t... | 2021/03/04 | [
"https://math.stackexchange.com/questions/4048633",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/814679/"
] | Assuming your differential equation is correct, then $$\frac 1 {P(2P - 1)}\mathrm{d}P = \frac 1 2 \cos t\ \mathrm{d}t$$
and we further decompose the LHS using partial fractions into $$\left(\frac 2 {2P - 1} - \frac 1 P\right)\mathrm{d}P = \frac 1 2 \cos t\ \mathrm{d}t.$$
Integrating both sides, we have $$\ln (2P - 1)... | You get
$$\int \frac{dp}{2p^2-p}=\frac{1}{2} \int \cos t~dt \implies \ln \frac{2p-1}{p}=\frac{1}{2} \sin t+ c$$
$$\implies 2-\frac{1}{p}=ke^{\frac{1}{2}\ln \sin t}\implies p= \frac{1}{2-ke^{\frac{1}{2}\sin t}}.$$ |
4,048,633 | $$\frac{dP}{dt}=\frac{1}{2}\left(2P^{2}-P\right)\cos t$$
I can simply integrate both sides to obtain $$\frac{\left(2P-1\right)^{2}}{P}=ke^{\frac{1}{2}\sin t}$$ I have troubles from here on. I need to separate it to be in terms of a single $P$, and I've tried completing the square, quadratic formula (after timesing up t... | 2021/03/04 | [
"https://math.stackexchange.com/questions/4048633",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/814679/"
] | Assuming your differential equation is correct, then $$\frac 1 {P(2P - 1)}\mathrm{d}P = \frac 1 2 \cos t\ \mathrm{d}t$$
and we further decompose the LHS using partial fractions into $$\left(\frac 2 {2P - 1} - \frac 1 P\right)\mathrm{d}P = \frac 1 2 \cos t\ \mathrm{d}t.$$
Integrating both sides, we have $$\ln (2P - 1)... | Set $U=2-P^{-1}$, $U(0)=2-P(0)^{-1}=1$, then you get
$$
U'=P^{-2}P'=\frac12(2-P^{-1})\cos t=\frac{U}2\cos t
$$
and consequently
$$
U(t)=U(0)e^{\sin(t)/2}
$$
Now solve backward
$$
2-P(t)^{-1}=e^{\sin(t)/2}.
$$ |
14,052,889 | I'm using Entity Framework in asp.net in Visual Studio 2012. I'm just learning these stuffs. I followed this [tutorial](http://www.asp.net/web-forms/tutorials/getting-started-with-ef/the-entity-framework-and-aspnet-getting-started-part-2)
Just created the grid and I run the web site, everything is fine except the dele... | 2012/12/27 | [
"https://Stackoverflow.com/questions/14052889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1460703/"
] | Your answer for your question is given in your tutorial. (Applicable only if you are using the same tables and same constraints)
under "*Revising EntityDataSource Control Markup to Improve Performance*"
>
> The Delete button also works. Click delete for a row that has an enrollment date and the row disappears. (Rows ... | Seems as if you want to delete a person from CourseInstructor which is refereced by school. |
14,052,889 | I'm using Entity Framework in asp.net in Visual Studio 2012. I'm just learning these stuffs. I followed this [tutorial](http://www.asp.net/web-forms/tutorials/getting-started-with-ef/the-entity-framework-and-aspnet-getting-started-part-2)
Just created the grid and I run the web site, everything is fine except the dele... | 2012/12/27 | [
"https://Stackoverflow.com/questions/14052889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1460703/"
] | Seems as if you want to delete a person from CourseInstructor which is refereced by school. | This is a pretty clear error message that a quick google would help you resolve faster.
Table CourseInstructor has a foreign key relationship with Table Person. In your EF diagram you can see this as a relationship (a line between two entities).
The database will not let you delete a Person while a CourseInstructor ... |
14,052,889 | I'm using Entity Framework in asp.net in Visual Studio 2012. I'm just learning these stuffs. I followed this [tutorial](http://www.asp.net/web-forms/tutorials/getting-started-with-ef/the-entity-framework-and-aspnet-getting-started-part-2)
Just created the grid and I run the web site, everything is fine except the dele... | 2012/12/27 | [
"https://Stackoverflow.com/questions/14052889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1460703/"
] | Your answer for your question is given in your tutorial. (Applicable only if you are using the same tables and same constraints)
under "*Revising EntityDataSource Control Markup to Improve Performance*"
>
> The Delete button also works. Click delete for a row that has an enrollment date and the row disappears. (Rows ... | This is a pretty clear error message that a quick google would help you resolve faster.
Table CourseInstructor has a foreign key relationship with Table Person. In your EF diagram you can see this as a relationship (a line between two entities).
The database will not let you delete a Person while a CourseInstructor ... |
14,509,900 | I have an array of filenames and each process need to create and write only to a single file.
This is what I came to:
```
foreach ($filenames as $VMidFile) {
if (file_exists($VMidFile)) { // A
continue;
}
$fp = fopen($VMidFile, 'c'); // B
if (!flock($fp, LOCK_EX | LOCK_NB)) { // C
co... | 2013/01/24 | [
"https://Stackoverflow.com/questions/14509900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/251311/"
] | Rather than creating a file and hoping that it's not interfered with:
1. create a *temporary* file
2. do all necessary file operations on it
3. [`rename`](http://php.net/manual/en/function.rename.php) it to the new location if location doesn't exist.
Technically, since `rename` will overwrite the destination there is... | You can secure exclusive access using [semaphores](http://php.net/manual/de/ref.sem.php) (UNIX only, and provided the `sysvsem` extension is installed):
```
$s = sem_get(ftok($filename), 'foo');
sem_acquire($s);
// Do some critical work...
sem_release($s);
```
Otherwise you can also use [`flock`](http://php.net/fl... |
14,509,900 | I have an array of filenames and each process need to create and write only to a single file.
This is what I came to:
```
foreach ($filenames as $VMidFile) {
if (file_exists($VMidFile)) { // A
continue;
}
$fp = fopen($VMidFile, 'c'); // B
if (!flock($fp, LOCK_EX | LOCK_NB)) { // C
co... | 2013/01/24 | [
"https://Stackoverflow.com/questions/14509900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/251311/"
] | A possible, slightly ugly solution would be to lock on a lock file and then testing if the file exists:
```
$lock = fopen("/tmp/".$filename."LOCK", "w"); // A
if (!flock($lock, LOCK_EX)) { // B
continue;
}
if(!file_exists($filename)){ // C
//File doesn't exist so we know that this thread will create it
//... | Rather than creating a file and hoping that it's not interfered with:
1. create a *temporary* file
2. do all necessary file operations on it
3. [`rename`](http://php.net/manual/en/function.rename.php) it to the new location if location doesn't exist.
Technically, since `rename` will overwrite the destination there is... |
14,509,900 | I have an array of filenames and each process need to create and write only to a single file.
This is what I came to:
```
foreach ($filenames as $VMidFile) {
if (file_exists($VMidFile)) { // A
continue;
}
$fp = fopen($VMidFile, 'c'); // B
if (!flock($fp, LOCK_EX | LOCK_NB)) { // C
co... | 2013/01/24 | [
"https://Stackoverflow.com/questions/14509900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/251311/"
] | Rather than creating a file and hoping that it's not interfered with:
1. create a *temporary* file
2. do all necessary file operations on it
3. [`rename`](http://php.net/manual/en/function.rename.php) it to the new location if location doesn't exist.
Technically, since `rename` will overwrite the destination there is... | Use mode 'x' instead of 'c' in your fopen call. And check the resulting $fp, if it's false, the file wasn't created by the current thread, and you should continue to the next filename.
Also, depending your PHP's installation settings, you may want to put an @ in front of the fopen call to suppress any warnings if fope... |
14,509,900 | I have an array of filenames and each process need to create and write only to a single file.
This is what I came to:
```
foreach ($filenames as $VMidFile) {
if (file_exists($VMidFile)) { // A
continue;
}
$fp = fopen($VMidFile, 'c'); // B
if (!flock($fp, LOCK_EX | LOCK_NB)) { // C
co... | 2013/01/24 | [
"https://Stackoverflow.com/questions/14509900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/251311/"
] | A possible, slightly ugly solution would be to lock on a lock file and then testing if the file exists:
```
$lock = fopen("/tmp/".$filename."LOCK", "w"); // A
if (!flock($lock, LOCK_EX)) { // B
continue;
}
if(!file_exists($filename)){ // C
//File doesn't exist so we know that this thread will create it
//... | You can secure exclusive access using [semaphores](http://php.net/manual/de/ref.sem.php) (UNIX only, and provided the `sysvsem` extension is installed):
```
$s = sem_get(ftok($filename), 'foo');
sem_acquire($s);
// Do some critical work...
sem_release($s);
```
Otherwise you can also use [`flock`](http://php.net/fl... |
14,509,900 | I have an array of filenames and each process need to create and write only to a single file.
This is what I came to:
```
foreach ($filenames as $VMidFile) {
if (file_exists($VMidFile)) { // A
continue;
}
$fp = fopen($VMidFile, 'c'); // B
if (!flock($fp, LOCK_EX | LOCK_NB)) { // C
co... | 2013/01/24 | [
"https://Stackoverflow.com/questions/14509900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/251311/"
] | You can secure exclusive access using [semaphores](http://php.net/manual/de/ref.sem.php) (UNIX only, and provided the `sysvsem` extension is installed):
```
$s = sem_get(ftok($filename), 'foo');
sem_acquire($s);
// Do some critical work...
sem_release($s);
```
Otherwise you can also use [`flock`](http://php.net/fl... | Use mode 'x' instead of 'c' in your fopen call. And check the resulting $fp, if it's false, the file wasn't created by the current thread, and you should continue to the next filename.
Also, depending your PHP's installation settings, you may want to put an @ in front of the fopen call to suppress any warnings if fope... |
14,509,900 | I have an array of filenames and each process need to create and write only to a single file.
This is what I came to:
```
foreach ($filenames as $VMidFile) {
if (file_exists($VMidFile)) { // A
continue;
}
$fp = fopen($VMidFile, 'c'); // B
if (!flock($fp, LOCK_EX | LOCK_NB)) { // C
co... | 2013/01/24 | [
"https://Stackoverflow.com/questions/14509900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/251311/"
] | A possible, slightly ugly solution would be to lock on a lock file and then testing if the file exists:
```
$lock = fopen("/tmp/".$filename."LOCK", "w"); // A
if (!flock($lock, LOCK_EX)) { // B
continue;
}
if(!file_exists($filename)){ // C
//File doesn't exist so we know that this thread will create it
//... | Use mode 'x' instead of 'c' in your fopen call. And check the resulting $fp, if it's false, the file wasn't created by the current thread, and you should continue to the next filename.
Also, depending your PHP's installation settings, you may want to put an @ in front of the fopen call to suppress any warnings if fope... |
7,006 | I've been teaching the Open Office suite to adults. I've found some tutorials online, but I don't like them very much.
There is always the possibility of doing one myself, but instead I could translate a good tutorial to portuguese, my first language.
So, does **anyone knows of a good open office tutorial**?
Thanks | 2009/07/17 | [
"https://superuser.com/questions/7006",
"https://superuser.com",
"https://superuser.com/users/28/"
] | First, I'd suggest getting the [pt version](http://pt.openoffice.org/) for your students. Next, (if you don't mind reading Brazilian-Portuguese) visit <http://www.broffice.org/> for a wealth of [documentation and information](http://www.broffice.org/docs) em portuguese.
Furthermore, if your students understand english... | You could just get a MS office tutorial, even though microsoft stinks, open office is still alot like it. |
7,006 | I've been teaching the Open Office suite to adults. I've found some tutorials online, but I don't like them very much.
There is always the possibility of doing one myself, but instead I could translate a good tutorial to portuguese, my first language.
So, does **anyone knows of a good open office tutorial**?
Thanks | 2009/07/17 | [
"https://superuser.com/questions/7006",
"https://superuser.com",
"https://superuser.com/users/28/"
] | First, I'd suggest getting the [pt version](http://pt.openoffice.org/) for your students. Next, (if you don't mind reading Brazilian-Portuguese) visit <http://www.broffice.org/> for a wealth of [documentation and information](http://www.broffice.org/docs) em portuguese.
Furthermore, if your students understand english... | I've written one [here](http://www.filefactory.com/file/cdd6378/n/LO_2011-Aug.pdf). It's on LibreOffice - which is almost the same. |
7,006 | I've been teaching the Open Office suite to adults. I've found some tutorials online, but I don't like them very much.
There is always the possibility of doing one myself, but instead I could translate a good tutorial to portuguese, my first language.
So, does **anyone knows of a good open office tutorial**?
Thanks | 2009/07/17 | [
"https://superuser.com/questions/7006",
"https://superuser.com",
"https://superuser.com/users/28/"
] | You could just get a MS office tutorial, even though microsoft stinks, open office is still alot like it. | I've written one [here](http://www.filefactory.com/file/cdd6378/n/LO_2011-Aug.pdf). It's on LibreOffice - which is almost the same. |
65,752,838 | Can you use a C++ pointer to reference information in another file? I am seeing if you can reference pieces of information from a local csv file, or should i be using a different language? Added question, would there be a way to run multiple processes at the same time. | 2021/01/16 | [
"https://Stackoverflow.com/questions/65752838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15019991/"
] | You can use a pointer to point to "memory". Which in case of a typical C++ implementation within a modern operating system means "virtual memory". File storage is not in virtual memory. Operating systems do have ways to "map" files into memory. If you do that, then you can use a pointer to point to virtual memory that ... | As explained aside, a pointer contains a memory address, which means that it will point only something that is already into memory, whether this comes from a file or another. You'll need to load it first.
However, if your question is: "can I point onto something that is declared in another **source** file", the answer... |
301,539 | Does anyone have a good approach to learning a new type of database when they already are proficient in another one? I have thought about writing notes to myself about how to do various tasks that I am familiar with on the old db and showing the equivalent in the new one.
For example, I like to read manuals. But shoul... | 2021/10/22 | [
"https://dba.stackexchange.com/questions/301539",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/131520/"
] | Start reading documents, for MongoDB read [MongoDB Tutorials](https://docs.mongodb.com/manual/tutorial/). Then visit <https://stackoverflow.com/questions/tagged/mongodb> and try to find solution for the questions from other people - that's where I learned a lot.
Just one tip: don't try to translate SQL commands to NoS... | As always, start with their version of The Concepts Guide.
Study it as you would an on-line class. |
161,635 | I currently have a switched and un-switched hot running underground in conduit sharing the same neutral and ground. Its important to note that they are both on the same circuit. Basically I have 4 wires (switched Hot, UnSwitched Hot, 1x Neutral, and 1 Ground). The Switched Hot powers 3 Lamps in my back yard and the uns... | 2019/04/08 | [
"https://diy.stackexchange.com/questions/161635",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/99246/"
] | That is correct, the shared neutral will confuse the GFCIs.
Anyway that is a waste of a GFCI. You should site a single GFCI device *before* the switch, ideally right at or after the service panel. | No.
The neutral current must exactly equal the phase current on any GFCI (within a margin of error), or it will trip.
They will be seeing only one load's current on the phase, but both on the neutral, making it unequal.
Your options pretty much all require fitting the GFCI before the circuit splits at the first swit... |
161,635 | I currently have a switched and un-switched hot running underground in conduit sharing the same neutral and ground. Its important to note that they are both on the same circuit. Basically I have 4 wires (switched Hot, UnSwitched Hot, 1x Neutral, and 1 Ground). The Switched Hot powers 3 Lamps in my back yard and the uns... | 2019/04/08 | [
"https://diy.stackexchange.com/questions/161635",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/99246/"
] | That is correct, the shared neutral will confuse the GFCIs.
Anyway that is a waste of a GFCI. You should site a single GFCI device *before* the switch, ideally right at or after the service panel. | Thank You both...As suggested I traced the circuit to the first switch witch was the one that controlled the light fixture in the dining room. I went ahead and cut out the single gang outlet and fitted a two-Gang box and spliced in the GFCI and voila both switched and un-switched lines are now protected with 1 GFCI.
S... |
1,285,417 | I have a table with a single unique VARCHAR(512) field. I want to have another table hold a foreign key reference to this first table. Both tables use InnoDB.
If I add a VARCHAR(512) key to the second table and add a foreign key constraint on it will the 512 bytes long data be held twice?
If so, is there a way to hold... | 2009/08/16 | [
"https://Stackoverflow.com/questions/1285417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/157439/"
] | Yes, if you have a `VARCHAR(512)` column on the referencing table, the data will exist twice.
I recommend that you make the referencing table's foreign key refer to an integer primary key for the first table, not the 512-byte data. This is kind of what normalization is all about. | I ran a simple test: create 3 tables, one to hold the data itself with two columns, and ID (int) and the data (varchar[120]), another table that uses the ID as foreign key and a last one that uses the data as foreign key:
```
CREATE TABLE `dados` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(120)... |
1,285,417 | I have a table with a single unique VARCHAR(512) field. I want to have another table hold a foreign key reference to this first table. Both tables use InnoDB.
If I add a VARCHAR(512) key to the second table and add a foreign key constraint on it will the 512 bytes long data be held twice?
If so, is there a way to hold... | 2009/08/16 | [
"https://Stackoverflow.com/questions/1285417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/157439/"
] | Yes, if you have a `VARCHAR(512)` column on the referencing table, the data will exist twice.
I recommend that you make the referencing table's foreign key refer to an integer primary key for the first table, not the 512-byte data. This is kind of what normalization is all about. | Keeping the key size small is always good. You could get around the problem of having a large `VARCHAR` indexed by instead having an additional checksum column that you generate at insert time. This checksum field would contain the output of a hashing algorithm `CRC32()` or maybe `MD5()` of the larger column. |
1,285,417 | I have a table with a single unique VARCHAR(512) field. I want to have another table hold a foreign key reference to this first table. Both tables use InnoDB.
If I add a VARCHAR(512) key to the second table and add a foreign key constraint on it will the 512 bytes long data be held twice?
If so, is there a way to hold... | 2009/08/16 | [
"https://Stackoverflow.com/questions/1285417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/157439/"
] | I ran a simple test: create 3 tables, one to hold the data itself with two columns, and ID (int) and the data (varchar[120]), another table that uses the ID as foreign key and a last one that uses the data as foreign key:
```
CREATE TABLE `dados` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(120)... | Keeping the key size small is always good. You could get around the problem of having a large `VARCHAR` indexed by instead having an additional checksum column that you generate at insert time. This checksum field would contain the output of a hashing algorithm `CRC32()` or maybe `MD5()` of the larger column. |
1,073,532 | How can I find Bitwise AND of all numbers for a given range say from A to B, including both?
I found a beautiful answer for finding XOR for such range. <https://stackoverflow.com/a/10670524/2046703>
How to do this to find AND? | 2014/12/18 | [
"https://math.stackexchange.com/questions/1073532",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/200739/"
] | The only bits that will be $1$ will be bits that are common to the upper bits of $A$ and $B$. Everything else will have at least one instance of a $0$ in that range. So just start from the high order bit downwards. Output the matching bits. As soon as you hit a disagreement between the binaries of $A$ and $B$ (which wi... | One way of doing it:
```
long long and(long long a, long long b) {
long long x = a^b;
long long s = x>>1;
while (s) {
x = x|s;
s >>= 1;
}
return a&b&~x;
}
```
First, the idea is exactly Ross'; starting from the highest bit, check if
$\operatorname{bit}\_k(a) = \operatorname{bit}\... |
1,073,532 | How can I find Bitwise AND of all numbers for a given range say from A to B, including both?
I found a beautiful answer for finding XOR for such range. <https://stackoverflow.com/a/10670524/2046703>
How to do this to find AND? | 2014/12/18 | [
"https://math.stackexchange.com/questions/1073532",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/200739/"
] | The only bits that will be $1$ will be bits that are common to the upper bits of $A$ and $B$. Everything else will have at least one instance of a $0$ in that range. So just start from the high order bit downwards. Output the matching bits. As soon as you hit a disagreement between the binaries of $A$ and $B$ (which wi... | Another solution is to find the common "left header" of m and n. Bitwise AND of this common left header definitely results in 1, while the remaining right part results in 0 since at least 1 bit in a number between m and n is 0. Below is the Python code:
```
def rangeBitwiseAnd(self, m, n):
shift = 0
#find the ... |
1,073,532 | How can I find Bitwise AND of all numbers for a given range say from A to B, including both?
I found a beautiful answer for finding XOR for such range. <https://stackoverflow.com/a/10670524/2046703>
How to do this to find AND? | 2014/12/18 | [
"https://math.stackexchange.com/questions/1073532",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/200739/"
] | The only bits that will be $1$ will be bits that are common to the upper bits of $A$ and $B$. Everything else will have at least one instance of a $0$ in that range. So just start from the high order bit downwards. Output the matching bits. As soon as you hit a disagreement between the binaries of $A$ and $B$ (which wi... | For searching leetcode "Bitwise AND of Numbers Range" I reached here, use a long long or python integer doesn't have integer overflowing problem, while if you want to try to use C with regular 32bit signed integer, you've chosen the hard way
I got finally figured out a solution, wonderful for embedded board running en... |
1,073,532 | How can I find Bitwise AND of all numbers for a given range say from A to B, including both?
I found a beautiful answer for finding XOR for such range. <https://stackoverflow.com/a/10670524/2046703>
How to do this to find AND? | 2014/12/18 | [
"https://math.stackexchange.com/questions/1073532",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/200739/"
] | Another solution is to find the common "left header" of m and n. Bitwise AND of this common left header definitely results in 1, while the remaining right part results in 0 since at least 1 bit in a number between m and n is 0. Below is the Python code:
```
def rangeBitwiseAnd(self, m, n):
shift = 0
#find the ... | One way of doing it:
```
long long and(long long a, long long b) {
long long x = a^b;
long long s = x>>1;
while (s) {
x = x|s;
s >>= 1;
}
return a&b&~x;
}
```
First, the idea is exactly Ross'; starting from the highest bit, check if
$\operatorname{bit}\_k(a) = \operatorname{bit}\... |
1,073,532 | How can I find Bitwise AND of all numbers for a given range say from A to B, including both?
I found a beautiful answer for finding XOR for such range. <https://stackoverflow.com/a/10670524/2046703>
How to do this to find AND? | 2014/12/18 | [
"https://math.stackexchange.com/questions/1073532",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/200739/"
] | Another solution is to find the common "left header" of m and n. Bitwise AND of this common left header definitely results in 1, while the remaining right part results in 0 since at least 1 bit in a number between m and n is 0. Below is the Python code:
```
def rangeBitwiseAnd(self, m, n):
shift = 0
#find the ... | For searching leetcode "Bitwise AND of Numbers Range" I reached here, use a long long or python integer doesn't have integer overflowing problem, while if you want to try to use C with regular 32bit signed integer, you've chosen the hard way
I got finally figured out a solution, wonderful for embedded board running en... |
36,782 | $xy\geq 4$
The answer my book gives me is a hyperbola, but I always thought a hyperbola was a difference between two variables, how does this work? | 2011/05/03 | [
"https://math.stackexchange.com/questions/36782",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/9334/"
] | To graph the region of the plane corresponding to $xy\geq 4$, you start by graphing the region of the plane corresponding to $xy=4$. This is the graph of $y=\frac{4}{x}$, which is a hyperbola (not a parabola).
The region in which $xy\geq 4$ is then: for $x\gt 0$, the region where $y\geq \frac{4}{x}$: the portion of th... | I think you are probably used to seeing the equation of hyperbola being written as $$\frac{x^2}{a^2} - \frac{y^2}{b^2} = 1$$
However, note that if we transform variables as $\tilde{x} = \frac{x}{a} + \frac{y}{b}$ and $\tilde{y} = \frac{x}{a} - \frac{y}{b}$, then the equation transforms as $$\tilde{x} \tilde{y} = 1$$
No... |
4,223,832 | I've got a search function loading results with ajax and shows the results using a slide animation. Works great! But only the first time unfortunately, the second time (and onwards) the slide down animation doesn't work.
Please have a look here:
<http://jsfiddle.net/e4sQh/4/>
The search is'nt performed there and no a... | 2010/11/19 | [
"https://Stackoverflow.com/questions/4223832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/513321/"
] | It adds padding to the left. Very useful for remembering the various string formatting patterns is the following cheat sheet:
>
> **[.NET String.Format Cheat Sheet](https://web.archive.org/web/20120803184243/http://www.dylanbeattie.net/cheatsheets/dot_net_string_format_cheat_sheet.pdf)**
>
>
>
Positive values add... | This is a padding value...if the argument isn't the length that is specified, it puts spaces in.
E.g. if you had {0,10} and the argument for {0} was "Blah", the actual value printed would be `"Blah<SPACE><SPACE><SPACE><SPACE><SPACE><SPACE>"`...Blah, with 6 extra spaces to make up a string of 10 length
ps - not sure h... |
4,223,832 | I've got a search function loading results with ajax and shows the results using a slide animation. Works great! But only the first time unfortunately, the second time (and onwards) the slide down animation doesn't work.
Please have a look here:
<http://jsfiddle.net/e4sQh/4/>
The search is'nt performed there and no a... | 2010/11/19 | [
"https://Stackoverflow.com/questions/4223832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/513321/"
] | It adds padding to the left. Very useful for remembering the various string formatting patterns is the following cheat sheet:
>
> **[.NET String.Format Cheat Sheet](https://web.archive.org/web/20120803184243/http://www.dylanbeattie.net/cheatsheets/dot_net_string_format_cheat_sheet.pdf)**
>
>
>
Positive values add... | When you see `{x,y}`, `x` represents the argument's index and `y` the alignment, as specified [here](http://msdn.microsoft.com/en-us/library/txafckwd%28v=VS.80%29.aspx). The complete syntax is the following:
```
{index[,alignment][:formatString]}
``` |
4,223,832 | I've got a search function loading results with ajax and shows the results using a slide animation. Works great! But only the first time unfortunately, the second time (and onwards) the slide down animation doesn't work.
Please have a look here:
<http://jsfiddle.net/e4sQh/4/>
The search is'nt performed there and no a... | 2010/11/19 | [
"https://Stackoverflow.com/questions/4223832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/513321/"
] | When you see `{x,y}`, `x` represents the argument's index and `y` the alignment, as specified [here](http://msdn.microsoft.com/en-us/library/txafckwd%28v=VS.80%29.aspx). The complete syntax is the following:
```
{index[,alignment][:formatString]}
``` | This is a padding value...if the argument isn't the length that is specified, it puts spaces in.
E.g. if you had {0,10} and the argument for {0} was "Blah", the actual value printed would be `"Blah<SPACE><SPACE><SPACE><SPACE><SPACE><SPACE>"`...Blah, with 6 extra spaces to make up a string of 10 length
ps - not sure h... |
182,161 | I just started creating a Drupal 8 theme.
For example in Drupal 7 if I want to remove the breadcrumb, I just need to remove this line of code `<?php if ($breadcrumb) print $breadcrumb; ?>` from the `page.tpl.php`.
In Drupal 8 I removed `{{ page.breadcrumb }}` from the `page.html.twig` and I still seeing the breadcr... | 2015/11/26 | [
"https://drupal.stackexchange.com/questions/182161",
"https://drupal.stackexchange.com",
"https://drupal.stackexchange.com/users/17418/"
] | Yes, what you are seeing is the render cache. If you are developing a theme, you likely want to disable render caching and enable twig debug. See sites/example.settings.local.php for instructions on how to do that.
That said, breadcrumbs, like almost everything else, is a block now. Blocks are configuration. If you do... | I did the same in bartik theme, removed the breadcrumb line, even removed the page.content line but no effect. I went on and cleared the cache and back to the page and the changes were made. So you need to clear your cache. |
781,796 | $x^2+1=0$ cannot be solved via real numbers.
Because of this, we extend the real numbers to complex numbers.We can solve $x^2+1=0$ and $x^2+x+1=0$ equations after we define complex numbers.
I wonder if we can solve all equations ( includes only the functions that are analytic.) via complex numbers or not?
If It is y... | 2014/05/05 | [
"https://math.stackexchange.com/questions/781796",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/22430/"
] | All polynomial equations with non-constant polynomials with complex coefficients can be solved with complex numbers. This is the fundamental theorem of algebra. [Link here.](http://en.wikipedia.org/wiki/Fundamental_theorem_of_algebra)
All equations in general can not. For example, $z\bar z = -1$ has no solutions in $\... | The idea of "all equations" is somewhat cloudy: What are admissible equations in the context of this question?
Consider the equation
$$f(z):=\sqrt{4+z^2}- \log z=0\ .$$
Here $f$ is not uniquely defined in all of ${\mathbb C}$. It would be difficult to make general statements about the existence of solutions if such eq... |
114,589 | Right now I am using:
```
$wp_query->post->ID;
```
I want to know if there is a better way for getting the post id that consumes less resources? | 2013/09/17 | [
"https://wordpress.stackexchange.com/questions/114589",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/14128/"
] | An alternative to your way would be to access the `$post` global:
```
global $post
echo $post->ID;
```
But
1. It won't make a noticeable difference, either way
2. If you want to increase efficiency, you ought to be looking elsewhere...
**EDIT**, pertaining to comments:
>
> what about `get_the_ID();`?
>
>
>
-... | You can also use `get_queried_object_id()` in conjunction with `is_main_query()` outside the Loop
```
if ( is_main_query() )
$mypostid = get_queried_object_id();
```
Note that this function will return author id on a archive page, category id on a category archive, etc. |
23,198,841 | I am stuck with an SQL command where I am joinig two tables. I have two tables: a 'restaurant' table and a 'review' table. The relationship is many reviews to one restaurant. After joining the tables I have many reviews for each restaurant, hence I end up with many duplicates for each restaurant. All I need is to group... | 2014/04/21 | [
"https://Stackoverflow.com/questions/23198841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3100233/"
] | It appears that you just want to ensure that there is at least one review for a restaurant for it to be listed. You can either using a `LEFT OUTER JOIN` or `WHERE EXISTS` to accomplish this requirement.
**LEFT OUTER JOIN:**
```
SELECT DISTINCT a.Restaurant_Id, a.Restaurant_Name, a.Restaurant_Location,
a.Restauran... | EDIT: As noted in the comments, it turns out the table contains IMAGE data and is therefore not comparable. That means GROUP BY and DISTINCT will both fail. I'll leave this up as it might make that but obvious to someone else at some point.
---
You *could* group by all the field you want to return.
```
SELECT a.Rest... |
6,185,221 | This is probably basic stuff, so if there's some kind of online reference for how html text & margins work, please just throw me a link.
Anyway, I'm having some trouble defining exact margins for text. Below is an example of an image, a div containing text below it and more text below the div. Other margins are set to... | 2011/05/31 | [
"https://Stackoverflow.com/questions/6185221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/425530/"
] | That's because the font doesn't use the entire height. A better (though maybe not perfect) indication would be to select the text and check the margins between the black border and the highlighted rectangle. And that goes for the text below 'testing' too. It will occupy part of those 14px. | I can't reproduce your problem. Could you recreate the problematic situation with <http://jsfiddle.net/> to share it with us?
However there are problems with your CSS. You shouldn't specify the 9px height on the div (it's at least 20px high due to the margins). Specifying the line height has nothing to do with the siz... |
6,185,221 | This is probably basic stuff, so if there's some kind of online reference for how html text & margins work, please just throw me a link.
Anyway, I'm having some trouble defining exact margins for text. Below is an example of an image, a div containing text below it and more text below the div. Other margins are set to... | 2011/05/31 | [
"https://Stackoverflow.com/questions/6185221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/425530/"
] | That's because the font doesn't use the entire height. A better (though maybe not perfect) indication would be to select the text and check the margins between the black border and the highlighted rectangle. And that goes for the text below 'testing' too. It will occupy part of those 14px. | [Looks fine to me](http://jsfiddle.net/fcHZN/1/)
Here, I've added some backgrounds so you can see where the boxes go: <http://jsfiddle.net/Eric/fcHZN/3/>
There's definitely a 10px gap between the boxes. Looks like your extra spacing is coming from your image or the `Siirry` text, neither of which we have CSS for. |
225,839 | Here <https://source.android.com/devices/tech/connect/wifi-mac-randomization> is the MAC Randomization described and stated
>
> Note: Randomized MAC addresses are generated per SSID and are
> persistent.
>
>
>
I can confirm, deleting the SSID, rebooting and connecting again there is the same random MAC as before.... | 2020/06/10 | [
"https://android.stackexchange.com/questions/225839",
"https://android.stackexchange.com",
"https://android.stackexchange.com/users/325235/"
] | On Android 11 there is a new option "Wi-Fi-enhanced MAC randomization" in the developer options.
When you enable it and delete/forget the network and then reconnect you get every time a new MAC address. Also you get a new MAC address for this Wifi/SSID when you reboot your device. Disabling and enabling Wifi is not en... | The key related to MAC randomization is only generated for the first time.
And the MAC address is calculated by calling `hmac_sha256` over the SSID with the generated key.
This key is stored in the `/data/...` on the device, and as far as I know, Android does not provide any API to remove it.
But when you perform a f... |
225,839 | Here <https://source.android.com/devices/tech/connect/wifi-mac-randomization> is the MAC Randomization described and stated
>
> Note: Randomized MAC addresses are generated per SSID and are
> persistent.
>
>
>
I can confirm, deleting the SSID, rebooting and connecting again there is the same random MAC as before.... | 2020/06/10 | [
"https://android.stackexchange.com/questions/225839",
"https://android.stackexchange.com",
"https://android.stackexchange.com/users/325235/"
] | The key related to MAC randomization is only generated for the first time.
And the MAC address is calculated by calling `hmac_sha256` over the SSID with the generated key.
This key is stored in the `/data/...` on the device, and as far as I know, Android does not provide any API to remove it.
But when you perform a f... | Here is a list of events that will change your random MAC:
* The network name changes
* The operating system is upgraded and the device connects to the network for the first time after the upgrade
* The network name is "forgotten" in the phone settings and then reconnected to
Source: <https://wifi-helpcenter.nokia.co... |
225,839 | Here <https://source.android.com/devices/tech/connect/wifi-mac-randomization> is the MAC Randomization described and stated
>
> Note: Randomized MAC addresses are generated per SSID and are
> persistent.
>
>
>
I can confirm, deleting the SSID, rebooting and connecting again there is the same random MAC as before.... | 2020/06/10 | [
"https://android.stackexchange.com/questions/225839",
"https://android.stackexchange.com",
"https://android.stackexchange.com/users/325235/"
] | On Android 11 there is a new option "Wi-Fi-enhanced MAC randomization" in the developer options.
When you enable it and delete/forget the network and then reconnect you get every time a new MAC address. Also you get a new MAC address for this Wifi/SSID when you reboot your device. Disabling and enabling Wifi is not en... | Here is a list of events that will change your random MAC:
* The network name changes
* The operating system is upgraded and the device connects to the network for the first time after the upgrade
* The network name is "forgotten" in the phone settings and then reconnected to
Source: <https://wifi-helpcenter.nokia.co... |
16,419,693 | I would like to convert it to a date so that I can display it in the proper format which is, well, a ridiculous format anyways.
this is my current format (which is a string):
```
2012/03/06 00:00:00
```
this is what I'm going to change it to:
```
06-MAR-12
``` | 2013/05/07 | [
"https://Stackoverflow.com/questions/16419693",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/445000/"
] | A JSON array has no explicit indexes, it's just an *ordered list*. The only JSON data structure that has *named keys* is an object. The literal should make this quite obvious:
```
["foo", "bar", "baz"]
```
This *array* has no named indices and there isn't any provision to add any.
PHP conflates both lists and key-v... | <http://php.net/manual/en/function.json-decode.php>
Set 2nd parameter of json\_decode to true to atleast get assoc arrays.
Aside from that: javascript can't handle non-sequential/non-contiguous array indexes, so as soon as the id's are not sequential, json has no other option then to convert it into "string" indexes. |
16,419,693 | I would like to convert it to a date so that I can display it in the proper format which is, well, a ridiculous format anyways.
this is my current format (which is a string):
```
2012/03/06 00:00:00
```
this is what I'm going to change it to:
```
06-MAR-12
``` | 2013/05/07 | [
"https://Stackoverflow.com/questions/16419693",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/445000/"
] | I have now got a working solution which is fast and works well.
1. Firstly, as written in SO link from the question;
>
> In JSON, arrays only have numeric keys, whereas objects have string
> properties. The inclusion of a array key forces the entire outer
> structure to be an object by necessity.
>
>
>
In JS... | <http://php.net/manual/en/function.json-decode.php>
Set 2nd parameter of json\_decode to true to atleast get assoc arrays.
Aside from that: javascript can't handle non-sequential/non-contiguous array indexes, so as soon as the id's are not sequential, json has no other option then to convert it into "string" indexes. |
16,419,693 | I would like to convert it to a date so that I can display it in the proper format which is, well, a ridiculous format anyways.
this is my current format (which is a string):
```
2012/03/06 00:00:00
```
this is what I'm going to change it to:
```
06-MAR-12
``` | 2013/05/07 | [
"https://Stackoverflow.com/questions/16419693",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/445000/"
] | This is your object:
```
$parent=new StdClass();
$parent->ID=101;
$parent->ParentID=0;
$parent->Name='Root One';
$child1=new StdClass();
$child1->ID=1011;
$child1->ParentID=$parent->ID;
$child1->Name='Child One';
$parent->Children[]=$child1;
$child1_1=new StdClass();
$child1_1->ID=10111;
$child1_1->ParentID=$child1-... | <http://php.net/manual/en/function.json-decode.php>
Set 2nd parameter of json\_decode to true to atleast get assoc arrays.
Aside from that: javascript can't handle non-sequential/non-contiguous array indexes, so as soon as the id's are not sequential, json has no other option then to convert it into "string" indexes. |
16,419,693 | I would like to convert it to a date so that I can display it in the proper format which is, well, a ridiculous format anyways.
this is my current format (which is a string):
```
2012/03/06 00:00:00
```
this is what I'm going to change it to:
```
06-MAR-12
``` | 2013/05/07 | [
"https://Stackoverflow.com/questions/16419693",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/445000/"
] | A JSON array has no explicit indexes, it's just an *ordered list*. The only JSON data structure that has *named keys* is an object. The literal should make this quite obvious:
```
["foo", "bar", "baz"]
```
This *array* has no named indices and there isn't any provision to add any.
PHP conflates both lists and key-v... | This is your object:
```
$parent=new StdClass();
$parent->ID=101;
$parent->ParentID=0;
$parent->Name='Root One';
$child1=new StdClass();
$child1->ID=1011;
$child1->ParentID=$parent->ID;
$child1->Name='Child One';
$parent->Children[]=$child1;
$child1_1=new StdClass();
$child1_1->ID=10111;
$child1_1->ParentID=$child1-... |
16,419,693 | I would like to convert it to a date so that I can display it in the proper format which is, well, a ridiculous format anyways.
this is my current format (which is a string):
```
2012/03/06 00:00:00
```
this is what I'm going to change it to:
```
06-MAR-12
``` | 2013/05/07 | [
"https://Stackoverflow.com/questions/16419693",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/445000/"
] | I have now got a working solution which is fast and works well.
1. Firstly, as written in SO link from the question;
>
> In JSON, arrays only have numeric keys, whereas objects have string
> properties. The inclusion of a array key forces the entire outer
> structure to be an object by necessity.
>
>
>
In JS... | This is your object:
```
$parent=new StdClass();
$parent->ID=101;
$parent->ParentID=0;
$parent->Name='Root One';
$child1=new StdClass();
$child1->ID=1011;
$child1->ParentID=$parent->ID;
$child1->Name='Child One';
$parent->Children[]=$child1;
$child1_1=new StdClass();
$child1_1->ID=10111;
$child1_1->ParentID=$child1-... |
45,084,216 | I'm building my first React app. I'm trying to render some Routes from react-router-dom.
From the main component I call to my api to get a json object, then I update the state. The problem is my child component doesn't re-render after I have set the new state so I don't have props in the child components. I have used ... | 2017/07/13 | [
"https://Stackoverflow.com/questions/45084216",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5542809/"
] | I fixed this by listening to Gusman and Alex S's advice of using the primary key to seed with. I had to delete all data and reset the identity counter first for the `Attribute` table and its depending `AttributeTerm` table
```
DBCC CHECKIDENT ('Attributes', RESEED, 0)
DBCC CHECKIDENT ('AttributeTerms', RESEED, 0)
``` | You have two columns that are unique right? The AttributeId and the AttributeName, so in the AddOrUpdate you should set this. Here's the solution:
```
context.Attributes.AddOrUpdate(a => new { a.AttributeId , a.AttributeName} , attributes);
context.SaveChanges();
``` |
32,014,540 | I'm having difficulty using the find() function when in this situation. Say, I have a big text string called "Inventory", which might look like this:
```
"[some text] 25 Item ABC [more text]"
```
I want to build a sheet that turns this text string into a proper spreadsheet which looks like this:
```
|Item A | 0 |... | 2015/08/14 | [
"https://Stackoverflow.com/questions/32014540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5228100/"
] | Use `attr_accessor :name, :health, :age, :strength` if you would like the variables to be both readable and writable or `attr_reader :name, :health, :age, :strength` if you would like them to be read only.
After this you can access with `brad.varname` e.g. `brad.name` etc...
[[Documentation](http://ruby-doc.org/core-... | Use `attr_reader :age`, so you can simply use `brad.age`, same goes for the other variables |
32,014,540 | I'm having difficulty using the find() function when in this situation. Say, I have a big text string called "Inventory", which might look like this:
```
"[some text] 25 Item ABC [more text]"
```
I want to build a sheet that turns this text string into a proper spreadsheet which looks like this:
```
|Item A | 0 |... | 2015/08/14 | [
"https://Stackoverflow.com/questions/32014540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5228100/"
] | Use `attr_reader :age`, so you can simply use `brad.age`, same goes for the other variables | Use the `attr_reader` method, it creates a attribute method to point to the variable in the `initialize` method which is private. Its **read-only**
You can use `attr_writer` to **write only**
And `attr_accessor` to both **read and write**
```
class Viking
attr_reader :age, :name, :health, :strength
de... |
32,014,540 | I'm having difficulty using the find() function when in this situation. Say, I have a big text string called "Inventory", which might look like this:
```
"[some text] 25 Item ABC [more text]"
```
I want to build a sheet that turns this text string into a proper spreadsheet which looks like this:
```
|Item A | 0 |... | 2015/08/14 | [
"https://Stackoverflow.com/questions/32014540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5228100/"
] | Use `attr_accessor :name, :health, :age, :strength` if you would like the variables to be both readable and writable or `attr_reader :name, :health, :age, :strength` if you would like them to be read only.
After this you can access with `brad.varname` e.g. `brad.name` etc...
[[Documentation](http://ruby-doc.org/core-... | Use the `attr_reader` method, it creates a attribute method to point to the variable in the `initialize` method which is private. Its **read-only**
You can use `attr_writer` to **write only**
And `attr_accessor` to both **read and write**
```
class Viking
attr_reader :age, :name, :health, :strength
de... |
32,014,540 | I'm having difficulty using the find() function when in this situation. Say, I have a big text string called "Inventory", which might look like this:
```
"[some text] 25 Item ABC [more text]"
```
I want to build a sheet that turns this text string into a proper spreadsheet which looks like this:
```
|Item A | 0 |... | 2015/08/14 | [
"https://Stackoverflow.com/questions/32014540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5228100/"
] | Use `attr_accessor :name, :health, :age, :strength` if you would like the variables to be both readable and writable or `attr_reader :name, :health, :age, :strength` if you would like them to be read only.
After this you can access with `brad.varname` e.g. `brad.name` etc...
[[Documentation](http://ruby-doc.org/core-... | If you **really don't want them global**, try `instance_variable_get` method <http://apidock.com/ruby/Object/instance_variable_get>
```
puts brad.instance_variable_get(:@age)
``` |
32,014,540 | I'm having difficulty using the find() function when in this situation. Say, I have a big text string called "Inventory", which might look like this:
```
"[some text] 25 Item ABC [more text]"
```
I want to build a sheet that turns this text string into a proper spreadsheet which looks like this:
```
|Item A | 0 |... | 2015/08/14 | [
"https://Stackoverflow.com/questions/32014540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5228100/"
] | If you **really don't want them global**, try `instance_variable_get` method <http://apidock.com/ruby/Object/instance_variable_get>
```
puts brad.instance_variable_get(:@age)
``` | Use the `attr_reader` method, it creates a attribute method to point to the variable in the `initialize` method which is private. Its **read-only**
You can use `attr_writer` to **write only**
And `attr_accessor` to both **read and write**
```
class Viking
attr_reader :age, :name, :health, :strength
de... |
46,038,425 | So like this, I intend to make a row with bootstrap using `col-md-5`. I think will make three container lined up. But when I connect to the database, the result is not as hopeful !! I think the result can still lined up but even down to the bottom. any solutions?
This is the coding and the result when I connect to th... | 2017/09/04 | [
"https://Stackoverflow.com/questions/46038425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8549887/"
] | Updates after the question was updated:
I think you're correct - it seems the postSoftCommit event is only exposed to plugins that directly subscribe by calling `registerSoftCommitCallback` instead of through solrconfig, [see the code that handles registration from solrconfig](https://github.com/apache/lucene-solr/blo... | Since you said you were open to alternative solutions...
[As of Solr 7.0, you can subscribe to a query](https://lucene.apache.org/solr/guide/7_5/stream-source-reference.html#topic) |
24,477,532 | I'd like to know how to trigger the Dropzone.js' default file upload input?
It's not as simple like this:
```
window.dropCloud = = new Dropzone("#dropCloud", {...});
$(window.dropCloud.clickableElements[0]).trigger("click");
```
Now i don't have any ideas. Anyway the whole `#dropCloud` container is hidden, if it mat... | 2014/06/29 | [
"https://Stackoverflow.com/questions/24477532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/273792/"
] | I had same problem and after quite a time of trying, i finally found a way how to add additional clickable areas to existing DropZone upload form.
Note: There must be at least one "original" clickable area attached initially by `clickable` parameter.
```
var DZ = Dropzone.forElement('.dropzone'); // Change selector t... | Sigh... I think its the ugliest solution I've made... While init fn running.
```
this.clickableElements.push($("#anotherUploadBtn")[0]);
this.clickableElements.forEach(function(y){ ....
```
Any better ideas? |
24,477,532 | I'd like to know how to trigger the Dropzone.js' default file upload input?
It's not as simple like this:
```
window.dropCloud = = new Dropzone("#dropCloud", {...});
$(window.dropCloud.clickableElements[0]).trigger("click");
```
Now i don't have any ideas. Anyway the whole `#dropCloud` container is hidden, if it mat... | 2014/06/29 | [
"https://Stackoverflow.com/questions/24477532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/273792/"
] | This seems to work great for me
```
var dropZone = new Dropzone($("#yourdropzonedivthinger").get(0), {
BLAH BLAH BLAH drop zone init stuff
});
//Call this anywhere in your code to manually trigger the dropzone file dialog popup thinger
dropZone.hiddenFileInput.click();
``` | Sigh... I think its the ugliest solution I've made... While init fn running.
```
this.clickableElements.push($("#anotherUploadBtn")[0]);
this.clickableElements.forEach(function(y){ ....
```
Any better ideas? |
24,477,532 | I'd like to know how to trigger the Dropzone.js' default file upload input?
It's not as simple like this:
```
window.dropCloud = = new Dropzone("#dropCloud", {...});
$(window.dropCloud.clickableElements[0]).trigger("click");
```
Now i don't have any ideas. Anyway the whole `#dropCloud` container is hidden, if it mat... | 2014/06/29 | [
"https://Stackoverflow.com/questions/24477532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/273792/"
] | Simple. In version 4.0 you can do:
```
new Dropzone(".element", {
clickable: '.myTrigger'
});
new Dropzone(".element", {
clickable: ['.myTrigger', '.myOtherTrigger']
});
``` | Sigh... I think its the ugliest solution I've made... While init fn running.
```
this.clickableElements.push($("#anotherUploadBtn")[0]);
this.clickableElements.forEach(function(y){ ....
```
Any better ideas? |
24,477,532 | I'd like to know how to trigger the Dropzone.js' default file upload input?
It's not as simple like this:
```
window.dropCloud = = new Dropzone("#dropCloud", {...});
$(window.dropCloud.clickableElements[0]).trigger("click");
```
Now i don't have any ideas. Anyway the whole `#dropCloud` container is hidden, if it mat... | 2014/06/29 | [
"https://Stackoverflow.com/questions/24477532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/273792/"
] | This seems to work great for me
```
var dropZone = new Dropzone($("#yourdropzonedivthinger").get(0), {
BLAH BLAH BLAH drop zone init stuff
});
//Call this anywhere in your code to manually trigger the dropzone file dialog popup thinger
dropZone.hiddenFileInput.click();
``` | I had same problem and after quite a time of trying, i finally found a way how to add additional clickable areas to existing DropZone upload form.
Note: There must be at least one "original" clickable area attached initially by `clickable` parameter.
```
var DZ = Dropzone.forElement('.dropzone'); // Change selector t... |
24,477,532 | I'd like to know how to trigger the Dropzone.js' default file upload input?
It's not as simple like this:
```
window.dropCloud = = new Dropzone("#dropCloud", {...});
$(window.dropCloud.clickableElements[0]).trigger("click");
```
Now i don't have any ideas. Anyway the whole `#dropCloud` container is hidden, if it mat... | 2014/06/29 | [
"https://Stackoverflow.com/questions/24477532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/273792/"
] | Simple. In version 4.0 you can do:
```
new Dropzone(".element", {
clickable: '.myTrigger'
});
new Dropzone(".element", {
clickable: ['.myTrigger', '.myOtherTrigger']
});
``` | I had same problem and after quite a time of trying, i finally found a way how to add additional clickable areas to existing DropZone upload form.
Note: There must be at least one "original" clickable area attached initially by `clickable` parameter.
```
var DZ = Dropzone.forElement('.dropzone'); // Change selector t... |
24,477,532 | I'd like to know how to trigger the Dropzone.js' default file upload input?
It's not as simple like this:
```
window.dropCloud = = new Dropzone("#dropCloud", {...});
$(window.dropCloud.clickableElements[0]).trigger("click");
```
Now i don't have any ideas. Anyway the whole `#dropCloud` container is hidden, if it mat... | 2014/06/29 | [
"https://Stackoverflow.com/questions/24477532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/273792/"
] | I had same problem and after quite a time of trying, i finally found a way how to add additional clickable areas to existing DropZone upload form.
Note: There must be at least one "original" clickable area attached initially by `clickable` parameter.
```
var DZ = Dropzone.forElement('.dropzone'); // Change selector t... | ```
jQuery("#file-uploader").dropzone({
url: "/upload/",
paramName: "file",
maxFilesize: 5,
acceptedFiles: 'image/*,.jpeg,.jpg',
autoProcessQueue: true,
clickable: ['#file-uploader *','#file-uploader'],
init: function() {
this.hiddenFileInput.click(); ... |
24,477,532 | I'd like to know how to trigger the Dropzone.js' default file upload input?
It's not as simple like this:
```
window.dropCloud = = new Dropzone("#dropCloud", {...});
$(window.dropCloud.clickableElements[0]).trigger("click");
```
Now i don't have any ideas. Anyway the whole `#dropCloud` container is hidden, if it mat... | 2014/06/29 | [
"https://Stackoverflow.com/questions/24477532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/273792/"
] | This seems to work great for me
```
var dropZone = new Dropzone($("#yourdropzonedivthinger").get(0), {
BLAH BLAH BLAH drop zone init stuff
});
//Call this anywhere in your code to manually trigger the dropzone file dialog popup thinger
dropZone.hiddenFileInput.click();
``` | ```
jQuery("#file-uploader").dropzone({
url: "/upload/",
paramName: "file",
maxFilesize: 5,
acceptedFiles: 'image/*,.jpeg,.jpg',
autoProcessQueue: true,
clickable: ['#file-uploader *','#file-uploader'],
init: function() {
this.hiddenFileInput.click(); ... |
24,477,532 | I'd like to know how to trigger the Dropzone.js' default file upload input?
It's not as simple like this:
```
window.dropCloud = = new Dropzone("#dropCloud", {...});
$(window.dropCloud.clickableElements[0]).trigger("click");
```
Now i don't have any ideas. Anyway the whole `#dropCloud` container is hidden, if it mat... | 2014/06/29 | [
"https://Stackoverflow.com/questions/24477532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/273792/"
] | Simple. In version 4.0 you can do:
```
new Dropzone(".element", {
clickable: '.myTrigger'
});
new Dropzone(".element", {
clickable: ['.myTrigger', '.myOtherTrigger']
});
``` | ```
jQuery("#file-uploader").dropzone({
url: "/upload/",
paramName: "file",
maxFilesize: 5,
acceptedFiles: 'image/*,.jpeg,.jpg',
autoProcessQueue: true,
clickable: ['#file-uploader *','#file-uploader'],
init: function() {
this.hiddenFileInput.click(); ... |
37,001,816 | I'm trying to make a Bootstrap menu like this one <https://makr.com/>
I´m doing ok, but I haven't figured out how I can make it completely transparent one hover.
As you can see in the fiddle below there is always some shade of grey in the dropdown when I hover.
I really don´t know what more I can do... I've been goo... | 2016/05/03 | [
"https://Stackoverflow.com/questions/37001816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5587988/"
] | Try this:
```
.navbar:hover {
background: rgba(248, 248, 248, 0.7) none repeat scroll 0 0 !important;
}
.navbar-default *:hover{
background:transparent !important;
}
```
see [fiddle.](https://jsfiddle.net/xt55p4dp/) | Hi there please try the following css
```
.dropdown.full-width {
width : 120px;
background-image: transparent;
background-color: transparent;
}
.full-width.dropdown > .dropdown-menu > li > a {
white-space: normal;
background-image: transparent;
background-color: rgba(255,255,255,0.5); //or any level of transpar... |
1,581,474 | Since $y$ cannot possibly be linear combination of span x, so {$x\_1,...,x\_k,y$} is certainly independent. But I don't know how to explain in formal language, could someone help? | 2015/12/18 | [
"https://math.stackexchange.com/questions/1581474",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/283716/"
] | The "formula" "$y\in z$" . . . isn't really a formula. It's not expressible, unless $z$ is definable from parameters in the model somehow. So in general the axiom of separation won't apply.
---
For example, take (by the Lowenheim-Skolem theorem) a model $M$ of ZFC containing $\omega$ but which is countable. Then most... | The subset schema (or replacement or collection schemata) allow parameters.
So the formula $y\in z$, while can be used to define a collection, can only appeal to $z$ that already exists in the model. Namely, if $z$ is already a set. Also note that this is a very semantic way of looking at things. We work in a fixed mo... |
73,201,475 | I am new to aws and created an EC2 instance to start migrating my source code from DigitalOcean. The problem is that I can't access any open ports on my EC2 other than port 22 through the ssh client. Here are some of my configurations. Do I need to restart ec2 to make these changes ? Thanks for the help.
* EC2 inbound... | 2022/08/02 | [
"https://Stackoverflow.com/questions/73201475",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10790671/"
] | I realized that opening the port in ufw is not enough. There must be a service or application running on these ports to be able to access it. When i install postgresql my port 5432 is opened. Thanks for all the help! | AWS EC2 instances have a virtual firewall infront of each instance called a security group.
See : <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-security-groups.html>
>
> A security group acts as a virtual firewall for your EC2 instances to
> control incoming and outgoing traffic. Inbound rules control the
... |
16,387,733 | I've ran into quite an annoying problem.
I've got these global variables (for keeping the name etc)
```
List<object> NumeriekVakken = new List<object>();
List<decimal> bedragenLijst = new List<decimal>();
List<string> namenlijstVanNumericFields = new List<string>();
List<string> namenLijst = n... | 2013/05/05 | [
"https://Stackoverflow.com/questions/16387733",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2262409/"
] | You have assigned the event handler `buttonWijzig_Click` to a control button.
This control is not defined anywhere in your code above.
(By the way, you assign the method at the same control for every loop)
I think you want to assign your event handler to every NumericUpDown created in the loop as
```
numeriekVak.... | The problem is: since you event is fired by a button, you cannot convert the sender to numeric updown.
I see you have only one `button` and it's not declared in you code.
I assume it's in the form, right???
>
> Did you mean to add that click event many times to a single button???
>
>
> Or did you mean to add event... |
16,387,733 | I've ran into quite an annoying problem.
I've got these global variables (for keeping the name etc)
```
List<object> NumeriekVakken = new List<object>();
List<decimal> bedragenLijst = new List<decimal>();
List<string> namenlijstVanNumericFields = new List<string>();
List<string> namenLijst = n... | 2013/05/05 | [
"https://Stackoverflow.com/questions/16387733",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2262409/"
] | You have assigned the event handler `buttonWijzig_Click` to a control button.
This control is not defined anywhere in your code above.
(By the way, you assign the method at the same control for every loop)
I think you want to assign your event handler to every NumericUpDown created in the loop as
```
numeriekVak.... | ```
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if(e.RowIndex >= 0) {
DataGridViewRow row = this.dataGridView1.Rows[e.RowIndex];
iD_supplierNumericUpDown.Value = row.Cells["ID"].Selected(); // this is the problem
nSupplierTex... |
2,898,993 | How can a silent installer be created in WiX that does not display any UI dialogs to the user and installs, upgrades and uninstalls with default settings? | 2010/05/24 | [
"https://Stackoverflow.com/questions/2898993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/234319/"
] | [Windows Installer](http://en.wikipedia.org/wiki/Windows_installer) (MSI) uses the following command line arguments to be silent:
Silent install or silent major upgrade:
```
msiexec.exe /i foo.msi /qn
```
Silent minor upgrade:
```
msiexec.exe /i foo.msi REINSTALL=ALL REINSTALLMODE=vomus /qn
```
Silent uninstall:... | Just don't include any UI/UIRef elements and then no UI will be included :) |
2,898,993 | How can a silent installer be created in WiX that does not display any UI dialogs to the user and installs, upgrades and uninstalls with default settings? | 2010/05/24 | [
"https://Stackoverflow.com/questions/2898993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/234319/"
] | [Windows Installer](http://en.wikipedia.org/wiki/Windows_installer) (MSI) uses the following command line arguments to be silent:
Silent install or silent major upgrade:
```
msiexec.exe /i foo.msi /qn
```
Silent minor upgrade:
```
msiexec.exe /i foo.msi REINSTALL=ALL REINSTALLMODE=vomus /qn
```
Silent uninstall:... | All MSI installers whether created by WiX or not can be controlled via command line arguments. So you can make an installer with UI and still install it silently, there is no need to remove the UI from the installer just suppress it on the command line. Remember, make sure you add the upgrade element in your first inst... |
2,898,993 | How can a silent installer be created in WiX that does not display any UI dialogs to the user and installs, upgrades and uninstalls with default settings? | 2010/05/24 | [
"https://Stackoverflow.com/questions/2898993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/234319/"
] | [Windows Installer](http://en.wikipedia.org/wiki/Windows_installer) (MSI) uses the following command line arguments to be silent:
Silent install or silent major upgrade:
```
msiexec.exe /i foo.msi /qn
```
Silent minor upgrade:
```
msiexec.exe /i foo.msi REINSTALL=ALL REINSTALLMODE=vomus /qn
```
Silent uninstall:... | Installer .exe's created with WiX can be run from the command line without requiring user input by using one of these command line parameters:
* /quiet - Displays no UI whatsoever
* /passive - Displays a UI but requires no user input. Essentially just displays an install progress bar
This answer is based on WiX 3.9. |
2,898,993 | How can a silent installer be created in WiX that does not display any UI dialogs to the user and installs, upgrades and uninstalls with default settings? | 2010/05/24 | [
"https://Stackoverflow.com/questions/2898993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/234319/"
] | All MSI installers whether created by WiX or not can be controlled via command line arguments. So you can make an installer with UI and still install it silently, there is no need to remove the UI from the installer just suppress it on the command line. Remember, make sure you add the upgrade element in your first inst... | Just don't include any UI/UIRef elements and then no UI will be included :) |
2,898,993 | How can a silent installer be created in WiX that does not display any UI dialogs to the user and installs, upgrades and uninstalls with default settings? | 2010/05/24 | [
"https://Stackoverflow.com/questions/2898993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/234319/"
] | Installer .exe's created with WiX can be run from the command line without requiring user input by using one of these command line parameters:
* /quiet - Displays no UI whatsoever
* /passive - Displays a UI but requires no user input. Essentially just displays an install progress bar
This answer is based on WiX 3.9. | Just don't include any UI/UIRef elements and then no UI will be included :) |
2,898,993 | How can a silent installer be created in WiX that does not display any UI dialogs to the user and installs, upgrades and uninstalls with default settings? | 2010/05/24 | [
"https://Stackoverflow.com/questions/2898993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/234319/"
] | Installer .exe's created with WiX can be run from the command line without requiring user input by using one of these command line parameters:
* /quiet - Displays no UI whatsoever
* /passive - Displays a UI but requires no user input. Essentially just displays an install progress bar
This answer is based on WiX 3.9. | All MSI installers whether created by WiX or not can be controlled via command line arguments. So you can make an installer with UI and still install it silently, there is no need to remove the UI from the installer just suppress it on the command line. Remember, make sure you add the upgrade element in your first inst... |
76,987 | Can the word *tenebrous* be used to mean *ambiguous*?
>
> Your statement is ambiguous.
>
>
> Your statement is **tenebrous**.
>
>
> | 2012/08/03 | [
"https://english.stackexchange.com/questions/76987",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/24431/"
] | "*Tenebrous*" mostly means obscurity or darkness. Thus it implies [lack of clarity of expression](http://www.thefreedictionary.com/ambiguous).
On the other hand, "*ambiguous*" usually indicates the presence of two or more meanings.
To answer your question, yes, "*tenebrous*" can be used instead, but it wouldn't be ... | [MW](http://www.merriam-webster.com/dictionary/tenebrous) offers as one of the definitions of tenebrous:
*hard to understand: obscure*
I find the metaphorical reference to *darkness* appealing. |
1,311 | In connection with the moderator elections, we will be holding a Town Hall Chat session with the candidates. This will be an opportunity for members of the community to pose questions to the candidates on the topic of moderation. Participation is completely voluntary. I am working with the candidates to find a time tha... | 2012/01/26 | [
"https://scifi.meta.stackexchange.com/questions/1311",
"https://scifi.meta.stackexchange.com",
"https://scifi.meta.stackexchange.com/users/12/"
] | Just a thought for future elections. It might be better to try and time the nomination phase so that at least part of the chat options fall on a weekend, for those of us (which, I would think, is most) who have work during the day; the workday limits my availability quite a bit. | The first would work for me, the 30th would be okay, but not great. The best times would be UTC times 100-400 sometime (So, I guess technically it would be the next day for each of those days). |
1,311 | In connection with the moderator elections, we will be holding a Town Hall Chat session with the candidates. This will be an opportunity for members of the community to pose questions to the candidates on the topic of moderation. Participation is completely voluntary. I am working with the candidates to find a time tha... | 2012/01/26 | [
"https://scifi.meta.stackexchange.com/questions/1311",
"https://scifi.meta.stackexchange.com",
"https://scifi.meta.stackexchange.com/users/12/"
] | I third the desire to have this on a weekend. Also, the selected time might allow the most participation from the *candidates*, but does it allow the most participation from the *electorate*? For me (in the UK), it's at 2am, for Europeans it's 3am. This is a global, 24/7 site and all users should have the opportunity t... | The first would work for me, the 30th would be okay, but not great. The best times would be UTC times 100-400 sometime (So, I guess technically it would be the next day for each of those days). |
1,311 | In connection with the moderator elections, we will be holding a Town Hall Chat session with the candidates. This will be an opportunity for members of the community to pose questions to the candidates on the topic of moderation. Participation is completely voluntary. I am working with the candidates to find a time tha... | 2012/01/26 | [
"https://scifi.meta.stackexchange.com/questions/1311",
"https://scifi.meta.stackexchange.com",
"https://scifi.meta.stackexchange.com/users/12/"
] | The first would work for me, the 30th would be okay, but not great. The best times would be UTC times 100-400 sometime (So, I guess technically it would be the next day for each of those days). | Alright for me.. Its 7:30 AM in my time zone! |
1,311 | In connection with the moderator elections, we will be holding a Town Hall Chat session with the candidates. This will be an opportunity for members of the community to pose questions to the candidates on the topic of moderation. Participation is completely voluntary. I am working with the candidates to find a time tha... | 2012/01/26 | [
"https://scifi.meta.stackexchange.com/questions/1311",
"https://scifi.meta.stackexchange.com",
"https://scifi.meta.stackexchange.com/users/12/"
] | Just a thought for future elections. It might be better to try and time the nomination phase so that at least part of the chat options fall on a weekend, for those of us (which, I would think, is most) who have work during the day; the workday limits my availability quite a bit. | I second the desire to have this on a weekend. But, since that's not happening, I'm free on both days, UTC 0000-0400. I'm in the US, Central Time Zone. |
1,311 | In connection with the moderator elections, we will be holding a Town Hall Chat session with the candidates. This will be an opportunity for members of the community to pose questions to the candidates on the topic of moderation. Participation is completely voluntary. I am working with the candidates to find a time tha... | 2012/01/26 | [
"https://scifi.meta.stackexchange.com/questions/1311",
"https://scifi.meta.stackexchange.com",
"https://scifi.meta.stackexchange.com/users/12/"
] | Just a thought for future elections. It might be better to try and time the nomination phase so that at least part of the chat options fall on a weekend, for those of us (which, I would think, is most) who have work during the day; the workday limits my availability quite a bit. | I third the desire to have this on a weekend. Also, the selected time might allow the most participation from the *candidates*, but does it allow the most participation from the *electorate*? For me (in the UK), it's at 2am, for Europeans it's 3am. This is a global, 24/7 site and all users should have the opportunity t... |
1,311 | In connection with the moderator elections, we will be holding a Town Hall Chat session with the candidates. This will be an opportunity for members of the community to pose questions to the candidates on the topic of moderation. Participation is completely voluntary. I am working with the candidates to find a time tha... | 2012/01/26 | [
"https://scifi.meta.stackexchange.com/questions/1311",
"https://scifi.meta.stackexchange.com",
"https://scifi.meta.stackexchange.com/users/12/"
] | Just a thought for future elections. It might be better to try and time the nomination phase so that at least part of the chat options fall on a weekend, for those of us (which, I would think, is most) who have work during the day; the workday limits my availability quite a bit. | Alright for me.. Its 7:30 AM in my time zone! |
1,311 | In connection with the moderator elections, we will be holding a Town Hall Chat session with the candidates. This will be an opportunity for members of the community to pose questions to the candidates on the topic of moderation. Participation is completely voluntary. I am working with the candidates to find a time tha... | 2012/01/26 | [
"https://scifi.meta.stackexchange.com/questions/1311",
"https://scifi.meta.stackexchange.com",
"https://scifi.meta.stackexchange.com/users/12/"
] | I third the desire to have this on a weekend. Also, the selected time might allow the most participation from the *candidates*, but does it allow the most participation from the *electorate*? For me (in the UK), it's at 2am, for Europeans it's 3am. This is a global, 24/7 site and all users should have the opportunity t... | I second the desire to have this on a weekend. But, since that's not happening, I'm free on both days, UTC 0000-0400. I'm in the US, Central Time Zone. |
1,311 | In connection with the moderator elections, we will be holding a Town Hall Chat session with the candidates. This will be an opportunity for members of the community to pose questions to the candidates on the topic of moderation. Participation is completely voluntary. I am working with the candidates to find a time tha... | 2012/01/26 | [
"https://scifi.meta.stackexchange.com/questions/1311",
"https://scifi.meta.stackexchange.com",
"https://scifi.meta.stackexchange.com/users/12/"
] | I second the desire to have this on a weekend. But, since that's not happening, I'm free on both days, UTC 0000-0400. I'm in the US, Central Time Zone. | Alright for me.. Its 7:30 AM in my time zone! |
1,311 | In connection with the moderator elections, we will be holding a Town Hall Chat session with the candidates. This will be an opportunity for members of the community to pose questions to the candidates on the topic of moderation. Participation is completely voluntary. I am working with the candidates to find a time tha... | 2012/01/26 | [
"https://scifi.meta.stackexchange.com/questions/1311",
"https://scifi.meta.stackexchange.com",
"https://scifi.meta.stackexchange.com/users/12/"
] | I third the desire to have this on a weekend. Also, the selected time might allow the most participation from the *candidates*, but does it allow the most participation from the *electorate*? For me (in the UK), it's at 2am, for Europeans it's 3am. This is a global, 24/7 site and all users should have the opportunity t... | Alright for me.. Its 7:30 AM in my time zone! |
29,277,949 | This is an strict aliasing question, as in will the compiler cause any optimization order problems with this.
Say that I have three public `float`s in a `struct XMFLOAT3` (not unlike [this one](https://msdn.microsoft.com/en-us/library/windows/desktop/microsoft.directx_sdk.reference.xmfloat3%28v=vs.85%29.aspx).) And I ... | 2015/03/26 | [
"https://Stackoverflow.com/questions/29277949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2642059/"
] | The `reinterpret_cast` from `XMFLOAT3*` to `float*` is OK, due to:
9.2 [class.mem] paragraph 20:
>
> If a standard-layout class object has any non-static data members, its address is the same as the address of its first non-static data member. Otherwise, its address is the same as the address of its first base class... | It's completely valid; this has nothing to do with strict aliasing whatsoever.
Strict aliasing rules require that pointers aliasing each other have compatible types;
clearly, `float*` is compatible with `float*`. |
29,277,949 | This is an strict aliasing question, as in will the compiler cause any optimization order problems with this.
Say that I have three public `float`s in a `struct XMFLOAT3` (not unlike [this one](https://msdn.microsoft.com/en-us/library/windows/desktop/microsoft.directx_sdk.reference.xmfloat3%28v=vs.85%29.aspx).) And I ... | 2015/03/26 | [
"https://Stackoverflow.com/questions/29277949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2642059/"
] | It's completely valid; this has nothing to do with strict aliasing whatsoever.
Strict aliasing rules require that pointers aliasing each other have compatible types;
clearly, `float*` is compatible with `float*`. | Consider a reasonably smart compiler:
```
XMFLOAT3 foo = {1.0f, 2.0f, 3.0f};
auto bar = &foo.x;
bar[2] += 5.0f;
foo.z += 5.0f; // Since no previous expression referenced .z, I know .z==8.0
cout << foo.z; // So optimize this to a hardcoded cout << 8.0f
```
Replacing variable accesses and operations by known results... |
29,277,949 | This is an strict aliasing question, as in will the compiler cause any optimization order problems with this.
Say that I have three public `float`s in a `struct XMFLOAT3` (not unlike [this one](https://msdn.microsoft.com/en-us/library/windows/desktop/microsoft.directx_sdk.reference.xmfloat3%28v=vs.85%29.aspx).) And I ... | 2015/03/26 | [
"https://Stackoverflow.com/questions/29277949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2642059/"
] | The `reinterpret_cast` from `XMFLOAT3*` to `float*` is OK, due to:
9.2 [class.mem] paragraph 20:
>
> If a standard-layout class object has any non-static data members, its address is the same as the address of its first non-static data member. Otherwise, its address is the same as the address of its first base class... | Consider a reasonably smart compiler:
```
XMFLOAT3 foo = {1.0f, 2.0f, 3.0f};
auto bar = &foo.x;
bar[2] += 5.0f;
foo.z += 5.0f; // Since no previous expression referenced .z, I know .z==8.0
cout << foo.z; // So optimize this to a hardcoded cout << 8.0f
```
Replacing variable accesses and operations by known results... |
73,600,957 | The following code will work (only sometimes though ??) with older versions of PowerShell but not at all with version 7+.
All I want to do is create a new Application Pool in IIS 10+.
The documentation is very poor and most examples don't work anymore. Is there something I am missing here?
```
# PowerShell 7.2.6
... | 2022/09/04 | [
"https://Stackoverflow.com/questions/73600957",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/541107/"
] | I am not real sure why you are encountering this (and not in any position to experiment), but, when push comes to shove, you can always call ...
```
appcmd add apppool /name:myAppPool
```
or with other settings
```
appcmd add apppool /name:myAppPool /managedRuntimeVersion:v2.0 /managedPipelineMode:Integrated
appcmd... | I have added this in extra to the post I have marked as the answer to help anybody in the future as the documentation and examples to do this are all over the place.
Do note the date of this post as some \*stuff may have been fixed in the future.
I like to use PowerShell (modules) only, where I can but in this case t... |
59,333,020 | I have two Dataframes, G1 and G2:
G1:
```
studentId midterm homework final
101 45 69 89
102 20 22 11
103 11 11 11
```
G2:
```
studentId midterm homework final
101 55 69 89
102 20 65 11
103 11 11 11
```... | 2019/12/14 | [
"https://Stackoverflow.com/questions/59333020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12281343/"
] | Since you are taking the value on page load the value is empty, you should take the value inside the click handler function.
**Please Note:** If the value is a plain string (not htmlString) instead of `innerHTML` it is better to use `textContent` or `innerText` property of the element.
```html
<input type="text" id="... | You are referencing the value of the input at the start of the JS execution which will have the initial value of the input which is empty string.
Try putting this
`var n = document.getElementById('userInput').value;` inside the function |
35,760,927 | I have a data.table with 3 columns: id, time and status. For each id, I want to find the record with the maximum time - then if for that record, the status is true, I want to set it to false if the time is > 7 (for example). I am doing it in the following manner.
```
x <- data.table(id=c(1,1,2,2),time=c(5,6,7,8),statu... | 2016/03/03 | [
"https://Stackoverflow.com/questions/35760927",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2506086/"
] | One `data.table` approach is
```
x[ x[order(time), .I[.N], by=id]$V1 , status := ifelse(time > 7, FALSE, TRUE)]
> x
# id time status
#1: 1 5 FALSE
#2: 1 6 TRUE
#3: 2 7 FALSE
#4: 2 8 FALSE
```
as `x[order(time), .I[.N], by=id]$V1` gives us the row index of the maximum `time` for each group (`i... | Here's another way, similar to the OP's:
```
y = unique(x[,c("id","time"), with=FALSE], by="id", fromLast=TRUE)
x[y[time > 7], status := FALSE]
```
Here's another benchmark:
```
n_id = 1e3; n_col = 100; n_draw = 5
set.seed(1)
X = data.table(id = 1:n_id)[, .(
time = sample(10,n_draw),
status = sample(... |
35,760,927 | I have a data.table with 3 columns: id, time and status. For each id, I want to find the record with the maximum time - then if for that record, the status is true, I want to set it to false if the time is > 7 (for example). I am doing it in the following manner.
```
x <- data.table(id=c(1,1,2,2),time=c(5,6,7,8),statu... | 2016/03/03 | [
"https://Stackoverflow.com/questions/35760927",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2506086/"
] | ```
x[x[,.N, by=id][,cumsum(N)], status := status * time <=7]
```
If i am not mistaken, this is no join as `x[,.N, by=id][,cumsum(N)]` returns the row-indices of the last elements per group.
**Update:**
After seeing the speed comparison this one seems the winner and should be listed first
This was my initial attem... | Here's another way, similar to the OP's:
```
y = unique(x[,c("id","time"), with=FALSE], by="id", fromLast=TRUE)
x[y[time > 7], status := FALSE]
```
Here's another benchmark:
```
n_id = 1e3; n_col = 100; n_draw = 5
set.seed(1)
X = data.table(id = 1:n_id)[, .(
time = sample(10,n_draw),
status = sample(... |
35,760,927 | I have a data.table with 3 columns: id, time and status. For each id, I want to find the record with the maximum time - then if for that record, the status is true, I want to set it to false if the time is > 7 (for example). I am doing it in the following manner.
```
x <- data.table(id=c(1,1,2,2),time=c(5,6,7,8),statu... | 2016/03/03 | [
"https://Stackoverflow.com/questions/35760927",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2506086/"
] | Another attempt:
```
x[ x[,.I==.I[which.max(time)], by=id]$V1 & time > 7, status := FALSE]
x
# id time status
#1: 1 5 FALSE
#2: 1 6 TRUE
#3: 2 7 FALSE
#4: 2 8 FALSE
``` | Here's another way, similar to the OP's:
```
y = unique(x[,c("id","time"), with=FALSE], by="id", fromLast=TRUE)
x[y[time > 7], status := FALSE]
```
Here's another benchmark:
```
n_id = 1e3; n_col = 100; n_draw = 5
set.seed(1)
X = data.table(id = 1:n_id)[, .(
time = sample(10,n_draw),
status = sample(... |
23,625,461 | many media says firefox support h264 in webrtc, but I can't find any information.
How to enable h264 in webrtc?
This is my mediaConstraints
```
var mediaConstraints = {
video: {
mandatory: {
maxWidth: 640,
maxHeight: 480
}
},
audio: true
};
``` | 2014/05/13 | [
"https://Stackoverflow.com/questions/23625461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1702570/"
] | It would seem that H264 is not supported by default yet. You will have to add the [codec line manually into the SDP](https://bugzilla.mozilla.org/show_bug.cgi?id=985253) before setting it as local and sending the offer. It does look like they are hard at work to get it out soon. You can see this with the work that jesu... | As of right now I tested on Firefox 36.0.4 and I can see h264 lines in the SDP.
An Example of what I see that indicates the support for H264:
```
....
m=video 9 RTP/SAVPF 120 126 97
....
a=rtpmap:97 H264/90000
....
```
97 is the dynamic payload type, used here for H264. I hope it helps. |
52,891,188 | I have reports that have drill downs. Currently, there are some columns with zero values and users are still able to click on that empty or zero cell and access a blank report. We want to take off this ability so that when a cell or column is zero or empty the drill downlink is disabled. How do I accomplish this? | 2018/10/19 | [
"https://Stackoverflow.com/questions/52891188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3021088/"
] | No. Comments are ignored by the compiler and runtime engine, therefore there would be no point in referring to a String resource. If you are looking to create the same comment over and over in the source code, [recording a macro](https://www.jetbrains.com/help/idea/using-macros-in-the-editor.html) in Android Studio wil... | >
> Can We use string resources for code comment in android?
>
>
>
**No You can't**
Comments are just ignored by compiler and never get executed. |
18,868,250 | In my website I have a few elements setup in this way:
1. class='up' id='1'
2. class='up' id='2'
3. class='up' id='3'
4. class='up' id='4'
etc.. (number of elements unknown)
My problem is when trying to identify them in javascript. I tried to use the following code (JQuery) to select a specific element:
```
$('.up#'+... | 2013/09/18 | [
"https://Stackoverflow.com/questions/18868250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1079017/"
] | CSS `id` values [cannot start with a digit](http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier), so the selector `.up#1` is invalid (as is the selector `#1`). If you modify your `id` values to start with a letter (I usually use `x` unless I have something more useful I can use, e.g. `x1`, `x2`, etc.), those s... | You should put a character in front of the `id`, like this.
```
<element id="e1" class="up">
$('#e' + id) //reference the element by id
``` |
13,652,556 | In a recent homework assignment I've been told to use `long` variable to store a result, since it may be a big number.
I decided to check will it really matter for me, on my system (intel core i5/64-bit windows 7/gnu gcc compiler) and found out that the following code:
```
printf("sizeof(char) => %d\n", sizeof(char))... | 2012/11/30 | [
"https://Stackoverflow.com/questions/13652556",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1115290/"
] | The language guarantees that `int` is at least 16 bits, `long` is at least 32 bits, and `long` can represent *at least* all the values that `int` can represent.
If you assign a `long` value to an `int` object, it will be implicitly converted. There's no need for an explicit cast; it would merely specify the same conve... | A `long` can always represent all values of `int`.
If the value at hand can be represented by the type of the variable you assign to, then the value is preserved.
If it can't be represented, then for signed destination type the result is formally unspecified, while for unsigned destination type it is specified as the ... |
59,581,910 | I'm trying to build an restful API.
When I make a call to one of my endpoints, I get following error message:
>
> SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) (SQL: select \* from `users`)
>
>
>
The wierd thing is why this error is showing up when I try to access the endp... | 2020/01/03 | [
"https://Stackoverflow.com/questions/59581910",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10503037/"
] | I would recommend to use ids instead of a form with submit because you will have to reload the page everytime and read the GET parameters out of the URL.
Use onclick instead, like this example:
```
<html>
<head>
<script>
function myFunction() {
if (document.getElementById("numb... | I would recommend using `onclick` handler rather than a submit handler for your submit button and assign an `id` to your `input`. The onclick function will evaluate your input's value. You can parse the input value to make it an integer and check it against 500.
Or, you can ignore the `parseInt` part and compare the ... |
116,539 | A [*true seeing*](https://www.d20pfsrd.com/magic/all-spells/t/true-seeing/) effect allows the creature to automatically "see through illusions," and many powerful monsters possess a constant ability that grants the monster an effect like *true seeing* (e.g. some [angels](http://www.d20pfsrd.com/bestiary/monster-listing... | 2018/03/02 | [
"https://rpg.stackexchange.com/questions/116539",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/42785/"
] | RAW I'd say no. A "visual" illusion spell cannot fool a [True Seeing](https://www.d20pfsrd.com/magic/all-spells/t/true-seeing/) spell unless the illusion is more than 120 feet away and still visible at that range. (True Seeing has a range of 120 feet.) For big illusions that probably works at the outset but if the dist... | **Use reverse psychology**, start with mundane alterations or hiding and then put an illusion of some other kind on top of it, if you are trying to hide something use an illusion that would seem enticing, distracting, or an easy target, if trying to draw them in, use a camouflage illusion or something threatening. Demo... |
16,705,787 | i am creating a forum for my website. i would like to know how does the "This is your favourate question" button in StackOverFlow webpage(ie this website) works?
i am using django.
i created models such as:
models.py
---------
```
class Question(models.Model):
user=models.ForeignKey(User)
created=models.Dat... | 2013/05/23 | [
"https://Stackoverflow.com/questions/16705787",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2351696/"
] | 1. You probably don't need the 'favourite' field. You can assume that, if there is entry in your table for a given question, related to a given user, that question is that users favorite.
2. You'll need to create a view which will take a question id, and mark it as the currently logged in user's favorite:
```
def mark... | i just edited jack shedd's answer
```
def mark_as_favorite(request, question_id, *args, **kwargs):
if request.user.is_authenticated():
fav, created = Favourite.objects.get_or_create(user=request.user, question=question)
if created:
return HttpResponse("Marked")
else:
... |
42,464,749 | I would like to display `checkbox` instead of image (image must be hidden in every row). Another problem is that `height` of the space reserved for the image must be same as image, but `width` must be 30px (height of the image is dynamic, so I don't know it). It would be ideal if checkbox is in the center of the space ... | 2017/02/26 | [
"https://Stackoverflow.com/questions/42464749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/867703/"
] | Apparently your device doesn't have other file viewer applications installed such as Polaris office or Office suite or any other of those kind file viewers.
Typically this is the exception you get for this kind of issues. You can either show a warning/toast or show some links to download these apps from play store. | I had this and it's a way to solve it.
```
try{
startActivity(intent);
} catch (ActivityNotFoundException e){
Toast.makeText(MainActivity.this,
"Error showing pdf", Toast.LENGTH_LONG).show();
}
``` |
63,794,359 | I have an array with the following structure.
```
0: "ID,NAME,NUMBER,DESCRIPTION"
1: "123,"PHILIP",0123456789,"OFFICE ADDRESS"
2: "456,"SARA",30345004698,"OFFICE SPACE""
```
I need to display it in a table. The table header will be the 0th row and remaining rows will be the table body rows (tr). Please help me to ... | 2020/09/08 | [
"https://Stackoverflow.com/questions/63794359",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1837869/"
] | See the expected output [Here](https://stackblitz.com/edit/angular-ivy-bdpsn7?file=src/app/app.component.css)
in component,
```
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComp... | I think the problem is that in
`this.tableRows = this.tableArrayRows.split(',');`
You are missing the tableArrayRows array position to split. If that's the problem something like:
`this.tableRows = this.tableArrayRows[this.tableArrayRows.length - 1].split(',');`
Should fix it. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.