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 |
|---|---|---|---|---|---|
317,217 | I'm getting only 30MB/sec between my computer and a USB drive, despite the fact that USB 2.0 supports 480Mb/sec (or 60MB/sec) transfers.
(Therefore, I'm only getting half the rated speed) Is there something present in the USB standard which should result in such half apparent speeds? | 2011/07/31 | [
"https://superuser.com/questions/317217",
"https://superuser.com",
"https://superuser.com/users/15329/"
] | The USB 2.0 interface can be a limit due to signalling and command overhead as well as spacing between packets.
I have a fast SSD connected by USB 2.0. The drive is much faster than the interface (by more a factor of 10).
Read Speed maxes out around 33 MB/s and Write Speed at 17.5 MB/s. Write Speeds are almost 50% sl... | I have never really thought much about calculating the speed, but clearly there is real overhead associated with this kind of transfer. I searched on Google and found post after post with speeds as you described, making me thing you are on to something.
I just whipped out a USB 2.0 1TB Seagate external drive, formated... |
317,217 | I'm getting only 30MB/sec between my computer and a USB drive, despite the fact that USB 2.0 supports 480Mb/sec (or 60MB/sec) transfers.
(Therefore, I'm only getting half the rated speed) Is there something present in the USB standard which should result in such half apparent speeds? | 2011/07/31 | [
"https://superuser.com/questions/317217",
"https://superuser.com",
"https://superuser.com/users/15329/"
] | Around 30 MB/sec is quite typical maximum transfer speed.
USB 1.0 and USB 2.0 connections are half-duplex, meaning data flows in only one direction at a time. Shared connection between both directions is probably biggest reason for slowdown than expected transfer speed.
In comparison, USB 3 and Ethernet are full dup... | USB 2 on Windows seems to top out at around 37 MB/s a second usually, even if the link speed of 480Mbps could support a bit more.
Different protocols are going to have different levels of overhead, and even different timings, and the latter can contribute to a full link speed not being utilised even if you are not oth... |
317,217 | I'm getting only 30MB/sec between my computer and a USB drive, despite the fact that USB 2.0 supports 480Mb/sec (or 60MB/sec) transfers.
(Therefore, I'm only getting half the rated speed) Is there something present in the USB standard which should result in such half apparent speeds? | 2011/07/31 | [
"https://superuser.com/questions/317217",
"https://superuser.com",
"https://superuser.com/users/15329/"
] | USB 2 uses 1 millisecond frames, and in High Speed (480 Mb/s) mode they are divided into 8 micro-frames. The maximum size of bulk packets (used by USB mass storage devices) is 512 bytes. According to [this very informative document](http://www.cypress.com/file/88486/download) the theoretical maximum is 13 packets per m... | On a Macbook Pro 15" Late 2011
It has 2.0 USB ports
I only get a max USB 2.0 speed of **40 MB/S** transferring a large 1 GB file from a macbook ssd to an external ssd via a USB 2.0 port.
Here is the setup with USB 2.0 being the bottleneck.
1. Within the Macbook's main HDD bay (not the CD bay) is an Internal SATA 3 S... |
317,217 | I'm getting only 30MB/sec between my computer and a USB drive, despite the fact that USB 2.0 supports 480Mb/sec (or 60MB/sec) transfers.
(Therefore, I'm only getting half the rated speed) Is there something present in the USB standard which should result in such half apparent speeds? | 2011/07/31 | [
"https://superuser.com/questions/317217",
"https://superuser.com",
"https://superuser.com/users/15329/"
] | USB 2.0 supports 480 Mb/s *signaling* speed. On the Wikipedia page, it says effective throughput is up to 35 MB/s. There is a disparity because bits aren't usually transmitted between devices in the same way that they are represented internally. A number of factors needs to be accounted for when transmitting data betwe... | USB 2 on Windows seems to top out at around 37 MB/s a second usually, even if the link speed of 480Mbps could support a bit more.
Different protocols are going to have different levels of overhead, and even different timings, and the latter can contribute to a full link speed not being utilised even if you are not oth... |
317,217 | I'm getting only 30MB/sec between my computer and a USB drive, despite the fact that USB 2.0 supports 480Mb/sec (or 60MB/sec) transfers.
(Therefore, I'm only getting half the rated speed) Is there something present in the USB standard which should result in such half apparent speeds? | 2011/07/31 | [
"https://superuser.com/questions/317217",
"https://superuser.com",
"https://superuser.com/users/15329/"
] | USB 2 uses 1 millisecond frames, and in High Speed (480 Mb/s) mode they are divided into 8 micro-frames. The maximum size of bulk packets (used by USB mass storage devices) is 512 bytes. According to [this very informative document](http://www.cypress.com/file/88486/download) the theoretical maximum is 13 packets per m... | Any chain is only as strong as its weakest link. The potentially weak transfer performance when using USB2 devices include everything from the host controller firmware, driver software, physical cables used (shorter and thicker may be slightly better?) and probably most importantly the actual connected devices themselv... |
317,217 | I'm getting only 30MB/sec between my computer and a USB drive, despite the fact that USB 2.0 supports 480Mb/sec (or 60MB/sec) transfers.
(Therefore, I'm only getting half the rated speed) Is there something present in the USB standard which should result in such half apparent speeds? | 2011/07/31 | [
"https://superuser.com/questions/317217",
"https://superuser.com",
"https://superuser.com/users/15329/"
] | Your flash drive is the bottleneck. They can't reach the 60 MB/s theoretical maximum. Here's an excerpt from [Wikipedia](http://en.wikipedia.org/wiki/USB_flash_drive):
>
> Modern flash drives have USB 2.0 connectivity. However, they do not
> currently use the full 480 Mbit/s (60MB/s) which the USB 2.0 Hi-Speed
> sp... | The USB 2.0 interface can be a limit due to signalling and command overhead as well as spacing between packets.
I have a fast SSD connected by USB 2.0. The drive is much faster than the interface (by more a factor of 10).
Read Speed maxes out around 33 MB/s and Write Speed at 17.5 MB/s. Write Speeds are almost 50% sl... |
317,217 | I'm getting only 30MB/sec between my computer and a USB drive, despite the fact that USB 2.0 supports 480Mb/sec (or 60MB/sec) transfers.
(Therefore, I'm only getting half the rated speed) Is there something present in the USB standard which should result in such half apparent speeds? | 2011/07/31 | [
"https://superuser.com/questions/317217",
"https://superuser.com",
"https://superuser.com/users/15329/"
] | Your flash drive is the bottleneck. They can't reach the 60 MB/s theoretical maximum. Here's an excerpt from [Wikipedia](http://en.wikipedia.org/wiki/USB_flash_drive):
>
> Modern flash drives have USB 2.0 connectivity. However, they do not
> currently use the full 480 Mbit/s (60MB/s) which the USB 2.0 Hi-Speed
> sp... | This post is a bit old, so not sure if this is still relevant or helpful, but USB 2 speeds normally max out at 280Mbps (35MBps) due to bus access.
Taken from the [USB Wikipedia page](https://en.wikipedia.org/w/index.php?title=USB&oldid=655774170):
>
> USB 2.0 was released in April 2000, adding a higher maximum signa... |
317,217 | I'm getting only 30MB/sec between my computer and a USB drive, despite the fact that USB 2.0 supports 480Mb/sec (or 60MB/sec) transfers.
(Therefore, I'm only getting half the rated speed) Is there something present in the USB standard which should result in such half apparent speeds? | 2011/07/31 | [
"https://superuser.com/questions/317217",
"https://superuser.com",
"https://superuser.com/users/15329/"
] | This post is a bit old, so not sure if this is still relevant or helpful, but USB 2 speeds normally max out at 280Mbps (35MBps) due to bus access.
Taken from the [USB Wikipedia page](https://en.wikipedia.org/w/index.php?title=USB&oldid=655774170):
>
> USB 2.0 was released in April 2000, adding a higher maximum signa... | The 5400 rpm hard disc drives with USB2 are limited by the drive hardware and the SATA controller. Even 7200 rpm or 10,000 rpm drives in a good USB caddy aren't really up to much. You need an SSD to reach the USB2 limit. Most of the "lost bandwidth" is actually controller latency, where it just takes time to turn aroun... |
317,217 | I'm getting only 30MB/sec between my computer and a USB drive, despite the fact that USB 2.0 supports 480Mb/sec (or 60MB/sec) transfers.
(Therefore, I'm only getting half the rated speed) Is there something present in the USB standard which should result in such half apparent speeds? | 2011/07/31 | [
"https://superuser.com/questions/317217",
"https://superuser.com",
"https://superuser.com/users/15329/"
] | Around 30 MB/sec is quite typical maximum transfer speed.
USB 1.0 and USB 2.0 connections are half-duplex, meaning data flows in only one direction at a time. Shared connection between both directions is probably biggest reason for slowdown than expected transfer speed.
In comparison, USB 3 and Ethernet are full dup... | With an iMac mid-2007 and one Verbatim USB2 disk transferring data to a FW800 drive I get 36-37 MB/s. It's already very good for USB2.
If I add a second transfer from another USB2 disk (Packard Bell) connected to the same USB2 hub to the same FW800 drive, the combined transfer rate increases to 42 MB/s. This is except... |
317,217 | I'm getting only 30MB/sec between my computer and a USB drive, despite the fact that USB 2.0 supports 480Mb/sec (or 60MB/sec) transfers.
(Therefore, I'm only getting half the rated speed) Is there something present in the USB standard which should result in such half apparent speeds? | 2011/07/31 | [
"https://superuser.com/questions/317217",
"https://superuser.com",
"https://superuser.com/users/15329/"
] | Your flash drive is the bottleneck. They can't reach the 60 MB/s theoretical maximum. Here's an excerpt from [Wikipedia](http://en.wikipedia.org/wiki/USB_flash_drive):
>
> Modern flash drives have USB 2.0 connectivity. However, they do not
> currently use the full 480 Mbit/s (60MB/s) which the USB 2.0 Hi-Speed
> sp... | On a Macbook Pro 15" Late 2011
It has 2.0 USB ports
I only get a max USB 2.0 speed of **40 MB/S** transferring a large 1 GB file from a macbook ssd to an external ssd via a USB 2.0 port.
Here is the setup with USB 2.0 being the bottleneck.
1. Within the Macbook's main HDD bay (not the CD bay) is an Internal SATA 3 S... |
32,313,791 | If I want to use Google analytics and at the same time make my site SEO friendly in React, what is the best way?
At the moment I use react-router and a flux pattern where I change the route and then in componentDidMount I fire an action that loads my data through ajax and then updates the store which emits the change ... | 2015/08/31 | [
"https://Stackoverflow.com/questions/32313791",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/438323/"
] | Why don't pass place entity to your function?
```
public function distance($place){
$longitude1 = $place->getLon();
$latitude1 = $place->getLat();
$longitude2 = $this->getLon();
$latitude2 = $this->getLat();
$theta = $longitude1 - $longitude2;
$miles = (sin(deg2rad($latitude1)) * sin(deg2rad($latitude2)... | you do not have any relations between place and user, you cant do that inside place entity. Assuming that user is the logged user. Your logic has to be in a service and inject TokenStorage to get the user logged:
```
namespace Acme\Bundle\AcmeBundle\Manager;
use Symfony\Component\Security\Core\Authentication\Token\St... |
32,313,791 | If I want to use Google analytics and at the same time make my site SEO friendly in React, what is the best way?
At the moment I use react-router and a flux pattern where I change the route and then in componentDidMount I fire an action that loads my data through ajax and then updates the store which emits the change ... | 2015/08/31 | [
"https://Stackoverflow.com/questions/32313791",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/438323/"
] | I got it!!
Managed to solve this problem using an event listener .
listener:
```
class SearchIndexer{
public function __construct(TokenStorageInterface $tokenStorage)
{
$this->tokenStorage = $tokenStorage;
}
public function postLoad (LifecycleEventArgs $args){
... | you do not have any relations between place and user, you cant do that inside place entity. Assuming that user is the logged user. Your logic has to be in a service and inject TokenStorage to get the user logged:
```
namespace Acme\Bundle\AcmeBundle\Manager;
use Symfony\Component\Security\Core\Authentication\Token\St... |
1,549,343 | From [Hatcher](https://www.math.cornell.edu/~hatcher/AT/AT.pdf), page 196, before corollary 3.3.
We are first given these three properties of the Ext functor:
$\text{Ext}(H \oplus H', G) \cong \text{Ext}(H, G)\oplus\text{Ext}(H′, G)$.
$\text{Ext}(H, G) = 0$ if $H$ is free.
$\text{Ext}(Z\_n, G) \cong G/nG.$
Then, H... | 2015/11/28 | [
"https://math.stackexchange.com/questions/1549343",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/224185/"
] | The third property (with $G=\mathbb{Z}$) tells you that if $C$ is a finite cyclic group, then $\operatorname{Ext}(C,\mathbb{Z})\cong C$. Furthermore, any finitely generated torsion abelian group is a direct sum of cyclic groups. So $T$ is a direct sum of cyclic groups, so by the first and third properties, $\operatorna... | To elaborate on my comment, applying $\text{Ext}^{\bullet}(A, -)$ to the short exact sequence $0 \to \mathbb{Z} \to \mathbb{R} \to S^1 \to 0$ produces the long exact sequence
$$0 \to \text{Hom}(A, \mathbb{Z}) \to \text{Hom}(A, \mathbb{R}) \to \text{Hom}(A, S^1) \to \text{Ext}^1(A, \mathbb{Z}) \to 0$$
where we can ign... |
27,210 | One standard model used with panel data is fixed effects: $y\_{it} = \mu\_i + \theta\_t + \epsilon\_{it}$, where $i$ is the individual and $t$ is time subscripts. This can be estimated easily with OLS and dummy variables.
The model assumes that there is a single underlying time series, $\theta\_t$ for $t = 1,2,...,T$.... | 2012/04/27 | [
"https://stats.stackexchange.com/questions/27210",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/7169/"
] | This type of model has been entertained by education researchers for years under the name of [growth mixture model](http://www.google.com/search?q=latent+growth+mixture+model) (do different students exhibit different rate of learning?), although they work with it as a random effects model. I don't think you'd be able t... | You are trying to fit a "mixture model", though I would suggest not having a separate set of $\pi\_{ij}$ parameters for every person, but rather model these probabilities as a function (i.e. logistic) of some covariates. You could even start with a constant $\pi\_j$. The typical approach for fitting mixture models is t... |
27,210 | One standard model used with panel data is fixed effects: $y\_{it} = \mu\_i + \theta\_t + \epsilon\_{it}$, where $i$ is the individual and $t$ is time subscripts. This can be estimated easily with OLS and dummy variables.
The model assumes that there is a single underlying time series, $\theta\_t$ for $t = 1,2,...,T$.... | 2012/04/27 | [
"https://stats.stackexchange.com/questions/27210",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/7169/"
] | You are trying to fit a "mixture model", though I would suggest not having a separate set of $\pi\_{ij}$ parameters for every person, but rather model these probabilities as a function (i.e. logistic) of some covariates. You could even start with a constant $\pi\_j$. The typical approach for fitting mixture models is t... | I suspect you actually mean $y\_{it}=μ\_i+∑\_j I\_{ij}θ\_{jt}+ϵ\_{it}$ where $I\_{ij}$ is an indicator for individual $i$ belonging to group $j$ (with probability $\pi\_{ij}$. I also wonder if you really want to allow for different individuals to have different group assignment probabilities? I suspect $\pi\_j$ will su... |
27,210 | One standard model used with panel data is fixed effects: $y\_{it} = \mu\_i + \theta\_t + \epsilon\_{it}$, where $i$ is the individual and $t$ is time subscripts. This can be estimated easily with OLS and dummy variables.
The model assumes that there is a single underlying time series, $\theta\_t$ for $t = 1,2,...,T$.... | 2012/04/27 | [
"https://stats.stackexchange.com/questions/27210",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/7169/"
] | This type of model has been entertained by education researchers for years under the name of [growth mixture model](http://www.google.com/search?q=latent+growth+mixture+model) (do different students exhibit different rate of learning?), although they work with it as a random effects model. I don't think you'd be able t... | I suspect you actually mean $y\_{it}=μ\_i+∑\_j I\_{ij}θ\_{jt}+ϵ\_{it}$ where $I\_{ij}$ is an indicator for individual $i$ belonging to group $j$ (with probability $\pi\_{ij}$. I also wonder if you really want to allow for different individuals to have different group assignment probabilities? I suspect $\pi\_j$ will su... |
193,288 | **Below is the CSV -**
[](https://i.stack.imgur.com/fRgjw.png)
**Below is the Error -**
SOURCE: 'Body' DESTINATION: 'Body' ERROR:Body: value not of required type: | 2017/09/24 | [
"https://salesforce.stackexchange.com/questions/193288",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/28578/"
] | The trick we had to understand is that sObjects are not implementing REST resource "collection" default behaviour, i.e.
```
GET /services/data/v40.0/tooling/sobjects/SandboxInfo/
```
will non return all the Sandbox Info. Therefore one has to use the QUERY endpoint:
```
GET /services/data/v40.0/tooling/query/?q=
Sel... | With an accesstoken/session id to the corresponding production org you can use the tooling api via REST to query the [SandboxInfo](https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_sandboxinfo.htm). |
50,518 | In this question, I have to write Taylor's series expansion of the function $f(x) = ln(x+n)$ about x = 0, where n ≠ 0 is a known constant.
I have done the following:

But my professor handed me back the answer as shown in **red** above.
Could somebo... | 2011/07/09 | [
"https://math.stackexchange.com/questions/50518",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/5373/"
] | The notation
$$
\left.\frac{d^rf}{dx^r}\right|\_{x=x\_0}
$$
means that you have to plug in the Taylor expansion the $n$-th derivative *evaluated at* $x=x\_0$ (in your case $x\_0=0$).
Thus
$$
\left.\frac{df}{dx}\right|\_{x=0}=\left.\frac1{x+n}\right|\_{x=0}=\frac1n
$$
and so on.
Mind that in the Taylor expansion $... | $\displaystyle \frac{1}{n+x} = \frac{1}{n}\left(\frac{1}{1+\frac{x}{n}}\right) = \frac{1}{n}\sum\_{k \ge 0}\frac{(-1)^kx^k}{n^k} = \sum\_{k \ge 0}\frac{(-1)^kx^k}{n^{k+1}}$, integrating both sides, we have $\displaystyle \ln(x+n) = \sum\_{k \ge 0}\frac{(-1)^kx^{k+1}}{n^{k+1}(k+1)}+\mathcal{C} $. If we put $x = 0$, we g... |
50,518 | In this question, I have to write Taylor's series expansion of the function $f(x) = ln(x+n)$ about x = 0, where n ≠ 0 is a known constant.
I have done the following:

But my professor handed me back the answer as shown in **red** above.
Could somebo... | 2011/07/09 | [
"https://math.stackexchange.com/questions/50518",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/5373/"
] | You did not **evaluate** the derivatives at $x=0$!
**Added**:
Another approach to the problem would be as follows. Clearly $n>0$, else we have trouble at $0$.
Since $x+n=n(1+x/n)$, we have
$$\ln(x+n)=\ln n + \ln\left(1+\frac{x}{n}\right).$$
Now you can just quote the power series for $\ln(1+y)$, which has undoubted... | $\displaystyle \frac{1}{n+x} = \frac{1}{n}\left(\frac{1}{1+\frac{x}{n}}\right) = \frac{1}{n}\sum\_{k \ge 0}\frac{(-1)^kx^k}{n^k} = \sum\_{k \ge 0}\frac{(-1)^kx^k}{n^{k+1}}$, integrating both sides, we have $\displaystyle \ln(x+n) = \sum\_{k \ge 0}\frac{(-1)^kx^{k+1}}{n^{k+1}(k+1)}+\mathcal{C} $. If we put $x = 0$, we g... |
50,518 | In this question, I have to write Taylor's series expansion of the function $f(x) = ln(x+n)$ about x = 0, where n ≠ 0 is a known constant.
I have done the following:

But my professor handed me back the answer as shown in **red** above.
Could somebo... | 2011/07/09 | [
"https://math.stackexchange.com/questions/50518",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/5373/"
] | This all comes down to $$\left.\frac{df}{dx}\right|\_{x=x\_0}$$. You need to actually plug in the value of $x\_0$ for $x$ at those points. So when your teacher writes
$x/n - x/2n^2 + ...$ it's because she has already substituted 0 in for $\dfrac{x}{x\_0 + n} - \dfrac{x}{2(n + x\_0)^2} + ...$ | $\displaystyle \frac{1}{n+x} = \frac{1}{n}\left(\frac{1}{1+\frac{x}{n}}\right) = \frac{1}{n}\sum\_{k \ge 0}\frac{(-1)^kx^k}{n^k} = \sum\_{k \ge 0}\frac{(-1)^kx^k}{n^{k+1}}$, integrating both sides, we have $\displaystyle \ln(x+n) = \sum\_{k \ge 0}\frac{(-1)^kx^{k+1}}{n^{k+1}(k+1)}+\mathcal{C} $. If we put $x = 0$, we g... |
2,176,882 | I would like an UpdatPanel to update it's content once a button is clicked - this button is contained within a UserControl placed on the webpage.
However, I cannot just simply reference it using the AsyncPostBackTrigger's ControlID property, because the button is not situated directly on the webpage.
Is there any way... | 2010/02/01 | [
"https://Stackoverflow.com/questions/2176882",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/217834/"
] | Use [RegisterAsyncPostbackControl](http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.registerasyncpostbackcontrol.aspx), e.g. if you have a user control `UserControl1` containing `Button1` and your script manager is called `ScriptManager1`:
```
ScriptManager1.RegisterAsyncPostbackControl(UserControl1... | Does the user control expose the button as a child control? If not can it? If not then you can use `FindControl` on the user control to find the inner button. |
506,079 | Is the feedback in this circuit positive or negative? How can I know?
[](https://i.stack.imgur.com/BCC18.png) | 2020/06/17 | [
"https://electronics.stackexchange.com/questions/506079",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/251553/"
] | I simply go, and look at the circuit intensely (yes, that is a very important engineering technique) and then ask myself:
When I "magically" increase the output of the amplifier, does the positive input increase, or the negative decrease? Then, it's positive feedback.
If the positive input decreases when you increase... | To determine if feedback is positive "or" negative, I follow the loop and I check what the impact is of an increase on a certain point. That can be the "-" or "+" input terminal of the OPAMP or the output of the opamp. If you start in a good location, you end up doing the entire loop.
There are three feedback loops:
... |
506,079 | Is the feedback in this circuit positive or negative? How can I know?
[](https://i.stack.imgur.com/BCC18.png) | 2020/06/17 | [
"https://electronics.stackexchange.com/questions/506079",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/251553/"
] | I simply go, and look at the circuit intensely (yes, that is a very important engineering technique) and then ask myself:
When I "magically" increase the output of the amplifier, does the positive input increase, or the negative decrease? Then, it's positive feedback.
If the positive input decreases when you increase... | The circuit looks like an inverting hysteresis comparator with clamping circuits for overvoltage protection. Still, your question is foggy: feedback in an **opamp-as-inverting-hysteresis-comparator** configuration is **positive** by definition, but you failed to specify the network branch you are discussing. |
506,079 | Is the feedback in this circuit positive or negative? How can I know?
[](https://i.stack.imgur.com/BCC18.png) | 2020/06/17 | [
"https://electronics.stackexchange.com/questions/506079",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/251553/"
] | I simply go, and look at the circuit intensely (yes, that is a very important engineering technique) and then ask myself:
When I "magically" increase the output of the amplifier, does the positive input increase, or the negative decrease? Then, it's positive feedback.
If the positive input decreases when you increase... | [](https://i.stack.imgur.com/CUQ07.png)
I made some assumptions as it comes to the supply of the op-amp, the type of op-amp (picked the Universal one) and came with this simulation.
Depending on if you have rail-to-rail supply for your op-amp (+xV to -xV... |
506,079 | Is the feedback in this circuit positive or negative? How can I know?
[](https://i.stack.imgur.com/BCC18.png) | 2020/06/17 | [
"https://electronics.stackexchange.com/questions/506079",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/251553/"
] | To determine if feedback is positive "or" negative, I follow the loop and I check what the impact is of an increase on a certain point. That can be the "-" or "+" input terminal of the OPAMP or the output of the opamp. If you start in a good location, you end up doing the entire loop.
There are three feedback loops:
... | The circuit looks like an inverting hysteresis comparator with clamping circuits for overvoltage protection. Still, your question is foggy: feedback in an **opamp-as-inverting-hysteresis-comparator** configuration is **positive** by definition, but you failed to specify the network branch you are discussing. |
506,079 | Is the feedback in this circuit positive or negative? How can I know?
[](https://i.stack.imgur.com/BCC18.png) | 2020/06/17 | [
"https://electronics.stackexchange.com/questions/506079",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/251553/"
] | To determine if feedback is positive "or" negative, I follow the loop and I check what the impact is of an increase on a certain point. That can be the "-" or "+" input terminal of the OPAMP or the output of the opamp. If you start in a good location, you end up doing the entire loop.
There are three feedback loops:
... | [](https://i.stack.imgur.com/CUQ07.png)
I made some assumptions as it comes to the supply of the op-amp, the type of op-amp (picked the Universal one) and came with this simulation.
Depending on if you have rail-to-rail supply for your op-amp (+xV to -xV... |
65,256,233 | I am trying to understand and work through some examples on KSQL . I have confluent community edition(6.0.0) installed in my local machine.
I have below table in KSQL
```
sql> DESCRIBE TUMB;
Name : TUMB
Field | Type
-------------------------------------------
EMAIL ... | 2020/12/11 | [
"https://Stackoverflow.com/questions/65256233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14809347/"
] | >
> Can that cause a memory leak?
>
>
>
In your particular example, no. The `x` object is merely being *allocated* by `malloc()`. `free()` will correctly *deallocate* the memory that `malloc()` allocated. But the object will not be *destructed*, which is fine in this example because it was not *constructed* to beg... | >
> Can free() cause a memory leak?
>
>
>
Not as such. But it can cause undefined behaviour. Of course, if the behaviour of the program is undefined, memory leak is among possible behaviour. As are all other behaviours. |
20,874,374 | I have a model that has a `PersonId int`, and also, a `List<SelectListItems> People` for people. The UI allows me to select a person from the drop down model, and save the value into PersonId.
That works, but if there is an error in my ModelState, caused by another field, I do this:
```
if (ModelState.IsValid == ... | 2014/01/01 | [
"https://Stackoverflow.com/questions/20874374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/560660/"
] | use this code :
```
$text = trim($_POST['textareaname']);
$textAr = explode("\n", $text); // remove the last \n or whitespace character
$textAr = array_filter($textAr, 'trim'); // remove any extra \r characters left behind
foreach ($textAr as $line) {
// processing here.
}
```
for more ... | Please try this code:
```
$string = trim($_POST['proxies']);
$stringArray = explode("\n" , $string);
$stringArray = array_filter($stringArray,'trim');
foreach($stringArray as $ $string){
$arrray = explode(':',$string);
$proxy = $arrray[0] . ':' . $arrray[1];
$country = $arrray[2];
$state = $arrray[3];
$city = $arrra... |
20,874,374 | I have a model that has a `PersonId int`, and also, a `List<SelectListItems> People` for people. The UI allows me to select a person from the drop down model, and save the value into PersonId.
That works, but if there is an error in my ModelState, caused by another field, I do this:
```
if (ModelState.IsValid == ... | 2014/01/01 | [
"https://Stackoverflow.com/questions/20874374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/560660/"
] | use this code :
```
$text = trim($_POST['textareaname']);
$textAr = explode("\n", $text); // remove the last \n or whitespace character
$textAr = array_filter($textAr, 'trim'); // remove any extra \r characters left behind
foreach ($textAr as $line) {
// processing here.
}
```
for more ... | I would recommend you to append
```
PHP_EOL
```
PHP\_EOL - is a End of line constant in PHP, Append that at the end of string instead of '\n'
I hope it will solve the problem, |
116,115 | I have built a custom post type called article and the information given on the admin summary screen is sparse. I was able to add the featured image post thumbnail image using the <http://codex.wordpress.org/Plugin_API/Action_Reference/manage_posts_custom_column> from a tutorial.
However I would like to be able to ge... | 2013/09/29 | [
"https://wordpress.stackexchange.com/questions/116115",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/23507/"
] | The [register\_taxonomy](https://developer.wordpress.org/reference/functions/register_taxonomy/) function has a parameter called `show_admin_column` that will handle adding a column. Have you tried that?
eg:
```php
register_taxonomy(
'my_tax,
'post_type',
array(
'label' => 'My Taxono... | After some searching, I have found a solution using the `manage_edit-${post_type}_columns` filter and the `manage_${post_type}_posts_custom_column` action.
The columns are created with the filter and then the column is populated with the action. I assume additional columns could be added and populated quite easily us... |
116,115 | I have built a custom post type called article and the information given on the admin summary screen is sparse. I was able to add the featured image post thumbnail image using the <http://codex.wordpress.org/Plugin_API/Action_Reference/manage_posts_custom_column> from a tutorial.
However I would like to be able to ge... | 2013/09/29 | [
"https://wordpress.stackexchange.com/questions/116115",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/23507/"
] | After some searching, I have found a solution using the `manage_edit-${post_type}_columns` filter and the `manage_${post_type}_posts_custom_column` action.
The columns are created with the filter and then the column is populated with the action. I assume additional columns could be added and populated quite easily us... | Nearly the same question:
i want a extra column "categorie" in the admin screen.
"categorie" is a taxonomy made with Divi Machine. The slug is art\_category
In my child theme functions.php i managed to make ACF fields visible, even sortable but those are ACF fields.
The column Categorie is visible. However there are no... |
116,115 | I have built a custom post type called article and the information given on the admin summary screen is sparse. I was able to add the featured image post thumbnail image using the <http://codex.wordpress.org/Plugin_API/Action_Reference/manage_posts_custom_column> from a tutorial.
However I would like to be able to ge... | 2013/09/29 | [
"https://wordpress.stackexchange.com/questions/116115",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/23507/"
] | The [register\_taxonomy](https://developer.wordpress.org/reference/functions/register_taxonomy/) function has a parameter called `show_admin_column` that will handle adding a column. Have you tried that?
eg:
```php
register_taxonomy(
'my_tax,
'post_type',
array(
'label' => 'My Taxono... | Nearly the same question:
i want a extra column "categorie" in the admin screen.
"categorie" is a taxonomy made with Divi Machine. The slug is art\_category
In my child theme functions.php i managed to make ACF fields visible, even sortable but those are ACF fields.
The column Categorie is visible. However there are no... |
8,387,309 | How to round in java towards zero?
So -1.9 becomes -1.0 and -0.2 becomes 0.0, 3.4 becomes 3.0 and so on.
Is `Math.round()` capable of doing this changing some parameters? | 2011/12/05 | [
"https://Stackoverflow.com/questions/8387309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/647177/"
] | I do not believe that the standard library has such a function.
The problem is that you are asking for very different behavior (mathematically speaking) depending on whether the number is larger or smaller than 0 (i.e. rounding up for negative values, rounding down for positive values)
The following method could be ... | Seems like you want to always round-down? You can use `Math.floor` instead
>
> `public static double floor(double a)`
>
>
> Returns the largest (closest to positive infinity) double value that
> is not greater than the argument and is equal to a mathematical
> integer. Special cases:
>
>
> |
8,387,309 | How to round in java towards zero?
So -1.9 becomes -1.0 and -0.2 becomes 0.0, 3.4 becomes 3.0 and so on.
Is `Math.round()` capable of doing this changing some parameters? | 2011/12/05 | [
"https://Stackoverflow.com/questions/8387309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/647177/"
] | Use `RoundingMode.DOWN`, it leads towards zero.
Example :
```
BigDecimal value = new BigDecimal("1.4");
value = value.setScale(0, RoundingMode.DOWN);
System.out.println(value.doubleValue());
BigDecimal value1 = new BigDecimal("-1.4");
value1 = value1.setScale(0, RoundingMode.DOWN);
System.out.... | ```
y=sign(x)*floor(abs(x))
```
or
```
y=sign(x)*round(abs(x)-0.5)
```
It should be easy to implement in Java. |
8,387,309 | How to round in java towards zero?
So -1.9 becomes -1.0 and -0.2 becomes 0.0, 3.4 becomes 3.0 and so on.
Is `Math.round()` capable of doing this changing some parameters? | 2011/12/05 | [
"https://Stackoverflow.com/questions/8387309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/647177/"
] | Just casting to int will do that for you?
Edit: If you want to retain a double this should work simply enough:
```
if (val < 0)
return -Math.floor(-val);
else
return Math.floor(val);
```
And just for the people who want branch free code and feel a bit more clever:
```
long tmp = Double.doubleToLongBits(val)... | You also can try this:
```
public static void main(String[] args) {
Double myDouble = -3.2;
System.out.println(myDouble.intValue()); //Prints -3
}
``` |
8,387,309 | How to round in java towards zero?
So -1.9 becomes -1.0 and -0.2 becomes 0.0, 3.4 becomes 3.0 and so on.
Is `Math.round()` capable of doing this changing some parameters? | 2011/12/05 | [
"https://Stackoverflow.com/questions/8387309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/647177/"
] | Use `RoundingMode.DOWN`, it leads towards zero.
Example :
```
BigDecimal value = new BigDecimal("1.4");
value = value.setScale(0, RoundingMode.DOWN);
System.out.println(value.doubleValue());
BigDecimal value1 = new BigDecimal("-1.4");
value1 = value1.setScale(0, RoundingMode.DOWN);
System.out.... | You also can try this:
```
public static void main(String[] args) {
Double myDouble = -3.2;
System.out.println(myDouble.intValue()); //Prints -3
}
``` |
8,387,309 | How to round in java towards zero?
So -1.9 becomes -1.0 and -0.2 becomes 0.0, 3.4 becomes 3.0 and so on.
Is `Math.round()` capable of doing this changing some parameters? | 2011/12/05 | [
"https://Stackoverflow.com/questions/8387309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/647177/"
] | Use `RoundingMode.DOWN`, it leads towards zero.
Example :
```
BigDecimal value = new BigDecimal("1.4");
value = value.setScale(0, RoundingMode.DOWN);
System.out.println(value.doubleValue());
BigDecimal value1 = new BigDecimal("-1.4");
value1 = value1.setScale(0, RoundingMode.DOWN);
System.out.... | Seems like you want to always round-down? You can use `Math.floor` instead
>
> `public static double floor(double a)`
>
>
> Returns the largest (closest to positive infinity) double value that
> is not greater than the argument and is equal to a mathematical
> integer. Special cases:
>
>
> |
8,387,309 | How to round in java towards zero?
So -1.9 becomes -1.0 and -0.2 becomes 0.0, 3.4 becomes 3.0 and so on.
Is `Math.round()` capable of doing this changing some parameters? | 2011/12/05 | [
"https://Stackoverflow.com/questions/8387309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/647177/"
] | ```
y=sign(x)*floor(abs(x))
```
or
```
y=sign(x)*round(abs(x)-0.5)
```
It should be easy to implement in Java. | `BigDecimal` offers many [rounding options](http://docs.oracle.com/javase/1.5.0/docs/api/java/math/RoundingMode.html). |
8,387,309 | How to round in java towards zero?
So -1.9 becomes -1.0 and -0.2 becomes 0.0, 3.4 becomes 3.0 and so on.
Is `Math.round()` capable of doing this changing some parameters? | 2011/12/05 | [
"https://Stackoverflow.com/questions/8387309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/647177/"
] | I do not believe that the standard library has such a function.
The problem is that you are asking for very different behavior (mathematically speaking) depending on whether the number is larger or smaller than 0 (i.e. rounding up for negative values, rounding down for positive values)
The following method could be ... | You also can try this:
```
public static void main(String[] args) {
Double myDouble = -3.2;
System.out.println(myDouble.intValue()); //Prints -3
}
``` |
8,387,309 | How to round in java towards zero?
So -1.9 becomes -1.0 and -0.2 becomes 0.0, 3.4 becomes 3.0 and so on.
Is `Math.round()` capable of doing this changing some parameters? | 2011/12/05 | [
"https://Stackoverflow.com/questions/8387309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/647177/"
] | cast to long like this:
```
float x= 1.9;
long y = (long)x;
```
This rounds both positive and negative numbers towards zero. | ```
y=sign(x)*floor(abs(x))
```
or
```
y=sign(x)*round(abs(x)-0.5)
```
It should be easy to implement in Java. |
8,387,309 | How to round in java towards zero?
So -1.9 becomes -1.0 and -0.2 becomes 0.0, 3.4 becomes 3.0 and so on.
Is `Math.round()` capable of doing this changing some parameters? | 2011/12/05 | [
"https://Stackoverflow.com/questions/8387309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/647177/"
] | I do not believe that the standard library has such a function.
The problem is that you are asking for very different behavior (mathematically speaking) depending on whether the number is larger or smaller than 0 (i.e. rounding up for negative values, rounding down for positive values)
The following method could be ... | ```
y=sign(x)*floor(abs(x))
```
or
```
y=sign(x)*round(abs(x)-0.5)
```
It should be easy to implement in Java. |
8,387,309 | How to round in java towards zero?
So -1.9 becomes -1.0 and -0.2 becomes 0.0, 3.4 becomes 3.0 and so on.
Is `Math.round()` capable of doing this changing some parameters? | 2011/12/05 | [
"https://Stackoverflow.com/questions/8387309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/647177/"
] | ```
y=sign(x)*floor(abs(x))
```
or
```
y=sign(x)*round(abs(x)-0.5)
```
It should be easy to implement in Java. | You also can try this:
```
public static void main(String[] args) {
Double myDouble = -3.2;
System.out.println(myDouble.intValue()); //Prints -3
}
``` |
63,347,312 | Please see the image below for my SAS Server Layout. I would like to pull the top table `2020_01_SETTLEMENTS` and place it into a Python data frame. I have successfully established connection between Python and the SAS Server. I have the following code below but I believe where I am going wrong is in the `LIBREF` part ... | 2020/08/10 | [
"https://Stackoverflow.com/questions/63347312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12963030/"
] | >
> Also is it possible to remove duplicates while we are performing the sort check, in this case I am fine if we stop removing duplicates as soon as templates detect that sequence is not sorted.
>
>
>
Yes, it's possible.
Maybe can be done a little simpler, but... using and abusing template specialization...
Giv... | Let's do this with [Boost.Mp11](https://www.boost.org/doc/libs/develop/libs/mp11/doc/html/mp11.html). There, the "integer sequence" concept is a little different, we deal with lists of types. `mp_list_c<int, 1, 2>` is the type `mp_list<mp_int<1>, mp_int<2>>`. This makes a lot of metaprogramming much easier. Everything ... |
63,347,312 | Please see the image below for my SAS Server Layout. I would like to pull the top table `2020_01_SETTLEMENTS` and place it into a Python data frame. I have successfully established connection between Python and the SAS Server. I have the following code below but I believe where I am going wrong is in the `LIBREF` part ... | 2020/08/10 | [
"https://Stackoverflow.com/questions/63347312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12963030/"
] | Since all std algorithm are now `constexpr` in C++20, we can use it to do *compile-time programming* in the nature way (just like [@cigien](https://stackoverflow.com/users/8372853/cigien) say):
```
template <typename T, T... Ints>
constexpr auto unique_until_nonsorted(std::integer_sequence<T, Ints...>) {
// constexp... | Let's do this with [Boost.Mp11](https://www.boost.org/doc/libs/develop/libs/mp11/doc/html/mp11.html). There, the "integer sequence" concept is a little different, we deal with lists of types. `mp_list_c<int, 1, 2>` is the type `mp_list<mp_int<1>, mp_int<2>>`. This makes a lot of metaprogramming much easier. Everything ... |
63,347,312 | Please see the image below for my SAS Server Layout. I would like to pull the top table `2020_01_SETTLEMENTS` and place it into a Python data frame. I have successfully established connection between Python and the SAS Server. I have the following code below but I believe where I am going wrong is in the `LIBREF` part ... | 2020/08/10 | [
"https://Stackoverflow.com/questions/63347312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12963030/"
] | >
> Also is it possible to remove duplicates while we are performing the sort check, in this case I am fine if we stop removing duplicates as soon as templates detect that sequence is not sorted.
>
>
>
Yes, it's possible.
Maybe can be done a little simpler, but... using and abusing template specialization...
Giv... | Since all std algorithm are now `constexpr` in C++20, we can use it to do *compile-time programming* in the nature way (just like [@cigien](https://stackoverflow.com/users/8372853/cigien) say):
```
template <typename T, T... Ints>
constexpr auto unique_until_nonsorted(std::integer_sequence<T, Ints...>) {
// constexp... |
15,263,922 | Language: C
PIC: 16F84A
**Programm:CCS PCW**
When I compile the following code, my compiler complains that the FOR is always true(Maybe the int i doesnt support negative values?):
```
#include <16F84A.h>
#FUSES XT
#use delay(clock=4M)
byte const display[10] = {63,6,91,79,102,109,124,7,127,103};
void main()
{
set_... | 2013/03/07 | [
"https://Stackoverflow.com/questions/15263922",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1930474/"
] | use
```
signed int i;
```
instead of
```
int i;
```
integers are unsigned by default in CCS compilers.
<http://www.ccsinfo.com/downloads/ccs_c_manual.pdf>
Check page 38
>
> "All types, except float, by default are unsigned; however, [they] may be preceded by unsigned or signed.
>
>
> | Your compiler is either broken or it is some non-standard crap where `int` is unsigned by default.
I would advice to use a real, conforming C compiler instead. |
15,263,922 | Language: C
PIC: 16F84A
**Programm:CCS PCW**
When I compile the following code, my compiler complains that the FOR is always true(Maybe the int i doesnt support negative values?):
```
#include <16F84A.h>
#FUSES XT
#use delay(clock=4M)
byte const display[10] = {63,6,91,79,102,109,124,7,127,103};
void main()
{
set_... | 2013/03/07 | [
"https://Stackoverflow.com/questions/15263922",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1930474/"
] | use
```
signed int i;
```
instead of
```
int i;
```
integers are unsigned by default in CCS compilers.
<http://www.ccsinfo.com/downloads/ccs_c_manual.pdf>
Check page 38
>
> "All types, except float, by default are unsigned; however, [they] may be preceded by unsigned or signed.
>
>
> | Check the assembly code generated by the compiler, and you will know for sure. Or post it here, so that we do not have to own / install the specific compiler. Good think with assembly (specially on dead simple micros like PIC16) is that it can never hide what it actually does :-)
I agree with some comments here about ... |
15,263,922 | Language: C
PIC: 16F84A
**Programm:CCS PCW**
When I compile the following code, my compiler complains that the FOR is always true(Maybe the int i doesnt support negative values?):
```
#include <16F84A.h>
#FUSES XT
#use delay(clock=4M)
byte const display[10] = {63,6,91,79,102,109,124,7,127,103};
void main()
{
set_... | 2013/03/07 | [
"https://Stackoverflow.com/questions/15263922",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1930474/"
] | Your compiler is either broken or it is some non-standard crap where `int` is unsigned by default.
I would advice to use a real, conforming C compiler instead. | Check the assembly code generated by the compiler, and you will know for sure. Or post it here, so that we do not have to own / install the specific compiler. Good think with assembly (specially on dead simple micros like PIC16) is that it can never hide what it actually does :-)
I agree with some comments here about ... |
71,002,015 | I am a student trying to learn app development with android studio. For my first project, im just building a basic calculator app. I have stumbled across a problem that I couldnt solve and didnt find a helpfull post about. It occurs when I trun on dark mode on the virtual device. Here are 2 pictures showing what happen... | 2022/02/05 | [
"https://Stackoverflow.com/questions/71002015",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18129805/"
] | You are most likely using the following default DayNight theme in your `themes.xml` file (values/themes/themes.xml)
```
<style name="Theme.MyApp" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
```
If you don't want things to change in night mode, you can change that to use the Light theme instead
```
<st... | there are two themes : night and not night check in IDE Design tab you can view how it looks in both click the circle in pane where design is displaying it displays Not Night and Night whatever theme you are using it will affect because of these two modes, by default IDE shows not night
To show screen same in both mod... |
60,014,776 | The Swift Network Framework includes the Structs `IPv4Address` and `IPv6Address`. They are used with `NWEndpoints` for network connections. The `IPv6Address` Struct also useful for validating `IPv6` address syntax and implementing shortening rules.
How can I make `IPv4Address` and `IPv6Address` conform to Codable? | 2020/02/01 | [
"https://Stackoverflow.com/questions/60014776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9722622/"
] | In [Alamofire issue tracker](https://github.com/Alamofire/Alamofire/issues/3051) peoples are suggesting that doing these steps:
* remove/comment `use_frameworks!` in Podfile
* add `use_modular_headers!` in Podfile
* pod update
* pod install
* clean and run
solves the issue with using free Apple ID on iOS 13.3.X | This appears to be a known issue, and most people say it is a problem with using a non-paid Apple ID. Some kind of provisioning thing.
<https://github.com/Alamofire/Alamofire/issues/3051> |
60,014,776 | The Swift Network Framework includes the Structs `IPv4Address` and `IPv6Address`. They are used with `NWEndpoints` for network connections. The `IPv6Address` Struct also useful for validating `IPv6` address syntax and implementing shortening rules.
How can I make `IPv4Address` and `IPv6Address` conform to Codable? | 2020/02/01 | [
"https://Stackoverflow.com/questions/60014776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9722622/"
] | In [Alamofire issue tracker](https://github.com/Alamofire/Alamofire/issues/3051) peoples are suggesting that doing these steps:
* remove/comment `use_frameworks!` in Podfile
* add `use_modular_headers!` in Podfile
* pod update
* pod install
* clean and run
solves the issue with using free Apple ID on iOS 13.3.X | >
> Apple blocked utilizing external frameworks on free accounts with 13.3.1 upgrade. Try downgrading to 13.3.
>
>
>
Reference and solution here: [Library not loaded: @rpath/FBLPromises.framework/FBLPromises iOS 13.3.1](https://stackoverflow.com/questions/60096258/library-not-loaded-rpath-fblpromises-framework-fbl... |
66,561,459 | In my application I have a list of different "questions" each question refers to one of two components controlled by a variable `QuestionIndex` that basically takes the current object in the list.
So I have `Component A`, which has a form inside of it with two Radio buttons:
```
<form [formGroup]="form">
<label>
... | 2021/03/10 | [
"https://Stackoverflow.com/questions/66561459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1647457/"
] | Because `interaction.member` doesn't contain any voice information, i defined the voice channel as follows:
```js
const guild = client.guilds.cache.get(interaction.guild_id)
const member = guild.members.cache.get(interaction.member.user.id);
const voiceChannel = member.voice.channel;
``` | You can use [`Interaction#member`](https://github.com/devsnek/discord.js/blob/interactions/src/structures/Interaction.js#L61) which will return the member who sent the interaction if it was sent in a guild, or `null` if it was not sent in a guild. |
66,561,459 | In my application I have a list of different "questions" each question refers to one of two components controlled by a variable `QuestionIndex` that basically takes the current object in the list.
So I have `Component A`, which has a form inside of it with two Radio buttons:
```
<form [formGroup]="form">
<label>
... | 2021/03/10 | [
"https://Stackoverflow.com/questions/66561459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1647457/"
] | >
>
> ```
> const guild = client.guilds.cache.get(interaction.guild_id)
> const member = guild.member(interaction.member.user.id)
> const vchannel = member.voice.channel
> vchannel.join()
>
> ```
>
>
This is what worked for me. | You can use [`Interaction#member`](https://github.com/devsnek/discord.js/blob/interactions/src/structures/Interaction.js#L61) which will return the member who sent the interaction if it was sent in a guild, or `null` if it was not sent in a guild. |
66,561,459 | In my application I have a list of different "questions" each question refers to one of two components controlled by a variable `QuestionIndex` that basically takes the current object in the list.
So I have `Component A`, which has a form inside of it with two Radio buttons:
```
<form [formGroup]="form">
<label>
... | 2021/03/10 | [
"https://Stackoverflow.com/questions/66561459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1647457/"
] | Because `interaction.member` doesn't contain any voice information, i defined the voice channel as follows:
```js
const guild = client.guilds.cache.get(interaction.guild_id)
const member = guild.members.cache.get(interaction.member.user.id);
const voiceChannel = member.voice.channel;
``` | >
>
> ```
> const guild = client.guilds.cache.get(interaction.guild_id)
> const member = guild.member(interaction.member.user.id)
> const vchannel = member.voice.channel
> vchannel.join()
>
> ```
>
>
This is what worked for me. |
66,561,459 | In my application I have a list of different "questions" each question refers to one of two components controlled by a variable `QuestionIndex` that basically takes the current object in the list.
So I have `Component A`, which has a form inside of it with two Radio buttons:
```
<form [formGroup]="form">
<label>
... | 2021/03/10 | [
"https://Stackoverflow.com/questions/66561459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1647457/"
] | Because `interaction.member` doesn't contain any voice information, i defined the voice channel as follows:
```js
const guild = client.guilds.cache.get(interaction.guild_id)
const member = guild.members.cache.get(interaction.member.user.id);
const voiceChannel = member.voice.channel;
``` | ```
const voice_channel_id = interaction.guild.members.cache.get(interaction.member.user.id).voice.channelId
``` |
66,561,459 | In my application I have a list of different "questions" each question refers to one of two components controlled by a variable `QuestionIndex` that basically takes the current object in the list.
So I have `Component A`, which has a form inside of it with two Radio buttons:
```
<form [formGroup]="form">
<label>
... | 2021/03/10 | [
"https://Stackoverflow.com/questions/66561459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1647457/"
] | >
>
> ```
> const guild = client.guilds.cache.get(interaction.guild_id)
> const member = guild.member(interaction.member.user.id)
> const vchannel = member.voice.channel
> vchannel.join()
>
> ```
>
>
This is what worked for me. | ```
const voice_channel_id = interaction.guild.members.cache.get(interaction.member.user.id).voice.channelId
``` |
647,289 | I have a file storage server which stores files on disk using the file's sha256 hash as the filename, along with the file extension, and in three levels of directories, e.g. a PDF file with sha256 hash `AABB1F1C6FC86DB2DCA6FB0167DE8CF7288798271EA24B68D857CBC5CF8DC66A` would be stored in a subdirectory like this:
`<roo... | 2014/11/26 | [
"https://serverfault.com/questions/647289",
"https://serverfault.com",
"https://serverfault.com/users/121362/"
] | It's unrecommended for most cases, but given that your goal is to reduce the difference calculation bandwidth, it's appropriate. Consider the following script flow:
1. touch a file to be your "high bar", this needs to be systematically named and not overwrite your last "high bar", which is now your "low bar". The scri... | For each run `rsync` needs to establish a complete listing of both the local and remote directory structure and compute the differences, before it has determined which files are newly created and sending those new files over. That is what is "expensive".
You haven't mentioned what the OS of the file-server is, but on... |
647,289 | I have a file storage server which stores files on disk using the file's sha256 hash as the filename, along with the file extension, and in three levels of directories, e.g. a PDF file with sha256 hash `AABB1F1C6FC86DB2DCA6FB0167DE8CF7288798271EA24B68D857CBC5CF8DC66A` would be stored in a subdirectory like this:
`<roo... | 2014/11/26 | [
"https://serverfault.com/questions/647289",
"https://serverfault.com",
"https://serverfault.com/users/121362/"
] | It's unrecommended for most cases, but given that your goal is to reduce the difference calculation bandwidth, it's appropriate. Consider the following script flow:
1. touch a file to be your "high bar", this needs to be systematically named and not overwrite your last "high bar", which is now your "low bar". The scri... | You could run rsync with -e "ssh -C" thereby compressing the ssh tunnel instead of only the data as it does when running with -z. Or connecting thought a vpn which compresses the traffic (openvpn can do this). |
22,414,464 | I have a script that i run from command to populate a django model from csv..
the command i use is:
```
python artifact_db_loader.py -tzusb "d:\Test_Data\david nides\david-nides-usb.csv" -e 44
```
How can i change this to run on a django view?
Anyone with an insight please?
Regards,
Josh | 2014/03/14 | [
"https://Stackoverflow.com/questions/22414464",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3262370/"
] | As `$arr1` is array reference, you might try
```
$#$arr1 = $nLen; # or $#{ $arr1 }
```
and
```
$#$arr2 = $nLen;
``` | `arr1` is a scalar value, not an array; `$#arr` expects `@arr` to be defined. Assuming that `$arr1` does in fact contain a reference to an array, you can use
```
$#$arr1 = $nLen;
``` |
884,172 | I'm using Microsoft's Wireless Keyboard+Mouse (Mouse 1000 + Keyboard 800) for my wife's laptop. Now she bought a Microsoft Wireless Mobile Mouse 1000.
How can I pair the new mouse with the current receiver (so we can keep using the current keyboard but with the new mouse)? | 2015/03/01 | [
"https://superuser.com/questions/884172",
"https://superuser.com",
"https://superuser.com/users/277312/"
] | Keyboard 800.. You cannot. The set is frequency matched at factory.
There are no replacements, nor adjustments or matching procedures. | Receiver and mouse usually both have a "pair" button on them. Press the one on the receiver first, then the one on the mouse. |
6,428,588 | How do you convert this Prototype Ajax call to a jQuery implementation that functions the same way?
JS:
```
<script style="text/javascript">
function checkit() {
var request = new Ajax.Request('/checkit',
{
asynchronous:true,
evalScripts:true,
parameters: $('... | 2011/06/21 | [
"https://Stackoverflow.com/questions/6428588",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/808830/"
] | How about this?
```
public interface IComparison<EXPECTED_PARAM, RETURNED_PARAM>
{
Result Compare(RETURNED_PARAM returned);
}
public class GreaterThan<EXPECTED_PARAM, RETURNED_PARAM> : IComparison<EXPECTED_PARAM, RETURNED_PARAM> where RETURNED_PARAM : IComparable<EXPECTED_PARAM>
{
private EXPECTED_PARAM e... | Your inheritance hierarchy is the problem. `GreaterThan` inherits from `IComparison<EXPECTED_PARAM>`, which means you're telling the compiler that it implements `Compare<EXPECTED_PARAM>`, but you want it to implement `Compare<RETURNED_PARAM>` instead. You could drop the generic constraint on your interface:
```
public... |
36,205,742 | I have a model `Job`.
A `Job` can require other `Jobs` be completed before it can begin.
A `Job` may be the pre-required job for many `Jobs` at once.
So, say `Job A` depends on `Job B` and `Job C`, I would like to be able to call `job->requiredJobs` and get those two jobs.
As it stands, I have the following:
```
c... | 2016/03/24 | [
"https://Stackoverflow.com/questions/36205742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1191044/"
] | [Nick](https://stackoverflow.com/a/36205924/1191044)'s answer pushed me in the right direction.
Here is how I ended up defining my model:
```
class Job extends Model
{
public function requiredJobs()
{
return $this->belongsToMany('App\Job', null, 'dependent_job_ids', 'required_job_ids');
}
p... | For a [Many To Many relationship](https://laravel.com/docs/5.2/eloquent-relationships#many-to-many), `belongsToMany()` is the correct method but you'll also need a pivot table to store the links. |
36,205,742 | I have a model `Job`.
A `Job` can require other `Jobs` be completed before it can begin.
A `Job` may be the pre-required job for many `Jobs` at once.
So, say `Job A` depends on `Job B` and `Job C`, I would like to be able to call `job->requiredJobs` and get those two jobs.
As it stands, I have the following:
```
c... | 2016/03/24 | [
"https://Stackoverflow.com/questions/36205742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1191044/"
] | For a [Many To Many relationship](https://laravel.com/docs/5.2/eloquent-relationships#many-to-many), `belongsToMany()` is the correct method but you'll also need a pivot table to store the links. | This is just to add on anyone looking for a solution on the same issue, relating the same model.
Here you can create a joining table with normal `Many to Many` Relationships and attach ids as normal Laravel relationships
```php
public function requiredJobs()
{
return $this->belongsToMany('App\Job','dependent_jobs... |
36,205,742 | I have a model `Job`.
A `Job` can require other `Jobs` be completed before it can begin.
A `Job` may be the pre-required job for many `Jobs` at once.
So, say `Job A` depends on `Job B` and `Job C`, I would like to be able to call `job->requiredJobs` and get those two jobs.
As it stands, I have the following:
```
c... | 2016/03/24 | [
"https://Stackoverflow.com/questions/36205742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1191044/"
] | [Nick](https://stackoverflow.com/a/36205924/1191044)'s answer pushed me in the right direction.
Here is how I ended up defining my model:
```
class Job extends Model
{
public function requiredJobs()
{
return $this->belongsToMany('App\Job', null, 'dependent_job_ids', 'required_job_ids');
}
p... | This is just to add on anyone looking for a solution on the same issue, relating the same model.
Here you can create a joining table with normal `Many to Many` Relationships and attach ids as normal Laravel relationships
```php
public function requiredJobs()
{
return $this->belongsToMany('App\Job','dependent_jobs... |
57,917,370 | As we know Tomcat has approx 200 threads and Jetty has some default count threads in their respective thread pools. So if we set something in a `ThreadLocal` per request, will it be there in the thread for life time or will Tomcat clear the `ThreadLocal` after each request.
If we set something in userContext in a fil... | 2019/09/13 | [
"https://Stackoverflow.com/questions/57917370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9845995/"
] | No, Tomcat will not clear ThreadLocals that your code creates, which means they will remain and could pollute subsequent requests.
So whenever you create one, make sure you clear it out before that same request or whatever exits.
It should also be noted that subsequent requests - even using the identical URL - could ... | If you put something in a ThreadLocal in a Thread that is not 100% under your control (i.e. one in which you are invoked from other code, like for a HTTP request), you need to clear whatever you set before you leave your code.
A `try`/`finally` structure is a good way to do that.
A threadpool can't do it for you, bec... |
57,917,370 | As we know Tomcat has approx 200 threads and Jetty has some default count threads in their respective thread pools. So if we set something in a `ThreadLocal` per request, will it be there in the thread for life time or will Tomcat clear the `ThreadLocal` after each request.
If we set something in userContext in a fil... | 2019/09/13 | [
"https://Stackoverflow.com/questions/57917370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9845995/"
] | Yes, you need to clear ThreadLocal. Tomcat won't clear ThreadLocals.
No, new thread is not created every time. A thread from the pool is used to serve a request, and returned back to pool once request is complete.
This not only applies to Tomcat, it applies to Jetty and Undertow as well. Thread creation for every req... | No, Tomcat will not clear ThreadLocals that your code creates, which means they will remain and could pollute subsequent requests.
So whenever you create one, make sure you clear it out before that same request or whatever exits.
It should also be noted that subsequent requests - even using the identical URL - could ... |
57,917,370 | As we know Tomcat has approx 200 threads and Jetty has some default count threads in their respective thread pools. So if we set something in a `ThreadLocal` per request, will it be there in the thread for life time or will Tomcat clear the `ThreadLocal` after each request.
If we set something in userContext in a fil... | 2019/09/13 | [
"https://Stackoverflow.com/questions/57917370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9845995/"
] | Yes, you need to clear ThreadLocal. Tomcat won't clear ThreadLocals.
No, new thread is not created every time. A thread from the pool is used to serve a request, and returned back to pool once request is complete.
This not only applies to Tomcat, it applies to Jetty and Undertow as well. Thread creation for every req... | If you put something in a ThreadLocal in a Thread that is not 100% under your control (i.e. one in which you are invoked from other code, like for a HTTP request), you need to clear whatever you set before you leave your code.
A `try`/`finally` structure is a good way to do that.
A threadpool can't do it for you, bec... |
6,828,424 | I'm using simple-navigation to dynamically generate my navigation depending on a permission level that the user has. It works fine but it doesn't seem to mark any item as current.
Any ideas? | 2011/07/26 | [
"https://Stackoverflow.com/questions/6828424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/305120/"
] | The issue was that it needs the absolute path from the root, not the relative path. | Please read the 'Highlighting the active Navigation Item' section here: <https://github.com/andi/simple-navigation/wiki/Configuration> |
52,810,702 | I am interested in updating existing layer parameters in Keras (not removing a layer and inserting a new one instead, rather just modifying existing parameters).
I will give an example of a function I'm writing:
```
def add_filters(self, model):
conv_indices = [i for i, layer in enumerate(model.layers) if 'convol... | 2018/10/15 | [
"https://Stackoverflow.com/questions/52810702",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4404709/"
] | Well, if you would like to create the architecture of a new model based on an existing model, though with some modifications, you can use `to_json` and `model_from_json()` functions. Here is an example:
```
model = Sequential()
model.add(Conv2D(10, (3,3), input_shape=(100,100,3)))
model.add(Conv2D(40, (3,3)))
model.s... | Another solution is to again set the attributes of layer. For instance if someone wants to change the kernel initializer of convolutional layers, below is the small example:
```
img_input = tf.keras.Input(shape=(256,256,1))
x = tf.keras.layers.Conv2D(64, (7, 7), padding='same', use_bias=False, kernel_initializer=Non... |
42,210,351 | I am doing a time table project for my college, in which I want to generate notification on each hour using AlarmManager, I almost got the solution, but the alarm gets triggered during random time, like between hours. What I want is to trigger alarm manger messages on exactly each hour, like 7.00am,8.00am, and so on on... | 2017/02/13 | [
"https://Stackoverflow.com/questions/42210351",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6859825/"
] | As in the description of AlarmManager:
>
> Note: Beginning with API 19 (KITKAT) alarm delivery is inexact: the OS
> will shift alarms in order to minimize wakeups and battery use. There
> are new APIs to support applications which need strict delivery
> guarantees; see setWindow(int, long, long, PendingIntent) and... | Instead of this:
```
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,System.currentTimeMillis(),AlarmManager.INTERVAL_HOUR,pendingIntent);
```
You need to pass an actual time when you want this to wake up, not `System.currentTimeMillis()`
So something like
```
Calendar calendar = Calendar.getInstance();
Date ne... |
11,441,042 | I'm trying to write a context manager that uses other context managers, so clients don't need to know the whole recipe, just the interface I'm presenting. I can't do it using `@contextmanager` - the code after `yield` call doesn't get executed if you're interrupted by an exception, so I need to use a class-based manage... | 2012/07/11 | [
"https://Stackoverflow.com/questions/11441042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/688305/"
] | ```
@contextmanager
def compl(arg, val):
with simple("one",1):
with simple("two",2):
print "enter complex", arg
try:
d[arg] = val
yield
finally:
del d[arg]
print "exit complex", arg
``` | The trouble with what you're doing, is that in using `with` in your `__enter__` call, when you enter your wrapping context manager, you both enter and then leaving the wrapped context managers. If you want write your own context manager that enters the wrapped context managers when you enter the wrapper, then exits the... |
11,441,042 | I'm trying to write a context manager that uses other context managers, so clients don't need to know the whole recipe, just the interface I'm presenting. I can't do it using `@contextmanager` - the code after `yield` call doesn't get executed if you're interrupted by an exception, so I need to use a class-based manage... | 2012/07/11 | [
"https://Stackoverflow.com/questions/11441042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/688305/"
] | ```
@contextmanager
def compl(arg, val):
with simple("one",1):
with simple("two",2):
print "enter complex", arg
try:
d[arg] = val
yield
finally:
del d[arg]
print "exit complex", arg
``` | You write, "I can't do it using @contextmanager - the code after yield call doesn't get executed if you're interrupted by an exception." If you have code that must run you can put it in a `try/finally` block.
```
import contextlib
@contextlib.contextmanager
def internal_cm():
try:
print "Entering internal... |
11,441,042 | I'm trying to write a context manager that uses other context managers, so clients don't need to know the whole recipe, just the interface I'm presenting. I can't do it using `@contextmanager` - the code after `yield` call doesn't get executed if you're interrupted by an exception, so I need to use a class-based manage... | 2012/07/11 | [
"https://Stackoverflow.com/questions/11441042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/688305/"
] | ```
@contextmanager
def compl(arg, val):
with simple("one",1):
with simple("two",2):
print "enter complex", arg
try:
d[arg] = val
yield
finally:
del d[arg]
print "exit complex", arg
``` | In case you're seeing this answer based on the wording of the question, here's a summary of the solution
```
@contextmanager
def your_custom_context_manager():
with open(...) as f:
# do your thing here, e.g. have an `if` statement, or another `with` statement
yield f # this is where your new context... |
11,441,042 | I'm trying to write a context manager that uses other context managers, so clients don't need to know the whole recipe, just the interface I'm presenting. I can't do it using `@contextmanager` - the code after `yield` call doesn't get executed if you're interrupted by an exception, so I need to use a class-based manage... | 2012/07/11 | [
"https://Stackoverflow.com/questions/11441042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/688305/"
] | You write, "I can't do it using @contextmanager - the code after yield call doesn't get executed if you're interrupted by an exception." If you have code that must run you can put it in a `try/finally` block.
```
import contextlib
@contextlib.contextmanager
def internal_cm():
try:
print "Entering internal... | The trouble with what you're doing, is that in using `with` in your `__enter__` call, when you enter your wrapping context manager, you both enter and then leaving the wrapped context managers. If you want write your own context manager that enters the wrapped context managers when you enter the wrapper, then exits the... |
11,441,042 | I'm trying to write a context manager that uses other context managers, so clients don't need to know the whole recipe, just the interface I'm presenting. I can't do it using `@contextmanager` - the code after `yield` call doesn't get executed if you're interrupted by an exception, so I need to use a class-based manage... | 2012/07/11 | [
"https://Stackoverflow.com/questions/11441042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/688305/"
] | In case you're seeing this answer based on the wording of the question, here's a summary of the solution
```
@contextmanager
def your_custom_context_manager():
with open(...) as f:
# do your thing here, e.g. have an `if` statement, or another `with` statement
yield f # this is where your new context... | The trouble with what you're doing, is that in using `with` in your `__enter__` call, when you enter your wrapping context manager, you both enter and then leaving the wrapped context managers. If you want write your own context manager that enters the wrapped context managers when you enter the wrapper, then exits the... |
11,441,042 | I'm trying to write a context manager that uses other context managers, so clients don't need to know the whole recipe, just the interface I'm presenting. I can't do it using `@contextmanager` - the code after `yield` call doesn't get executed if you're interrupted by an exception, so I need to use a class-based manage... | 2012/07/11 | [
"https://Stackoverflow.com/questions/11441042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/688305/"
] | You write, "I can't do it using @contextmanager - the code after yield call doesn't get executed if you're interrupted by an exception." If you have code that must run you can put it in a `try/finally` block.
```
import contextlib
@contextlib.contextmanager
def internal_cm():
try:
print "Entering internal... | In case you're seeing this answer based on the wording of the question, here's a summary of the solution
```
@contextmanager
def your_custom_context_manager():
with open(...) as f:
# do your thing here, e.g. have an `if` statement, or another `with` statement
yield f # this is where your new context... |
834,125 | $$f(x,y,z)=2-\left(z-\sqrt{x^2+y^2}\right)^2+\left(z-\sqrt{x^2+y^2}\right)^3$$
Find maximum and minimum of the function. | 2014/06/14 | [
"https://math.stackexchange.com/questions/834125",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/156491/"
] | Hint: differentiate $f$ wrt $x$, $y$ and $z$ and set $\frac{\partial f}{\partial x}=\frac{\partial f}{\partial y}=\frac{\partial f}{\partial z}=0$.
You'll get a system of (three) simultaneous equations in $x$, $y$ and $z$.
Solve these for $(x,y,z)$ and you're done.
...
Reminder: to partially differentiate $f$ wrt $... | I suggest you to write it in cylindrical coordinates, i.e.
$$f(r,\theta,z)=2-\left(z-r\right)^2+\left(z-r\right)^3\ .$$
Now you can take the gradient in cylindrical coordinates (<http://en.wikipedia.org/wiki/Del_in_cylindrical_and_spherical_coordinates>)
$$(\frac{\partial f}{\partial r},\frac{1}{r}\frac{\partial f}{\pa... |
834,125 | $$f(x,y,z)=2-\left(z-\sqrt{x^2+y^2}\right)^2+\left(z-\sqrt{x^2+y^2}\right)^3$$
Find maximum and minimum of the function. | 2014/06/14 | [
"https://math.stackexchange.com/questions/834125",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/156491/"
] | Hint: differentiate $f$ wrt $x$, $y$ and $z$ and set $\frac{\partial f}{\partial x}=\frac{\partial f}{\partial y}=\frac{\partial f}{\partial z}=0$.
You'll get a system of (three) simultaneous equations in $x$, $y$ and $z$.
Solve these for $(x,y,z)$ and you're done.
...
Reminder: to partially differentiate $f$ wrt $... | The extrema of
$$ f(x,y,z) = 2 - \left( z - \sqrt{x^2+y^2} \right)^2 + \left( z- \sqrt{x^2+y^2} \right)^3 $$
Put
$$ \zeta = z - \sqrt{x^2+y^2} $$
so we find the extrema of
$$ f(\zeta) = 2 - \zeta^2 + \zeta^3 $$
which is solving
$$ - 2 \zeta + 3 \zeta^2 = 0$$
Thus
$$\zeta = 0 \textrm{ or } \zeta = \frac{2}{3}$$... |
834,125 | $$f(x,y,z)=2-\left(z-\sqrt{x^2+y^2}\right)^2+\left(z-\sqrt{x^2+y^2}\right)^3$$
Find maximum and minimum of the function. | 2014/06/14 | [
"https://math.stackexchange.com/questions/834125",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/156491/"
] | The extrema of
$$ f(x,y,z) = 2 - \left( z - \sqrt{x^2+y^2} \right)^2 + \left( z- \sqrt{x^2+y^2} \right)^3 $$
Put
$$ \zeta = z - \sqrt{x^2+y^2} $$
so we find the extrema of
$$ f(\zeta) = 2 - \zeta^2 + \zeta^3 $$
which is solving
$$ - 2 \zeta + 3 \zeta^2 = 0$$
Thus
$$\zeta = 0 \textrm{ or } \zeta = \frac{2}{3}$$... | I suggest you to write it in cylindrical coordinates, i.e.
$$f(r,\theta,z)=2-\left(z-r\right)^2+\left(z-r\right)^3\ .$$
Now you can take the gradient in cylindrical coordinates (<http://en.wikipedia.org/wiki/Del_in_cylindrical_and_spherical_coordinates>)
$$(\frac{\partial f}{\partial r},\frac{1}{r}\frac{\partial f}{\pa... |
25,893,213 | help to solve the problem.
I have a board Altera db4kgh15. It has built-in support pci-e interface. I have a Linux kernel module, which is controlled by the fee. with the function below I scan the base registers dogs and try to write in the register data.
The board should adopt a 32-bit word and send it back by adding ... | 2014/09/17 | [
"https://Stackoverflow.com/questions/25893213",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4019156/"
] | ```
plx_pci_io_base = pci_resource_start(dev, 0);
iolength = pci_resource_len(dev, 0);
if (!request_mem_region(plx_pci_io_base, iolength, "PGDR IO Base")) {
DEBUG(KERN_ERR "request region #1\n");
return -EBUSY;
}
iobase = ioremap_nocache(plx_pci_io_base, iolength);
if (!iobase) {
DEBUG(KERN_ERR "ioremap #... | You can try the following:
1. Use writel and readl instead of outl\_p and inl\_p
2. Check if the BAR register into which you are writing/reading and the BAR register used by RTL are same
3. Use Signal Tap to check if the RD/WR reach you RTL logic |
14,139,214 | I'm trying to add multiple layouts dynamically under each other. So I wrote the following code:
```
for (int i = 1; i <= layoutCounter; i++) {
View neu = inflater.inflate(R.layout.vote, parent, false);
neu.setId(layoutID);
if (layoutID == 1) {
params = new RelativeLayout.LayoutP... | 2013/01/03 | [
"https://Stackoverflow.com/questions/14139214",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1199662/"
] | Maybe with:
`params.addRule(RelativeLayout.BELOW, layoutID-1);`
instead of:
`params.addRule(RelativeLayout.BELOW, neu.getId());`
in your else condition. | You can try like this
```
RelativeLayout.LayoutParams rl = new RelativeLayout.LayoutParams(...)
rl.addRule(RelativeLayout.BELOW, anotherview.getId())
rl.addRule(RelativeLayout.ALIGN_PARENT_LEFT)
parentLayout.addView(myView, rl)
``` |
33,354,083 | I'm writing an add-in for another piece of software through its API. The classes returned by the API can only be access through the native software and the API. So I am writing my own stand alone POCO/DTO objects which map to the API classes. I'm working on a feature which will read in a native file, and return a colle... | 2015/10/26 | [
"https://Stackoverflow.com/questions/33354083",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/88427/"
] | Instead of returning errors as part of the entities you could wrap the result in a reply or response message. Errors could then be a part of the response message instead of the entities.
The advantage of this is that the entities are *clean*
The downside is that it will be harder to map the errors back to offending ... | In principal, if something goes wrong in API (which cannot be recovered), the calling code must be aware that an exception has occurred. So it can have a strategy in place to deal with it.
Therefor, the approach that comes to my mind is influenced by the same philosophy -
1> Define your own exception Lets say `Incom... |
33,354,083 | I'm writing an add-in for another piece of software through its API. The classes returned by the API can only be access through the native software and the API. So I am writing my own stand alone POCO/DTO objects which map to the API classes. I'm working on a feature which will read in a native file, and return a colle... | 2015/10/26 | [
"https://Stackoverflow.com/questions/33354083",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/88427/"
] | Instead of returning errors as part of the entities you could wrap the result in a reply or response message. Errors could then be a part of the response message instead of the entities.
The advantage of this is that the entities are *clean*
The downside is that it will be harder to map the errors back to offending ... | Instead of throwing Exceptions throughout your code, you can return some extra information together with whatever you want to return.
```
public (ErrMsg Msg, int? Result) Divide(int x, int y)
{
ErrMsg msg = new ErrMsg();
try
{
if(x == 0){
msg = new ErrMsg{Sev... |
33,354,083 | I'm writing an add-in for another piece of software through its API. The classes returned by the API can only be access through the native software and the API. So I am writing my own stand alone POCO/DTO objects which map to the API classes. I'm working on a feature which will read in a native file, and return a colle... | 2015/10/26 | [
"https://Stackoverflow.com/questions/33354083",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/88427/"
] | In principal, if something goes wrong in API (which cannot be recovered), the calling code must be aware that an exception has occurred. So it can have a strategy in place to deal with it.
Therefor, the approach that comes to my mind is influenced by the same philosophy -
1> Define your own exception Lets say `Incom... | Instead of throwing Exceptions throughout your code, you can return some extra information together with whatever you want to return.
```
public (ErrMsg Msg, int? Result) Divide(int x, int y)
{
ErrMsg msg = new ErrMsg();
try
{
if(x == 0){
msg = new ErrMsg{Sev... |
16,505,968 | In my Grails domain class I want to set default values which do persist in the database. I use mysql as database. I tried to do this:
```
class A {
long someValue = 1
long someOtherValue
boolean someBool = true
boolean someOtherBool
static mapping = {
someOtherValue defaultValue: 1
someOth... | 2013/05/12 | [
"https://Stackoverflow.com/questions/16505968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1055664/"
] | If you are on Grails 2.2 above then you can use defaultValue. Look at Burt's answer [here](https://stackoverflow.com/questions/13577459/how-can-i-set-default-value-in-grails-domain-class)
Try it, hope this helps:
```
Class A {
Long someValue
Long someOtherValue
Boolean someBool
Boolean someO... | I found that for defaultValue to work with String properties, I needed to put double quotes around single quotes and for defaultValue to work for numeric properties, I needed to put double quotes around the number or the defaults wouldn't appear in the DDL. So, for instance:
```
static mapping = {
myStringProperty ... |
16,505,968 | In my Grails domain class I want to set default values which do persist in the database. I use mysql as database. I tried to do this:
```
class A {
long someValue = 1
long someOtherValue
boolean someBool = true
boolean someOtherBool
static mapping = {
someOtherValue defaultValue: 1
someOth... | 2013/05/12 | [
"https://Stackoverflow.com/questions/16505968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1055664/"
] | If you are on Grails 2.2 above then you can use defaultValue. Look at Burt's answer [here](https://stackoverflow.com/questions/13577459/how-can-i-set-default-value-in-grails-domain-class)
Try it, hope this helps:
```
Class A {
Long someValue
Long someOtherValue
Boolean someBool
Boolean someO... | ```
class A {
long someValue
long someOtherValue
boolean someBool = Boolean.TRUE
boolean someOtherBool = Boolean.TRUE
static mapping = {
someValue defaultValue: '1'
someOtherValue defaultValue: '1'
}
}
```
This will work, tested in 2.2.3. |
5,565,035 | i am new to ruby on rails and cucumber. actually i was trying to compare page title with text i am expecting but dont know that how to get text in ruby. in selenium we can use getText function like
```
assertEquals("ID: 1351018000", selenium.getText("//div[@id='articleInfo']/ul[1]/li[1]"));
```
can you help in ruby... | 2011/04/06 | [
"https://Stackoverflow.com/questions/5565035",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/694665/"
] | It works very well with one context and two drawables. One just has to be careful to destroy the renderbuffer before detaching from the old `CAEAGLLayer`, and reallocate a new one with the new `CAEAGLLayer`; most the code to do that is provided in the `EAGLView` class of the OpenGL ES app template in Xcode. And of cour... | Apple has a fine sample project named GLAirplay for that szenario provided.
You can find it [here](https://developer.apple.com/library/ios/samplecode/GLAirplay/Introduction/Intro.html). |
22,954,232 | I fetch data of particular table by stored procedure ,demo code is
```
Array
(
[0] => Array
(
[object_types] => Array
(
[ID] => 11
[Code] => Item001
[Name] => Item
[Description] => Items
... | 2014/04/09 | [
"https://Stackoverflow.com/questions/22954232",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3484710/"
] | you need `awk '/<$/ { print NR; }' <your-file>` | So I build the source file,
```
$ cat file
c
a
b<
d
f<
```
with below awk, it will move the `<` to next line, but if it is last line, `<` will be moved to fist line.
```
awk '{ if (/</) a[NR]
sub(/</,"")
b[NR]=$0 }
END{ for (i in a)
{ if (i==NR) { b[1]=b[1] "<" }
else{ b[i+1]=b[i+1] "... |
22,954,232 | I fetch data of particular table by stored procedure ,demo code is
```
Array
(
[0] => Array
(
[object_types] => Array
(
[ID] => 11
[Code] => Item001
[Name] => Item
[Description] => Items
... | 2014/04/09 | [
"https://Stackoverflow.com/questions/22954232",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3484710/"
] | you need `awk '/<$/ { print NR; }' <your-file>` | Grep could be used also:
```
grep -n \< infile
```
Then:
```
grep -n \< infile|cut -d : -f 1
``` |
22,954,232 | I fetch data of particular table by stored procedure ,demo code is
```
Array
(
[0] => Array
(
[object_types] => Array
(
[ID] => 11
[Code] => Item001
[Name] => Item
[Description] => Items
... | 2014/04/09 | [
"https://Stackoverflow.com/questions/22954232",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3484710/"
] | Grep could be used also:
```
grep -n \< infile
```
Then:
```
grep -n \< infile|cut -d : -f 1
``` | So I build the source file,
```
$ cat file
c
a
b<
d
f<
```
with below awk, it will move the `<` to next line, but if it is last line, `<` will be moved to fist line.
```
awk '{ if (/</) a[NR]
sub(/</,"")
b[NR]=$0 }
END{ for (i in a)
{ if (i==NR) { b[1]=b[1] "<" }
else{ b[i+1]=b[i+1] "... |
30,401,227 | I have only a few months android experiece .Recently I updated to android studio 1.2 and the update broke the preview pane , i would like to help with this bug by checking what works and what doesnt ,
It says here in the Known issues page
>
> Workaround 3: If the above workarounds don't work for you, and you are
> ... | 2015/05/22 | [
"https://Stackoverflow.com/questions/30401227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3725998/"
] | At Android Studio : Top menu Select VCS -> Apply Patch | Try lowering the version used to render to API 21
On the right of the preview pane change the 22 to 21. |
30,401,227 | I have only a few months android experiece .Recently I updated to android studio 1.2 and the update broke the preview pane , i would like to help with this bug by checking what works and what doesnt ,
It says here in the Known issues page
>
> Workaround 3: If the above workarounds don't work for you, and you are
> ... | 2015/05/22 | [
"https://Stackoverflow.com/questions/30401227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3725998/"
] | In my case, using Android Studio Artic Fox. Top Menu: Git -> Patch -> Apply patch (or "Apply Patch from Clipboard" if you have copied it) | Try lowering the version used to render to API 21
On the right of the preview pane change the 22 to 21. |
30,401,227 | I have only a few months android experiece .Recently I updated to android studio 1.2 and the update broke the preview pane , i would like to help with this bug by checking what works and what doesnt ,
It says here in the Known issues page
>
> Workaround 3: If the above workarounds don't work for you, and you are
> ... | 2015/05/22 | [
"https://Stackoverflow.com/questions/30401227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3725998/"
] | At Android Studio : Top menu Select VCS -> Apply Patch | Good developers shouldn't reply on android studio but command line.
>
> `git apply your_file.patch`
>
>
> |
30,401,227 | I have only a few months android experiece .Recently I updated to android studio 1.2 and the update broke the preview pane , i would like to help with this bug by checking what works and what doesnt ,
It says here in the Known issues page
>
> Workaround 3: If the above workarounds don't work for you, and you are
> ... | 2015/05/22 | [
"https://Stackoverflow.com/questions/30401227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3725998/"
] | At Android Studio : Top menu Select VCS -> Apply Patch | In my case, using Android Studio Artic Fox. Top Menu: Git -> Patch -> Apply patch (or "Apply Patch from Clipboard" if you have copied it) |
30,401,227 | I have only a few months android experiece .Recently I updated to android studio 1.2 and the update broke the preview pane , i would like to help with this bug by checking what works and what doesnt ,
It says here in the Known issues page
>
> Workaround 3: If the above workarounds don't work for you, and you are
> ... | 2015/05/22 | [
"https://Stackoverflow.com/questions/30401227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3725998/"
] | In my case, using Android Studio Artic Fox. Top Menu: Git -> Patch -> Apply patch (or "Apply Patch from Clipboard" if you have copied it) | Good developers shouldn't reply on android studio but command line.
>
> `git apply your_file.patch`
>
>
> |
3,676,245 | So im creating a webcrawler and everything works, only got 1 problem.
With `file_get_contents($page_data["url"]);` I get the content of a webpage. This webpage is scanned when one of my keywords excists on the webpage.
```
$find = $keywords; $str = file_get_contents($page_data["url"]);
if(strpos($str, $find) == true... | 2010/09/09 | [
"https://Stackoverflow.com/questions/3676245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | **To completely replace the registered defaults**, you will replace the `NSRegistrationDomain` domain (which is volatile, by the way).
**To remove individual registered defaults**, you get the values in the `NSRegistrationDomain`, remove the offending key(s), and replace the domain.
A category on `NSUserDefaults` mig... | You can use `removeVolatileDomainForName:` to remove the `NSRegistrationDomain`. This clears all values registered via `registerDefaults:`. But if you need to do this you’re most likely doing something wrong. The right way would be to actually store the new settings using one of the `set...:forKey:` methods. |
3,676,245 | So im creating a webcrawler and everything works, only got 1 problem.
With `file_get_contents($page_data["url"]);` I get the content of a webpage. This webpage is scanned when one of my keywords excists on the webpage.
```
$find = $keywords; $str = file_get_contents($page_data["url"]);
if(strpos($str, $find) == true... | 2010/09/09 | [
"https://Stackoverflow.com/questions/3676245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Swift 3 port of EthanB's original answer:
```
extension UserDefaults {
/// Unregisters a value set in the UserDefaults.registrationDomain, if it exists
func unregister(defaultsFor key: String) {
var registeredDefaults = volatileDomain(forName: UserDefaults.registrationDomain)
registeredDefaults... | You can use `removeVolatileDomainForName:` to remove the `NSRegistrationDomain`. This clears all values registered via `registerDefaults:`. But if you need to do this you’re most likely doing something wrong. The right way would be to actually store the new settings using one of the `set...:forKey:` methods. |
3,676,245 | So im creating a webcrawler and everything works, only got 1 problem.
With `file_get_contents($page_data["url"]);` I get the content of a webpage. This webpage is scanned when one of my keywords excists on the webpage.
```
$find = $keywords; $str = file_get_contents($page_data["url"]);
if(strpos($str, $find) == true... | 2010/09/09 | [
"https://Stackoverflow.com/questions/3676245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | **To completely replace the registered defaults**, you will replace the `NSRegistrationDomain` domain (which is volatile, by the way).
**To remove individual registered defaults**, you get the values in the `NSRegistrationDomain`, remove the offending key(s), and replace the domain.
A category on `NSUserDefaults` mig... | Swift 3 port of EthanB's original answer:
```
extension UserDefaults {
/// Unregisters a value set in the UserDefaults.registrationDomain, if it exists
func unregister(defaultsFor key: String) {
var registeredDefaults = volatileDomain(forName: UserDefaults.registrationDomain)
registeredDefaults... |
47,247,257 | I want to create a layout like below image. It includes:
* A left part
* A right part
* A title stretch whole row
[](https://i.stack.imgur.com/1R2iJ.png)
I can do as structure html like this and using some layout such as Flexbox, div positioning ..... | 2017/11/12 | [
"https://Stackoverflow.com/questions/47247257",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1493868/"
] | No you can't do that because you can't create a range of string values of different text fields.
You could make an array of the three fields and enumerate that:
```
@IBAction func applyButton(sender: AnyObject) {
for field in [visibleText1, visibleText2, visibleText3] {
field.stringValue = inputFiel... | There are several things wrong with this, but I will start with what *will* work:
```
import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet weak var window: NSWindow!
@IBOutlet weak var inputField: NSTextField!
@IBOutlet weak var visibleText1: NSTextField!
@IB... |
1,692,800 | In my production environment I have several Web applications installed in the same machine. These applications access various web services and two SQL Server databases this means that my web.config files are very big and full of details. Besides this I also have windows services that consume the same web services and a... | 2009/11/07 | [
"https://Stackoverflow.com/questions/1692800",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/71666/"
] | If I understand correctly you want to factor out some 'stable' settings
1. The config system is hierarchical, you can store default settings in
`C:\Windows\Micorsoft.NET\<version>\Machine.config` or `Web.config`
That is a pretty heavy tool though. Make an error and most .NET apps will fail to start
2. Use [Confi... | You could centralize parts of the configuration and dynamically load that file. See this [codeproject article](http://www.codeproject.com/KB/cs/runtimeconsoleconfigfile.aspx) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.