text
stringlengths 36
35k
| label
class label 2
classes | source
stringclasses 3
values | tokens_length
int64 128
4.1k
| text_length
int64 36
35k
|
---|---|---|---|---|
If $M_c$ is finitely generated, then it is a principal ideal.. <p>The following question is a part of <a href="https://math.stackexchange.com/questions/1447559/m-a-f-in-c0-1-fa-0-for-a-in-0-1-is-m-a-finitely-gene?rq=1">this</a> problem. </p>
<p>Let <span class="math-container">$R = \{ f: [0,1] \to \mathbb{R} \; | \; f \text{ is a continuous map} \}$</span> be the ring of continuous functions. We define <span class="math-container">$M_c = \{ f \in R \; | \; f(c)=0 \}$</span>. It is very easy to prove that <span class="math-container">$M_c$</span> is a maximal ideal. The final result we want to prove is: </p>
<blockquote>
<p><span class="math-container">$M_c$</span> is not a finitely generated ideal.</p>
</blockquote>
<p>One of the claims which I saw while reading from <a href="http://www.math.lsa.umich.edu/~kesmith/593hmwk2-2014-solutions.pdf" rel="nofollow noreferrer">here</a> is the following:</p>
<blockquote>
<p>If <span class="math-container">$M_c$</span> is finitely generated, then it is a principal ideal.</p>
</blockquote>
<p>(Later they use this result that since <span class="math-container">$M_c$</span> is not a principal ideal, and hence <span class="math-container">$M_c$</span> is not finitely generated.)</p>
<p><em>Proof.</em> Assume that <span class="math-container">$M_c = \left<f_1,\dots,f_n\right>$</span>. The function <span class="math-container">$f_{1}^{1/3}$</span> is also in <span class="math-container">$M_c$</span> so write it as <span class="math-container">$\sum_{i=1}^n g_if_i$</span> for some <span class="math-container">$g_i \in R$</span>. Cubing both side, we have:
<span class="math-container">$f_1 = \sum h_if_i$</span> where, in particular, <span class="math-container">$h_1$</span> vanishes at <span class="math-container">$c$</span> (gathering up coefficients of <span class="math-container">$f_1$</span> in <span class="math-container">$(\sum g_if_i)^3$</span>; we see the coefficient <span class="math-container">$h_i$</span> is in the ideal <span class="math-container">$<f_1, \dots, f_n>^2$</span>).</p>
<p>So, <span class="math-container">$(1 − h_1)f_1 \in <f_1, \dots, f_n>$</span>. Since <span class="math-container">$1 − h_1$</span> does not vanish at <span class="math-container">$c$</span>, we can find an interval <span class="math-container">$B = [a, b]$</span> containing <span class="math-container">$c$</span> where it also doesn’t vanish. </p>
<p>Here is what I don't understand: </p>
<p>Doubt: In the ring <span class="math-container">$S$</span> of continuous functions on <span class="math-container">$B, \; 1 − h_1$</span> is a unit, hence on this ring <span class="math-container">$S$</span>, the ideal <span class="math-container">$M_c$</span> is generated by <span class="math-container">$<f_2|_{B}, \dots, f_n|_{B}>$</span>.
How does this follow?</p>
| 0non-cybersec
| Stackexchange | 1,044 | 2,867 |
Missing an elementary step about the frame of strings in Barr-Diaconescu theorem. <p>I'm trying to understand the proof of the Barr-Diaconescu theorem about Boolean covers for Grothendieck sites. Precisely, the versions you can find in Jardine's book "Local Homotopy Theory" or in Mac Lane - Moerdijk "Sheaves in Geometry and Logic", which are essentially the same. That is,</p>
<p><strong>Theorem.</strong> For every Grothendieck topos $\mathcal{E}$ there exists a complete Boolean algebra $\mathcal{B}$ and a topos morphism $p: \mathbf{Sh}(\mathcal{B}) \longrightarrow \mathcal{E}$ such that the inverse image functor $p^* : \mathcal{E} \longrightarrow \mathbf{Sh}(\mathcal{B}) $ is faithful.</p>
<p>Particularly, I'm having troubles with something that must be definitively elementary. In both books the first step goes like this: you take a Grothendieck site $\mathcal{X}$ such that $\mathcal{E} = \mathbf{Sh}(\mathcal{X})$ and you consider the poset of strings of arrows $\mathbf{String}({\mathcal{X}})$ of $\mathcal{X}$, where a <em>string</em> is a sequence of composable arrows in $\mathcal{X}$,</p>
<p>$$
s = \left( U_n \stackrel{\alpha_n}{\longrightarrow} U_{n-1} \stackrel{\alpha_{n-1}}{\longrightarrow} \dots \stackrel{\alpha_1}{\longrightarrow} U_0 \right)
$$</p>
<p>These strings carry a natural partial order, both books say (and here, perhaps, begins my problem):</p>
<p><strong>For two strings $s$ and $t$ we write $t \leq s$ if $t$ prolongs $s$ to the left.</strong></p>
<p>That is, for a string $s$ like the one above, $t$ must be of the form</p>
<p>$$
t = \left( U_{n+m} \longrightarrow \dots \longrightarrow U_{n+1} \longrightarrow U_n \stackrel{\alpha_n}{\longrightarrow} \dots \longrightarrow U_0 \right) \ .
$$</p>
<p>So far so good, but, if I understand everything correctly, now this poset $\mathbf{String}({\mathcal{X}})$ must also be a <em>frame</em>. Because: (1) Mac Lane-Moerdijk says so in his theorem 1; (2) also because the second step of the Diaconescu-Barr theorem (theorem 3.39 in Jardine's book, lemma 3 in Mac Lane-Moerdijk's one) says:</p>
<p><strong>Proposition.</strong> <em>For every frame</em> $\mathcal{S}$ there exists a complete Boolean algebra $\mathcal{B}$ and a topos morphism $i: \mathbf{Sh}(\mathcal{B}) \longrightarrow \mathbf{Sh}(\mathcal{S})$ such that the inverse image functor $i^*: \mathbf{Sh}(\mathcal{S}) \longrightarrow \mathbf{Sh}(\mathcal{B}) $ is faithful.</p>
<p>Hence, you put $\mathcal{S} = \mathbf{String}({\mathcal{X}}) $ in this proposition and you are done: you have the Diaconescu-Barr theorem proved for you. Notice, however, that in the proof of this proposition you do indeed need the frame structure of $\mathcal{S}$.</p>
<p>Ok, so my question is the following:</p>
<p><strong>Question.</strong> Which are the meets $\wedge$ and joints $\vee$ of the frame $\mathbf{String}({\mathcal{X}})$? </p>
<p>Neither book says anything about them, so I imagine this must be an easy exercise -that I'm unfortunately unable to solve. </p>
<p>Let me explain my lack of understanding to you. </p>
<p><strong>(1)</strong> As for joints, I would say that, given strings</p>
<p>$$
s = \left( U_n \stackrel{\alpha_n}{\longrightarrow} U_{n-1} \stackrel{\alpha_{n-1}}{\longrightarrow} \dots \stackrel{\alpha_1}{\longrightarrow} U_0 \right)
$$</p>
<p>and </p>
<p>$$
t = \left( V_m \stackrel{\beta_m}{\longrightarrow} V_{m-1} \stackrel{\beta_{n-1}}{\longrightarrow} \dots \stackrel{\beta_1}{\longrightarrow} V_0 \right)
$$</p>
<p>their meet could be something like the $0$-string </p>
<p>$$
s \vee t = U_0 \sqcup V_0 \ ,
$$</p>
<p>where $\sqcup$ is the coproduct in the category $\mathcal{X}$: by definition, we have morphisms $U_0 \longrightarrow U_0 \sqcup V_0 \longleftarrow V_0$, so both $s$ and $t$ prolong $s\vee t$ to the left. Right.</p>
<p><strong>But:</strong> the existence of coproducts is <em>not</em> included in the definition of the Grothendieck site $\mathcal{X}$, is it?</p>
<p><strong>(2)</strong> As for meets, my lack of understanding is even worse: if $s \wedge t$ should prolong both $s$ and $t$ to the left, then I cannot imagine how every pair of strings $s$ and $t$ could have a meet.</p>
<p><strong>Because,</strong> if there is a string $s\wedge t$ that prolongs <em>both</em> $s$ and $t$ to the left, then shouldn't $s$ and $t$ be essentially the same string (except for having, perhaps, some arrows deleted in one of them with respect to the other)?</p>
<p>I guess the answers to my questions are pretty obvious, but at this moment I'm stuck with them. What am I missing? Thank you for your help, even if you embarras me a lot.</p>
| 0non-cybersec
| Stackexchange | 1,448 | 4,647 |
Showing that only $(n+1)^{n-1}$ of all the possible $n^n$ choices assure a full car park. <p>This exercise is taken from the site of Queen Mary University of London:</p>
<blockquote>
<p>A car park has <span class="math-container">$n$</span> spaces, numbered from <span class="math-container">$1$</span> to <span class="math-container">$n$</span>, arranged in a row. <span class="math-container">$n$</span> drivers each independently choose a favourite parking space in the park. As each driver enters the park, he drives to his favourite space. If it is empty, he parks there. Otherwise, he continues along the line and parks in the first free space. If all spaces between his favourite and <span class="math-container">$n$</span> are taken, he leaves in disgust.</p>
<p>Show that, out of the <span class="math-container">$n^n$</span> choices of favourite spaces that the drivers can make, just <span class="math-container">$(n+1)^{n-1}$</span> lead to all drivers parking successfully.</p>
</blockquote>
<p>Now, my question is whether my (attempt of ) solution is wrong and what a different approach could be. Here's my idea: proving the claim by (a kind of) induction. It is easy to verify truthfulness for <span class="math-container">$n=1$</span> and <span class="math-container">$n=2$</span>, so having this base case, we shall prove that if the claim holds for all <span class="math-container">$1\le n\le k$</span>, then it does also for <span class="math-container">$n=k+1$</span>.</p>
<p>Let us assume WLOG there is an already established order of appearance of the drivers, since a different order yields the same number of successful choices: it just suffices to swap the drivers. Let us call <span class="math-container">$d_m$</span> the space chosen by the <span class="math-container">$m$</span>-th driver.</p>
<p>Now, consider the cases in which <span class="math-container">$d_1=1$</span>. By inductive hypothesis, the other drivers have <span class="math-container">$n^{n-2}$</span> successful choices. In fact, the same goes for all the other <span class="math-container">$n-1$</span> choices of the first driver, so that in total, as a "first outcome", we have <span class="math-container">$\color\red{n^{n-1}}$</span> successful choices. We somewhat can do the same reasoning with the second driver, but we must keep in mind that for each of his choices, we have already counted those in which the first driver occupies the other spaces. For example, we need to subtract the successful cases in which at the same time <span class="math-container">$d_2=1$</span> and <span class="math-container">$d_1=2$</span>: that is <span class="math-container">$(n-1)^{n-2}$</span>. This happens for all the spaces not chosen by the second driver, and so we actually need to subtract <span class="math-container">$(n-1)^{n-1}$</span>. Finally, letting vary <span class="math-container">$d_2$</span> yields the "second outcome" <span class="math-container">$\color\red{n^{n-1}-n(n-1)^{n-1}}$</span>. And so on, and so on. The final outcome would be the sum of all the red expressions. However I'm afraid no nice power would be a result of this. Is there a mistake in my reasoning?</p>
| 0non-cybersec
| Stackexchange | 906 | 3,210 |
recurrence formula for *i*-th Chern class of $CP^n$. <p>one can show that the relation between first Chern class and second Chern class of $CP^n$ is</p>
<p>$\frac{2(n+1)}{n} c_2 (M)=c_1 (M)^2$ </p>
<p>here $c_1 (M)^2=c_1 (M)∧c_1 (M)$.
So is there any recurrence formula for <em>i</em>-th Chern class of $CP^n$ ?</p>
| 0non-cybersec
| Stackexchange | 137 | 318 |
When the initial capacity of the HashSet (i.e 16) gets filled up how is the new capacity is calculated? What is the formula?. <p>When the initial capacity of the HashSet (i.e 16) gets filled up how is the new capacity is calculated? What is the formula?</p>
<p>for example:
as the size of array list increases by the formula
New capacity = (current capacity * 3/2) + 1 </p>
<p>and for vectors it is
New capacity = (current capacity * 2)</p>
| 0non-cybersec
| Stackexchange | 129 | 445 |
Name this paradox about most common first digits in numbers. <p>I remember hearing about a paradox (not a real paradox, more of a surprising oddity) about frequency of the first digit in a random number being most likely 1, second most likely 2, etc. This was for measurements of seemingly random things, and it didn't work for uniformly generated pseudorandom numbers. I also seem to recall there was a case in history of some sort of banking fraud being detected because the data, which was fudged, was not adhering to this law. </p>
<p>It was also generalisable so that it didn't matter what base number system you used, the measurements would be distributed in an analagous way. </p>
<p>I've googled for various things trying to identify it but I just can't find it because I don't know the right name to search for. </p>
<p>I would like to read some more about this subject, so if anyone can tell me the magic terms to search for I'd be grateful, thanks!</p>
| 0non-cybersec
| Stackexchange | 240 | 972 |
Get byte array of file from filefield ExtJs. <p>Hello friends I have the following <code>filefield</code>:</p>
<pre><code>{
xtype:'filefield',
buttonText: 'choose',
buttonOnly: true,
listeners: {
change: function(fb, v) {
// ...
}
}
}
</code></pre>
<p>and I want to get the chosen file in a byte array</p>
<p>Please help me if you can.</p>
| 0non-cybersec
| Stackexchange | 133 | 391 |
TOC space after number always equal?. <p>There are already many questions here about the space after a number in a table of contents. <a href="https://tex.stackexchange.com/questions/123952/increasing-spacing-between-section-number-and-title-in-the-table-of-contents">This</a> one already displays the problem I am facing, but I don't like the solution provided.</p>
<p>What I'd like is all TOC texts after numbers to have the same distance to the numbers, instead of setting one static value for one level, which results in different distances, when the numbers begin to take more space, because of more digits. In other words, I would like the space after the TOC numbers to be always equal.</p>
<p>How can I achieve that?</p>
<p>Here is a tiny example of the wanted result:</p>
<pre><code>...
9. [space equal] TEXT
10. [space equal] TEXT
...
100. [space equal] TEXT
...
100000. [space equal] TEXT
</code></pre>
<p>Instead of the space varying the text moves further to the right, to allow the same space everywhere.</p>
<h1>Edits</h1>
<ul>
<li>I am using the book class.</li>
<li>My document does not have thousands of chapters, it is only an example to make the meaning even more obvious : ) A general solution to such a problem independent of the range of chapter /section / subsection / ... numbers would be great though, as I imagine there might be others who could want this in the future.</li>
</ul>
| 0non-cybersec
| Stackexchange | 394 | 1,421 |
Clarification regarding an exercise about primitive permutation group. <blockquote>
<p>Let <span class="math-container">$G$</span> be a transitive group of permutations of a set <span class="math-container">$X$</span> and <span class="math-container">$H$</span> the
stabiliser of an element <span class="math-container">$x\in X$</span>. Show the equivalence of the
following properties:</p>
<ol>
<li>Every subgroup of <span class="math-container">$H'$</span> of <span class="math-container">$G$</span> containing <span class="math-container">$H$</span> is equal to <span class="math-container">$H$</span> or <span class="math-container">$G$</span>.</li>
<li>Every subset <span class="math-container">$Y$</span> of <span class="math-container">$X$</span> such that, for all <span class="math-container">$g\in G$</span>, <span class="math-container">$gY$</span> is either contained in <span class="math-container">$Y$</span> or disjoint from <span class="math-container">$Y$</span>, is equal to <span class="math-container">$X$</span> or
consists of a single element.</li>
</ol>
</blockquote>
<p>Presumably this means that <span class="math-container">$G\leq\mathfrak{S}_{X}$</span> (<span class="math-container">$\mathfrak{S}_{X}$</span> is the symmetric group of <span class="math-container">$X$</span>) and that there exists an element <span class="math-container">$a\in X$</span> such that
<span class="math-container">$$\omega_a(G)=X,$$</span>
where <span class="math-container">$\omega_a$</span> is the orbital mapping defined by <span class="math-container">$a$</span>. I don't quite understand what the exact equivalence it is that I am asked to prove. Is it an equivalence between the following statements?</p>
<ol start="3">
<li><span class="math-container">$(\forall x)(x\in X\implies(\forall H')(H'\leq G\land\text{stab}(x)\subset H'\implies H'=\text{stab}(x)\lor H'=G))$</span>;</li>
<li><span class="math-container">$(\forall Y)(Y\subset X\land(\forall g)(g\in G\implies gY\subset Y\lor gY\cap Y=\emptyset)\implies Y=X\lor (\exists y)(Y=\{y\}))$</span>.</li>
</ol>
<p>Are <span class="math-container">$3,4$</span> correct translations of <span class="math-container">$1,2$</span>?</p>
| 0non-cybersec
| Stackexchange | 733 | 2,219 |
Git uninstalled by itself. What can cause that?. <p>I was installing the C++ packages for VS 2015 while looking for unused game folders to pass the time. Suddenly out of nowhere Git uninstalls itself! (the horror...)
Granted, I was actively deleting things, however they were 5kb empty folders, not the most important program on my machine.</p>
<p>I was not prompted by ANY dialog of "Are you sure?" or "Do you want to delete X?". Git uninstall window just popped out of nowhere and even task manager didn't manage to kill it.</p>
<p>My only guess is that maybe because one of the VS 2015 packages I chose to install (together with the C++ package) was Github integration to VS (to which I thought "hell why not") but it's hard for me to believe MS would just delete my Git without so much as a warning...</p>
<p>Edit: installer finished and this came up:</p>
<p><a href="https://i.stack.imgur.com/tjZAa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tjZAa.png" alt="enter image description here"></a></p>
| 0non-cybersec
| Stackexchange | 284 | 1,031 |
What does $y = Ar^t$ mean?. <p>I keep coming up in this question and its variants in my math tests, but it has not been explained to me so I can't really answer it. As such, I am at risk of failing the year.</p>
<p>An example question is as below:</p>
<blockquote>
<p>Bob bought a farm in 1980. In 2017 he sold it for $500,000 and calculated it rose exponentially at a rate of 4% over that time.</p>
<p>(i) Assuming that it increased in value according to the formula <span class="math-container">$y = Ar^t$</span>, where <span class="math-container">$A$</span> is the purchase price and <span class="math-container">$^t$</span> is the time in years, what was his profit?</p>
</blockquote>
<p>As you can see, the values of <span class="math-container">$A$</span> and <span class="math-container">$^t$</span> are pretty clearly defined, and <span class="math-container">$y$</span> is implicitly defined, but nowhere is the value <span class="math-container">$r$</span> defined.</p>
<p>So what is <span class="math-container">$r$</span> supposed to be, and how would I go about answering this question?</p>
| 0non-cybersec
| Stackexchange | 341 | 1,118 |
Location Selection Algorithm in Solar Engineering. <p>This is a practical problem in energy generation with heliostats.</p>
<p>We have a number of heliostats basically forming the shape of a doughnut. The facility needs to deploy hubs on those heliostats. One hub can support 12 harnesses (a kind of cable) and one harness can support 16 heliostats; namely, one hub can support 192 heliostats. The cost of deploying a hub and harness per meter are given. In other words, every harness starts from a hub and can connecting at most 16 heliostats. Deployment of a hub results in a cost. Also, the cost of harnesses result from its distance from the hub to the furthest heliostat on this harness. However, there is no distance from heliostats to its connecting harness. </p>
<p>Currently my approach is to use k-means to cluster the whole region and run greedy on distance from harness for each split region, though I do not think this is a good approach. </p>
<p><a href="https://i.stack.imgur.com/4ZFf8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4ZFf8.jpg" alt="enter image description here"></a></p>
<p>This is a pattern generated by my algorithm. As you can see, some harness only support 1 or 2 heliostats and result in a waste of harness. </p>
<p>Our job is to optimize the cost. In the end, the algorithm should return locations of hubs, harness topology patterns, and the total cost. </p>
<p>Can anyone enlighten me potential algorithms on this?</p>
<p>(Every point on the image is a heliostat, there are 40981 in total<a href="https://i.stack.imgur.com/roi28.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/roi28.jpg" alt="enter image description here"></a>)</p>
<p>----------- Updated 14/12/2016 -----------</p>
<p>More details on the question, thanks D.W's suggestion: </p>
<ol>
<li><p>Coordinates of heliostats are given. These coordinates correspond to real-world metrics (meters).</p></li>
<li><p>The placement of hubs are not constrained. However, one harness cannot be longer than 45 meters due to voltage requirement. </p></li>
</ol>
<p>----------- Updated 15/12/2016 -----------</p>
<ol>
<li>The classification on "furthest" in "the cost of harnesses result from its distance from the hub to the furthest heliostat on this harness": Furthest is in the sense of "last", not "furthest" in the sense of "having the largest Euclidean distance from the hub"</li>
</ol>
| 0non-cybersec
| Stackexchange | 694 | 2,433 |
Red color palette for gnuplot. <p>I am looking for a palette in gnuplot for red color from very-light-red to deep-red. I found a script for black here <a href="http://gnuplot.sourceforge.net/demo_5.3/pm3dcolors.16.gnu" rel="nofollow noreferrer">http://gnuplot.sourceforge.net/demo_5.3/pm3dcolors.16.gnu</a> </p>
<p>I tried by changing <code>set palette functions red, red, red</code> in the above script, but it is not working.</p>
| 0non-cybersec
| Stackexchange | 150 | 433 |
How is/can front- and backend be separated in Django?. <p>I am evaluating frameworks and I would like to understand Django's architecture better. </p>
<p>Coming form a Java background I developed components separately namely front and backend. More concretely for my backend I use Dropwizard and start a HTTP server. For the front end I use a nginx webserver with some forwarding to connected to my backend api via REST with Json objects. The front end is just plain html and a little JavaScript in vue.js. </p>
<p>Now I have been reading about Django's Model-Template-View concept. with a single page application and JavaScript a Web app can be deployed and so a separation of backend and frontend is given. </p>
<p>To my understanding this is a little to sparse. Could some please clarify? And could you develop in Django so that the front end is independent from the backend? and if yes using the stack above could you give some hints how this is accomplished? </p>
| 0non-cybersec
| Stackexchange | 229 | 976 |
Closure properties of undecidable languages. <p>I know that the decidable are close under: complementation, union, intersection and concatenation?</p>
<p>What about the undecidable languages? I think they are close under complementation, but not under concatenation, union and intersection. But I don't know how to prove it...</p>
<p>My prove</p>
<blockquote>
<p>"Lets say L is undecidable lang. Because L is undecidable lang we know
one of the following:</p>
<ol>
<li><p>there is a word w1 from L that there is no TM that stop for this
word</p></li>
<li><p>there is a word w2 in L that stopping in reject state in every TM</p></li>
<li><p>there is a word w3 Not from L that stopping in accept state in
every TM</p></li>
</ol>
<p>L' is the complementation lang of L</p>
<p>If 2, the word w2 that stopping in reject state, will stop in the
accept state for every TM, but w2 not in L' so L' is Undecidable.</p>
<p>If 3, the word w3 that stopping in accept state, will stop in the
reject state for every TM, but w2 is in L' so L' is Undecidable.</p>
<p>If 1, so all the TM are not stopping for w1 so L' is Undecidable???? "</p>
</blockquote>
| 0non-cybersec
| Stackexchange | 388 | 1,190 |
BSC channel probability, (binary symmetric channel). <p>I have question regarding the binary symmetric channel (BSC), which assume each channel use is indepedent (i.e, if you send a '0', then you send '1', each time you send it is indepedent of others). Basically, the model of BSC is depicted as below. </p>
<p><img src="https://i.stack.imgur.com/HOjDl.png" alt="enter image description here"></p>
<p>Assume we use repetition of length 3, i.e, if we want to send '0', we actually send '000'; if we want to send '1', we actually send '111'. </p>
<p><strong>Question 1). Given Bob receive '000', what is the probability that Alice send is '1'?
Question 2) What happen if we don't use repetition? I.e, we want to send '1', and we actually send a '1' instead of '111'. Given Bob receive 000, what is the probaiblity Alice send '111'?</strong></p>
<p>I got stuck on the second question. I think I have problem calculating $P(B=000)$ using the total probability theorem.</p>
<hr>
<p>Attempt:</p>
<p>Question #1.
$P(A=1|B=000)=P(B=000|A=111)*P(A=111)/ P(B=000)$</p>
<p>On the other hand, $P(B=000)=P(B=000|A=111)*P(A=111)+P(B=000|A=000)*P(A=000)$
using independence, we have $P(B=000)=P(B=0|A=1)^3*P(A=1)^3+P(B=0|A=0)^3*P(A=0)^3$</p>
<p>and all we need to do is to plug in $p$ into $P(B=0|A=1)$ and $P(B=1|A=0)$ into the equations.</p>
<hr>
<p>Update 2:</p>
<p>For Case1: $P(B=000)=P(B=000|A=111)*P(A=111)+P(B=000|A=000)*P(A=000)$</p>
<p>However, for Case2:</p>
<p>$P(B=000)=P(B=000|A=000)*P(A=000)+P(B=000|A=001)*P(A=001)+P(B=000|A=010)*P(A=010).... +P(B=000|A=111)*P(A=111)$</p>
| 0non-cybersec
| Stackexchange | 661 | 1,591 |
PHP include absolute path. <p>I have a variable on my site called $basePath which is set as:</p>
<pre><code>$basePath = '/Systems/dgw/';
</code></pre>
<p>I am using it on all my css, js and images tags as so (shortened for better visibility):</p>
<pre><code><link href="<?php echo $basePath; ?>include/assets/css/bootstrap.min.css">
</code></pre>
<p>I have no problem with those includes and they work fine in wherever file and in whatever folder I am.</p>
<p>I have a certain included page which has the following line:</p>
<pre><code><img src="<?php echo $basePath; ?>images/new_logo.png" alt="logo"/>
</code></pre>
<p>And the image shows just fine. The line after it states:</p>
<pre><code><?php include($basePath.'include/assets/common/topMessages.php');?>
</code></pre>
<p>But the include doesn't happens. When I try it like this:</p>
<pre><code><?php include('../../include/assets/common/topMessages.php');?>
</code></pre>
<p>It works.</p>
<p>Anybody has any idea what could be wrong?</p>
| 0non-cybersec
| Stackexchange | 365 | 1,043 |
On a semiconductor chip, what state (on/off or read/write) corresponds to conducting or insulating behavior?. <p>My textbook has a brief explanation of how semiconductors are used in modern computer chips because they can be made to conduct (by applying enough voltage to excite electrons across the band gap) or to insulate (by dropping the voltage to a lower level or shutting it off entirely) and this conditional, binary state can be used as an 'on/off' logic gate.</p>
<p>In modern computer systems, which state is "on" and which is "off"? In other words, is it the case that when we increase the voltage to cause conductance in the semiconductor that we have a "1" value and that when we drop the voltage down, we have a "0" value, or is it the other way around?</p>
<p>Or is it more appropriate to say "read" vs "write"?</p>
<p>Does the on/off or read/write state vary from one manufacturer to another? Or from one type of memory to another? I.e. does DDR SDRAM use conducting as "on" and insulating as "off" while other forms do it the other way around?</p>
<p>P.S. If comp sci isn't the right SE, please could you advise a better SE for this question?</p>
| 0non-cybersec
| Stackexchange | 303 | 1,169 |
Get service name from it's PID (powershell). <p>I am having trouble solving a minor issue. So for processes, I can store its name from its $PID using the following line:</p>
<blockquote>
<p>$process_name=get-Process -id $PID |select -expand name</p>
</blockquote>
<p>However, I want to run the process as a <strong>service</strong>. I want to complete the same operation, that is: store the service's name e.g. [service_name].exe into a variable $service_name.</p>
<p>The reason for this is because I want to have just one .ps1 file, that I can then turn into multiple services that uses its own .exe.config files. So that just one .ps1 file can be compiled multiple times into services such as </p>
<p>[service1.exe, service2.exe, service3.exe, ...] </p>
<p>and each service uses its corresponding .exe.config file such as </p>
<p>[service1.exe.config, service2.exe.config, service3.exe.config, ...]</p>
<p>Is there any way to do this with powershell?</p>
| 0non-cybersec
| Stackexchange | 299 | 970 |
[Update] I [23F] am going into business with my ex [24M], some weeks I see him more than my bf [25M]. [OP](http://www.reddit.com/r/relationships/comments/2zqh2t/i_23f_am_going_into_business_with_my_ex_24m_some/)
I love update posts so I thought I'd give an update.
The day after I posted, I saw my ex to go over our pitch. I was feeling very on-edge because of all the negative feedback I received. I told him that it was hard to balance the business and my relationship, and he understood. Me, him, and our third co-founder are all trying to get our work-life balance together.
Later in the day I saw my bf and I told him everything I'd been thinking about. I told him I wanted to have a conversation about something, which freaked him the fuck out. I said that I wanted to make sure he was a priority and with all the time I was spending on my business, I was concerned he might feel like I wasn't spending enough time on us. He actually laughed out loud at the idea: he's really enjoyed seeing me throw myself into something. I pushed a bit further and brought up the fact that I was working closely with my ex. (I even told him about my post here and the criticisms I'd received.) He understood that it was an unusual situation, and he had been concerned about my friendship with my ex at first. When they met, however, my bf was able to see that there is no sexual or romantic tension between my ex and I. So to my bf, the ex is really just another guy.
We got into an enlightening conversation about my relationship with my ex. My boyfriend (who usually doesn't want to talk about past relationships) was really curious why he wasn't bothered by my working so closely with my ex (which he answered himself: the relationship lacks any sexual energy), then was interested in how I could have been in a relationship without there being lingering romantic (or hurt) feelings. We explored that a bit (I think he felt like he was cracking a psychological puzzle) and I could tell my boyfriend felt completely and totally secure about us. He deeply appreciated that I brought up the issue at all, and I'm glad I now know he's not harboring secret fears. That night we worked a bit on my pitch and he helped me analyze some market research, which he was really interested in. In all: lots of support and good vibes.
Since then, the really busy period for my startup has passed and I've been able to spend more time with my bf. He still has doubts about me being over-committed and stressed, but he (and my parents + therapist) acknowledge that having an outlet for my ambition is a really good thing. (Before this, I was very depressed about my deadend toxic day job, which I'm still trying to leave.)
**TL;DR**: Seems like a weird situation to outsiders but everything was just peachy! | 0non-cybersec
| Reddit | 664 | 2,794 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
How to reset Ubuntu's Keyboard Media Short Cut back to Default. <p>While testing the media keyboard shortcuts for various players, I change the hotkeys to keystrokes. Now I'm trying to get them back to the defaults.</p>
<p>The prompt shows options for either setting a new key by hitting the keystroke, or to clear the setting by hitting the backspace. I don't see an option to change it to the default.</p>
<p>The defaults have words, for instance the <strong>Play (or play/pause)</strong> has the words, <strong>Audio play</strong> and the <strong>Pause playback</strong> has the words <strong>Audio pause</strong>.</p>
<p>I'm trying to get the default settings back where it has the words. Some of the media apps don't work well with the keystrokes I have assigned.</p>
| 0non-cybersec
| Stackexchange | 210 | 783 |
Show that the Gaussian binomial coefficient is a symmetric polynomial. <blockquote>
<p>Deduce that ${{n} \brack {k}}_{q}$ is a symmetric polynomial of $q$, that is, if
\begin{equation*}
{{n}\brack {k}}_{q} = a_0 + a_1q + a_2q^2 + \ldots + a_Nq^N
\end{equation*}
with $a_N \neq 0$, then $a_i = a_{N-i}$ for all $i$.</p>
</blockquote>
<p>I'm having trouble proving this. Is this simply by symmetry of the Gaussian binomial coefficient (${n \brack k} = {n \brack n-k}$)?</p>
| 0non-cybersec
| Stackexchange | 177 | 491 |
Headphone no sound in Windows 7. <p>It worked fine for two years, but the Windows 7 on my laptop no longer plays sound through headphones. When plugged in, the speakers stop (I've read that some people's speakers play instead of headphones, but not the case with mine). Everything works fine on my Ubuntu partition of the same laptop.</p>
<p>Here are pictures of the "Sound" window</p>
<p>headphones not plugged in:</p>
<p><img src="https://i.stack.imgur.com/w0Xo5.png" alt="enter image description here"></p>
<p>plugged in:</p>
<p><img src="https://i.stack.imgur.com/QuL4u.png" alt="enter image description here"></p>
| 0non-cybersec
| Stackexchange | 189 | 626 |
On the Continuum Hypothesis. <p>Let me start out by saying that I am not a mathematician. I read an article over at <a href="http://www.scientificamerican.com/article.cfm?id=infinity-logic-law">Scientific American</a> that discussed the <a href="http://en.wikipedia.org/wiki/Continuum_hypothesis">Continuum Hypothesis</a>. I developed the following thought experiment that would seem to prove the theory true, but as far as I know it is unprovable. Thus here I am asking for your help.</p>
<ol>
<li>Start with the set of all integers $(-\infty,...,-1,0,1,...,\infty)$</li>
<li>This set can be considered 1-dimensional in that for each position in the set, there is only one possible number</li>
<li>Consider adding an additional dimension to the set that has only one possible value (0): $(<-\infty;\ 0>,...,<-1;\ 0>, <0;\ 0>, <1;\ 0>,...,<\infty; 0>)$</li>
<li>Clearly this set has the same cardinality as the integers as there is a clear mapping between them</li>
<li>Now consider having two values instead of one (0 and 5), and let's represent everything in the second dimension a decimal whose value is added to the first number</li>
<li>This makes the set $(<-\infty;\ 0;\ 5>,...,<-1;\ 0;\ 5>, <0;\ 0;\ 5>, <1;\ 0;\ 5>,...,<\infty; 0;\ 5>)$, which can be expanded to $(-\infty,...,-1.0, -0.5, 0.0, 0.5, 1.0, 1.5,...,\infty)$</li>
<li>This new set still has the same cardinality as the set of all integers since each number can be mapped directly to an integer</li>
<li>This property of the set's cardinality should continue as more numbers are added to the set, up until the point that infinitely many numbers are added</li>
<li>Once there are infinitely number of numbers added to the second dimension (sequentially), then the mapping to the integers cannot be performed because the infinite size and the maximal density (all integers from 0 to $\infty$)</li>
<li>This final set would be expanded to be exactly the same as the real numbers, and would seem to indicate that it is impossible to have a cardinality between the integers and real numbers</li>
</ol>
<p>I guess it comes down to statement #9. It seems to me that it's most important that this set of numbers includes every combination of numbers from 0 to $\infty$ to ensure that the irrational numbers would be included.</p>
| 0non-cybersec
| Stackexchange | 663 | 2,355 |
qemu -cdrom ubuntu.iso -boot d -m 1024 -curses. <p>How do I disable frame buffers in Ubuntu 13.10 Saucy kernel,
I tried all kinds of kernel parameters but none work?</p>
<pre><code>DEFAULT ramdisk
LABEL ramdisk
kernel /casper/vmlinuz
append boot=casper toram initrd=/casper/initrd.img -- vesafb.nonsense=1
LABEL isotest
kernel /casper/vmlinuz
append boot=casper integrity-check initrd=/casper/initrd.img -- vesafb.nonsense=1
LABEL memtest
kernel /install/memtest
append -
DISPLAY isolinux.txt
TIMEOUT 300
PROMPT 1
</code></pre>
| 0non-cybersec
| Stackexchange | 189 | 541 |
New Stonemaier game Pendulum.
In **Pendulum**, each player is a powerful, unique noble vying to succeed the Timeless King as the true ruler of Dünya. Players command their workers, execute stratagems, and expand the provinces in their domain in real time to gain resources and move up the 4 victory tracks: power, prestige, popularity, and legendary achievement.
Players must use actual time as a resource in managing their strategy to best their opponents, using time on different action types and balancing it with time spent planning and analyzing. The winner will be the player who manages and invests their time most effectively and who builds the best engine, not the player who acts the quickest.
Pendulum is the highest-rated protoype in the history of the Stonemaier Games Design Day. If you enjoy Tzolk’in (time and resource optimization) and 7 Wonders (simultaneous play), we think you’ll enjoy Pendulum. Please join us in the [Pendulum Facebook group](https://www.facebook.com/groups/pendulumboardgame/) to discuss the game!
​
[https://stonemaiergames.com/games/pendulum/](https://stonemaiergames.com/games/pendulum/) | 0non-cybersec
| Reddit | 282 | 1,144 |
Announcement: Official /r/photography Discord Server. Hello, all!
Recently there have been more than a few people asking if there is a place to hang out and chat about photography, and while we have a Slack and an IRC, many were more interested in a Discord alternative.
Now you can join us at [this link!](https://discord.gg/GJZTp9s)
Note: to help curtail spam, you have to ask the moderators in the Requests channel for the @photographer role before you can access the usual channels.
Have fun! | 0non-cybersec
| Reddit | 134 | 500 |
You don't want to visit Death Valley in winter.. Trust me, I did. And what I saw there shook me and stayed with me, and I’m saying that literally. It was the first time I got what I like to call a “blemish”. That’s what happens when a part of me is stained forever.
But before I get to that, who even *wants* to visit Death Valley in winter? The only thing it’s famous for is being so damn hot, I can’t imagine anyone making plans to go in, say, December of a given year. I mean you’d have to be bonkers.
Enter my mom, who in the middle of December, on a Friday evening, sprung it on my dad and I that we’d be taking a family trip that weekend to, you guessed it, Death Valley. Now mind you, I didn’t know a damn thing about Death Valley, and my dad probably did, but he’d learned over the years not to poopoo ideas my mom was enthusiastic about.
And also understand that this wasn’t a normal family outing. I was 13, [my boyfriend had just died](https://www.reddit.com/r/nosleep/comments/amshmn/my_first_boyfriend_and_the_thing_that_killed_him/), and even though you might think that I should be the one taking it the hardest, my mom was falling apart over the whole ordeal. I can’t say if she was falling apart in earnest, or if the news gave her an outlet to fall apart-- even to feign falling apart. My mom’s complicated, and as cynical as it sounds, I wouldn’t put it past her to capitalize on something like that…
But if there’s proof that it was truly grief, then this trip was it. It seemed as if she didn’t know what to do with herself, and the idea of being with me over yet another weekend, where all I did was stay at home depressed, was probably too much for her. *I have to get her out of the house*, she must have been thinking, *And get her mind off everything*.
Well, it worked, but for all the wrong reasons. We got in the car early Saturday and headed on over. I’ll spare you the many cringy pains I went through on that car-ride, but let me say that there was palpable irony in the fact that in order to ostensibly get me out of the house we ended up spending hours stuck in the car, which was not much larger on the inside than a small closet.
And of course, as you guessed, we discovered some things rather quickly. One: my mom did not know anything about Death Valley before she got there. How does that happen? Don’t ask me. She expressed great dismay that there was nothing to do there, and that the main reason to go was to experience the summer heat. When the employee and the information center clarified that December tends to be one of the slower months for tourism, my mom’s anxiety rose even moreso.
“Heat heat heat, that’s all I’m hearing!” she finally interrupted, flailing her arms melodramatically, “Tell me what we can do *now!*”
She snatched randomly at a pamphlet below the counter, and she just so happened to pull up the worst possible one.
“Badwater Basin-- what is that?” she demanded.
The employee told us it was the lowest geological point in North America. A giant concave dimple on the earth, in other words, and that it was a popular tourist destination that was open, even in December. He was a really polite worker, and I felt horrible that my mom was plastering her frustration all over him. He had a nice, mellow brownish aura, and with each exasperated question my mom delivered I saw it get rattled, like a lake of still water that’s getting pebbles thrown into it.
Without much more than a hasty goodbye, my mom snatched me by the hand and headed for the car. My dad-- my poor dad!-- gave a quick apology to the employee and trailed behind. I can’t imagine their relationship, to be honest, my mom and dad. He always seems like he’s along for the ride, and he’s such a sweet dad, always in good spirits. I would die if I had to live like that, and yet as long as I can remember he had this kind of zen attitude about the whole thing. But look at me, I’m getting way off track…
Let me make clear that I had no interest in seeing Badwater Basin. To me, it sounded like a big hole in the ground. Not even a hole, really, just a big, well, dimple. I mean, I can picture that just fine without the several-hour drive. But there we were, about a mile out, heading straight for it.
And this is when shit got weird, because while I was used to my special gift of seeing other people’s auras, I wasn’t used to seeing auras just floating around completely unattached to human beings.
But even a mile out, as my dad turned to me and said “Just up ahead, honey,” and I looked through the front windshield, I saw some swirling trails of auras off in the distance.
“I’ll bet it’s packed with people,” I said.
“I doubt it, honey. That information center was empty,” my dad responded in his characteristically mellow tone, “But who knows.”
It wasn’t until we reached the parking lot that I realized for sure that something wasn’t right. Not a single car parked anywhere, and yet the trails of auras that floated up out of the basin suggested there must have been a zillion people down there. We parked and I was the first out of the car.
“I can’t wait to see it!” I said quickly, prying the door open in a haste and bolting from the car. Mom and dad thought somehow I’d gotten an instantaneous urge for geology, but in truth my curiosity was piqued by these colorful spouts and swirls of auras that wafted just over the basin.
But as I reached the edge of the parking lot and looked down into the basin, I was dismayed to find not another human being down there. On the contrary, what I saw was a sea of multi-colored auras, like a giant slush that swirled and ebbed and flowed. It was like a lake, steaming some trails up into the air, and none of it made a shred of sense to me.
“Come on honey, let’s get down there,” my dad said, behind me. Apparently they’d caught up to where I was already.
“Honey?” he asked again, somewhat disconcerted.
“She’s been like this for twenty minutes!” my mom’s exasperated voice shrieked.
I snapped my head back, surprised.
“Addy, are you alright?” my father asked, putting his hand on my shoulder.
Twenty minutes? Was that true? It felt like I’d just glanced at that ominous lake for a second. I knew my mom exaggerated all the time, but let’s say she did: twenty minutes in mom time was at least still ten minutes. Had I really tranced out for ten minutes? It felt like I'd just looked at it for a second...
“I’m fine!” I said back cheerfully. No need to worry them, I figured, and there was no way to explain what was bothering me anyway. They'd just have thought I'd gone crazy. Or crazier, depending on which of the two you asked.
“Great, let’s go down and check it out,” my dad said again, patting me on the back.
Down *there*, I thought? That’s the last place I wanted to be. All my experiences with colorful auras have spelled disaster for me, and this looked like a veritable smorgasbord of crap that I had no intention of walking into.
“I’ll… uh, I’ll stay here a little while,” I said after a moment.
“Suit yourself,” my dad said cheerfully, “I’ll go make sure there aren’t any monsters down there, how about that?”
My God, the irony was overwhelming.
My parents made their way down into the basin, and with each step further down I saw the swirl get disturbed more and more. It was like they were wading into a shallow-water pool that moved as if it was in low gravity. Each step disturbed it more, and kicked up more auras that now revealed themselves to be quite brilliant in color. At the bottom of all those auras, strange, bright letters appeared, so strange that the first impulse I had was to write it down as best I could:
pahimooyüntü sümüttüm ma to’engkünna
What it meant I had no idea, but the letters glimmered in bright bands and seemed to be themselves auras, just constrained into letters. They were covered up mostly, but my parents kicking up the swirl of auras revealed them to me.
Also, by this point in my life I realized auras were a lot like reptiles. The most beautiful ones were likely to kill you if you got close. But what I didn’t ever see was an aura without a human, and the thought alone gave me grave concerns.
“Come on in honey,” my dad now yelled from the middle of the basin, “The water’s fine!”
It was as if even without my gift of seeing auras, he was accidentally making dad-jokes. Meta-dad-jokes: the next frontier of driving your kids crazy.
“Just let her be!” my mom shushed him quickly, “She’s going through a lot!”
He shrugged his shoulders, and kicked around at the ground as he stood there.
What I saw next, I’d never seen before. The auras down by his feet started to swirl with much more energy, specifically around him. They passed through my mom like she wasn’t even there.
And in their swirling they climbed up, higher and higher, around his legs. I wanted to scream for him to get out, but at the same time I’d been on my best behavior so that my parents didn’t think I was going nuts from the stress of my boyfriend’s death. I hesitated, and it was as if the pool of auras sensed that immediately, because within a second at most they’d suddenly enveloped my dad entirely.
“Jim?” my mom shrieked, “Jim!”
My dad, who now I only saw as a silhouette of various colors, collapsed abruptly. While my mom saw none of this, she did see him fall over and immediately rushed to his side, and without another thought I ran as fast as I could toward him. The lettering disappeared completely, but under my feet as I ran I saw new letters came up all around me:
ünnü
Running into that pool of auras isn’t anything I’d have done in any other circumstance, but it’s one of those things, when you see someone you love in danger. I almost forgot they were there. As I ran in I felt chills along my body as they lapped up against me, but I got hold of my dad and I told my mom we had to pull him to the car. We hoisted him up and with one of us under each arm, we half-dragged half-hobbled him away from the basin. With each step out of there I felt the chills subsiding, and once he was in the car he started to come to.
“Where am I?” he mumbled incoherently.
Before I could answer my mom had started the car and slammed on the gas. We got to the nearest hospital in what I assume must have been record time, but after many hours of waiting we discovered nothing wrong with him. The doctors assumed, based on what my mom had told him, that he’d had a panic attack.
My dad, a panic attack. How absurd, I thought. He was the most mellow person I knew. But for my mom, the thought gave her pause. My boyfriend dying, everyone being on edge, and my dad was the rock that kept it together. No matter how down I was, or how frantic my mom became in the weeks and months after Billy died, he was always something we could lean on. And one thing is true for all rocks, my mom now realized: even the hardest ones break under enough pressure.
It was late by the time we finished at the hospital, and my mom decided to get a hotel for the night rather than to deal with the several-hour car ride. We checked in at a little place just next to Badwater Basin for the night, and my dad by this point was more or less back to himself, though fatigued.
But for me, there was something more sinister at play. My mom and dad have regular, healthy, benign auras; my dad’s is richly yellow, like a sun, and my mom’s is a more muddled yellow-brown. But as we sat there in the hotel room, I saw my dad’s aura on full display, and right by his chest, over where his heart would have been, there was a little round blotch on his aura that was solid lilac. It pulsed the way a heart pulses, and it scared the shit out of me. I wondered if it had to do with the lettering I'd seen at the basin earlier, and while I couldn't pull out my notebook and start researching in front of my parents, I did intend to do that as soon as I possibly could, because whatever was stuck on my dad's chest, completely unknown to him but almost blinding to me, needed to get away.
And I knew it could have only come from the basin, and I had a feeling deep in my gut that it would grow and destroy him. Lilac was the one color I’d figured out by that point, and everything about it was malevolent, malicious, and dangerous. And I knew that that night, when everyone had gone to sleep, I would need to sneak out of that hotel room and get back to that basin and face whatever was in there, or at the very least understand it, so that I could get this damn thing away from my dad for good.
Because the only reason any of us were here was because of me-- because of how much they wanted me to get my mind off Billy’s death. And now here we were, my dad poisoned and my mom frantic, and a pool in a basin that only I could see was threatening the only good man I had left in my life. I waited for everyone to sleep, and then I left that hotel to face the unknown that swirled and pooled just a ways down the road.
​
[Part 2 (final) part here.](https://www.reddit.com/r/nosleep/comments/asdbrc/you_dont_want_to_visit_death_valley_in_winter_the/)
​
​ | 0non-cybersec
| Reddit | 3,341 | 13,098 |
Can't get rid of Google's pagespeed insights warnings (the website has a blocking css). <p>When checking my website on Google's page-speed insights, it gives me alert, that the website has a blocking css: <a href="https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fwoohoocasino.com%2F&tab=mobile" rel="nofollow noreferrer">Google pagespeed insights</a>. This is the code I have:</p>
<pre><code><head>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
</head>
</code></pre>
<p>I tried to move it into the body, right before <code></body></code>, but it didn't help, it even reduced the points. What can be done to solve this issue? Thanks.</p>
| 0non-cybersec
| Stackexchange | 251 | 746 |
What is the difference between `->>` and `->` in Postgres SQL?. <p>What is the difference between <code>->></code> and <code>-></code> in SQL?</p>
<p>In this thread (<a href="https://stackoverflow.com/questions/19422233/check-if-field-exists-in-json-type-column-postgresql">Check if field exists in json type column postgresql</a>), the answerer basically recommends using,</p>
<pre><code>json->'attribute' is not null
</code></pre>
<p>instead of,</p>
<pre><code>json->>'attribute' is not null
</code></pre>
<p>Why use a single arrow instead of a double arrow? In my limited experience, both do the same thing.</p>
| 0non-cybersec
| Stackexchange | 222 | 647 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
Binding eigenvalue properties with normal operators. <p>Let $N$ be a <strong>normal</strong> transformation over $\Bbb C$.</p>
<p>A) True/False:$$N = N^* \Leftarrow\Rightarrow \lambda \in \Bbb R$$
(where $\lambda$ is any eigenvalue of $N$)</p>
<p>B) True/False:$$N^* = N^{-1} \Leftarrow\Rightarrow |\lambda|=1$$
(where $\lambda$ is any eigenvalue of $N$)</p>
<hr>
<p>In both cases, I am able to prove the direction $\Rightarrow$ quite easily.
but in the other direction i am having a struggle (perhaps its false?).</p>
<p>for ex. statement B: I thought of showing that since $N$ is normal, then it is diagonalizable, therefore $N^*$ is also diagonalizable with the conjugate eigenvalues on its diagonal, therefore for any $\lambda = (a+bi)$ then $NN^*$ has $(a+bi)(a-bi)$ on its diagonal, which is the identity matrix (since $|\lambda|=1$) and therefore $N$ is unitary, but i'm not sure my transitions are valid.</p>
<p>Anyway, any help much appreciated on both statements!</p>
| 0non-cybersec
| Stackexchange | 295 | 984 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
How to format numbers as strings (1k, 2M...) without rounding up in python?. <p>I'm trying to round floor to <code>int</code> or to <code>1 decimal</code> for non-zero <code>float</code> with letters <code>k, M, B...</code>.</p>
<pre><code>def human_format(num):
num = float(f'{num:.3g}')
magnitude = 0
while abs(num) >= 1000:
magnitude += 1
num /= 1000.0
num = int(num * 10) / 10
return f"{f'{num:f}'.rstrip('0').rstrip('.')}{['', 'k', 'M', 'B', 'T'][magnitude]}"
</code></pre>
<p>Now this function returns as expected in this case:</p>
<pre><code>human_format(1294)
'1.2k'
</code></pre>
<p>And rounds up in the case below:</p>
<pre><code>human_format(1295)
'1.3k'
</code></pre>
<p>The rounding happens due to the flag <code>g</code> in string format and I don't know how to tune it.
How can I avoid rounding up, keeping everything else the same?</p>
| 0non-cybersec
| Stackexchange | 335 | 879 |
What is the correct way to solve $|2K^3-2K^4|$ determinant?. <blockquote>
<p>Given -
$$K_{3\times3} = \begin{bmatrix} 1&1&1 \\ 3&2&1 \\ 1&2&1 \end{bmatrix}$$
$$|K| = 2$$
Find -
$$|2K^3-2K^4|$$</p>
</blockquote>
<p>I tried this:</p>
<p>Since $|A+B|=|A|+|B|$ ( <strong>$\Leftarrow$ This is the main mistake</strong> ) -
$$|2K^3-2K^4|=|2K^3+(-2K^4)|=|2K^3|+|(-2K^4)|$$</p>
<p>Now using $|\alpha A_{n\times n}|=\alpha ^n|A|$ -
$$=2^3|K^3|+(-2^4)(K^4)|=8*8+(-16)*16=-192$$</p>
| 0non-cybersec
| Stackexchange | 270 | 510 |
Appending a template string. <p>Is it possible to append a template string to a div? I'm trying to optimise my code and currently my code is having to create element, add classes, add a text node and then append all together. I was wondering if its possible to just create a template string and then append that, to be more efficient? I don't want to wipe out the current div's html with innerHTML.</p>
<pre><code>socket.on('coinFlip', (result) => {
const messages = document.querySelector('#messages');
const output = `<li class="message broadcast">${result.result}</li>`;
messages.appendChild(output);
});
</code></pre>
<p>Current code that works is:</p>
<pre><code>socket.on('coinFlip', (result) => {
// Grab dialog box
const messages = document.querySelector('#messages');
// Render messages
const li = document.createElement('li');
li.className = "message broadcast";
const text = document.createTextNode(`${result.result}`);
li.appendChild(text);
messages.appendChild(li);
});
</code></pre>
| 0non-cybersec
| Stackexchange | 300 | 1,068 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
Could you recommend a few guides for someone with
zero experience?. My girlfriend is getting really interested in drawing again for the first time since elementary school, and needs some help with technique and simple anatomy. I've search around this subreddit, but all of the advice I have been able to find looks too advanced. What books and authors would you reccomend she check out?
I have a few Imgur albums of her drawings, if you wish to get an idea of her skill level:
http://imgur.com/a/zVAaK
http://imgur.com/a/QGCRa
Thanks for your help, [/r/drawing](/r/drawing)
EDIT: Those drawings are all based on the comic ["Homestuck"](http://mspaintadventures.com/).
EDIT 2: I'm sorry if this is in the wrong place, I'll move it if it is. | 0non-cybersec
| Reddit | 209 | 747 |
Cookies in IdentityServer4. <p>Can someone explain the purpose of the cookies which are sent to the user browser after successful login in Identity Server4. Also I have three smaller related questions at the bottom.</p>
<p>The client is using cookie middleware in ASP.NET Core defined in the <strong>Startup.cs</strong> file.</p>
<pre><code>app.UseCookieAuthentication()
</code></pre>
<p>It's quite obvious which tokens Identity Server created and which cookies the ASP.NET Core middleware creates, but I'm not sure what content each cookie containts.</p>
<p>ASP.NET Core middleware decided to create chunked cookies probably due to the cookie size (4050B + 865B).</p>
<p>I have been trying to find a way of decrypting the cookies to read the values using the <a href="https://docs.asp.net/en/latest/security/data-protection/index.html" rel="noreferrer">Data Protection</a> API provided by ASP.NET Core without any luck.</p>
<ul>
<li>idsvr</li>
<li>idsvr.session</li>
<li>.AspNetCore.coookie</li>
<li>.AspNetCore.coookieC1</li>
<li>.AspNetCore.coookieC2</li>
<li>.AspNetCore.Antiforgery.</li>
</ul>
<p><a href="https://i.stack.imgur.com/5IdbA.png" rel="noreferrer"><img src="https://i.stack.imgur.com/5IdbA.png" alt="Screenshot from developer tools in Internet Explorer"></a></p>
<ol>
<li>Which cookie contains the id_token, access_token issued by Identity Server?</li>
<li>CookieName can be used to change the name of the cookie created by ASP.NET Core middleware, should different clients share same cookie name or do they need to have separate session cookies?</li>
<li>Can the Identity Server cookies be decrypted by using the <a href="https://docs.asp.net/en/latest/security/data-protection/index.html" rel="noreferrer">Data Protection</a> API?</li>
</ol>
| 0non-cybersec
| Stackexchange | 541 | 1,769 |
Detect possible WIFI leechers?. <p>If someone is leeching of your WIFI router, would you typically be able to detect this by looking at the connected IP addresses (association list) in the routers admin environment?</p>
<p>I've configured my WIFI router to: </p>
<ul>
<li>use a strong WPA2 PSK key </li>
<li>only allow 3 MAC-addresses</li>
<li>let the firewall drop all LAN to WAN packets except from 3 IP-addresses</li>
</ul>
<p>But still I experience a slow connection. Even the ping to the router is very slow. This is probably due to something else than somebody leeching. But still, considering the above security measures, would a leecher typically show up in the association list if there would be one?</p>
<p>I'm using a <code>ZyXEL P-2602HW-D1A</code> router by the way.</p>
| 0non-cybersec
| Stackexchange | 241 | 789 |
Unfilled grey area for fncychap and bjornstrup option. <p>I use <code>fncychap</code> and the option <code>Bjornstrup</code> in the following MWE:</p>
<pre><code>\documentclass[pdftex,10pt,b5paper,twoside]{book}
\usepackage[lmargin=25mm,rmargin=25mm,tmargin=27mm,bmargin=30mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\addto\captionsenglish{\renewcommand{\figurename}{Fig.}} %rename the caption of figures
% \addto\captionsenglish{\renewcommand*\contentsname{Table of Contents}} %rename the table of contents
\usepackage{setspace}
\usepackage{amssymb}
\usepackage{mathrsfs}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{gensymb} % for \degree
\usepackage{siunitx} %For SI-enheter
\usepackage{wrapfig}%tabell
\usepackage{multicol} % enables sizing of table
\usepackage{hhline}%multirowtabell
\usepackage{tabularx}
\usepackage{threeparttable} % environment to handle notes in table
\usepackage{multirow, boldline, booktabs}
\usepackage[table,xcdraw]{xcolor} %extended colours and for the use in tables
\definecolor{steelBlue}{RGB}{70,130,180}
\definecolor{tableGrey}{HTML}{EFEFEF}
\usepackage{array,float}
\usepackage{cellspace}
\setlength\cellspacetoplimit{4pt}
\setlength\cellspacebottomlimit{4pt}
\usepackage{adjustbox}
\usepackage{efbox,graphicx} %should be loaded after color package because of define color
\efboxsetup{linecolor=steelBlue,linewidth=0.5pt}
\usepackage[Bjornstrup]{fncychap}
%[Bjornstrup]{fncychap} - Chapters are printed with surrounding shaded box
\usepackage[pdftex,bookmarks=true]{hyperref}
\definecolor{dgreen}{RGB}{0,150,0}
\definecolor{dblue}{RGB}{0,0,180}
\hypersetup{
colorlinks=true,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=blue,
}
%Add prefix to hyperref
\addto\extrasenglish{%
\def\subsubsectionautorefname{}%
\def\subsectionautorefname{}%
\def\figureautorefname{Fig.}%
\def\tableautorefname{Table}%
\def\subsectionautorefname{Subsection}%
\def\sectionautorefname{Section}%
\def\chapterautorefname{Chapter}%
\def\Appendixautorefname{Appendix}%
\def\algorithmautorefname{Algorithm}%
}
%\newcommand*{\appendixautorefname}{Appendix}
\usepackage[font=small,labelfont=bf]{caption}
\usepackage{subcaption}
\usepackage{fancyhdr}
\usepackage{times}
\usepackage{natbib}
\bibliographystyle{elsarticle-harv}
\setcitestyle{authoryear,open={(},close={)},aysep{,}}
%plainnat
%abbrvnat
%babunsrt
%agsm - Harvard
%humannat
%apalike - Harvard without URLlinks
\usepackage{pdfpages}
\usepackage[intoc]{nomencl} %Note: needs to come before babelbib
\makenomenclature
\setlength{\nomlabelwidth}{1.75cm}
% \renewcommand{\nomname}{Abbreviations}
% \renewcommand{\nompreamble}{The next list describes several symbols that will be later used within the body of the document}
\usepackage{etoolbox}
\renewcommand\nomgroup[1]{%
\item[\bfseries
\ifstrequal{#1}{A}{Abbreviations}{%
\ifstrequal{#1}{S}{Symbols}}%
]}
\usepackage{appendix}
\usepackage[section]{placeins}
\usepackage{algpseudocode,algorithm,algorithmicx}
\newcommand*\Let[2]{\State #1 $\gets$ #2}
\algrenewcommand\algorithmicrequire{\textbf{Precondition:}}
\algrenewcommand\algorithmicensure{\textbf{Postcondition:}}
\newcommand{\overbar}[1]{\mkern 1.5mu\overline{\mkern-1.5mu#1\mkern-1.5mu}\mkern 1.5mu}
\newcommand{\mybar}[1]{\makebox[0pt]{$\phantom{#1}\overline{\phantom{#1}}$}#1}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter.\ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\renewcommand{\headrulewidth}{0.1ex}
\renewcommand{\footrulewidth}{0.1ex}
\fancypagestyle{plain}{\fancyhf{}\fancyfoot[LE,RO]{\thepage}\renewcommand{\headrulewidth}{0ex}}
\setlength\parindent{0pt} %Set indent length to 0, i.e. \noindent not required
\begin{document}
%input different chapters
%refer to appendix somewhere
%Appendix
\appendix
\pagenumbering{Roman}
\addcontentsline{toc}{chapter}{Appendix}
\newgeometry{top=4mm,left=5mm,right=5mm, bottom=18mm}
\chapter{Specs}
\begin{figure}
\centering
\includegraphics[width=\textwidth]{04_Appendices/terns.pdf}
\end{figure}
\end{document}
</code></pre>
<p>Now I want to reduce all margins so that more of the page is available for large charts in general. I plan on using both <code>includepdf</code> and <code>includegraphic</code>. So far I have read elsewhere that this is solved if <code>geometry</code> is defined before <code>fncychap</code>, but I need to redefine the geometry in my appendix and therefore <a href="https://tex.stackexchange.com/questions/301513/geometry-and-fncychap-packages-create-an-ugly-header-how-do-i-correct-that">Geometry and fncychap packages create an ugly header - How do I correct that?</a>
does not work.</p>
<ol>
<li>First, I need to fill the grey area after redefining a new geometry (see picture)</li>
<li>What basic commands can I edit the appendix (margins and title/pagenumber placement) with?</li>
</ol>
<p>Note: not comfortable coding LaTeX and have therefore not been able to solve this from relevant documentation.</p>
<p><a href="https://i.stack.imgur.com/07zmI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/07zmI.png" alt="Example of unfilled grey area"></a></p>
| 0non-cybersec
| Stackexchange | 1,820 | 5,487 |
As promised: 150 burpees.... Done in 18:58. Also bested my mark at 100 in 11:58. I had my Five Guys Bacon Cheeseburger today as well, but [no vomit](http://www.reddit.com/r/Fitness/comments/buofl/the_cosmos_have_aligned_two_posts_from_yesterday/). I forgot to take a HR immediately after, though, and I'm bummed about that. It was about 130 five mins later.
It was an interesting sensation, as the only thing hurting when I was done was my lungs and my delts. I was wondering, "Man, did I not jump high enough?" Well, 25 mins later and I feel weak and wobbly all over and barely able to walk or eat my turkey sandwich... | 0non-cybersec
| Reddit | 185 | 627 |
Windows XP ISO looks for CD. <p>I created a windows XP iso from the windows xp installation CD I have, so I can upload the ISO to proxmox. When I boot the VM and try to install windows XP, it seems to ask for the CD. I assume this is because the MD5 hashes don't match. Is there anyway to fix this, so the iso hash and cd hash match?</p>
<p>I used the following command to rip: </p>
<pre><code> sudo dd if=/dev/cdrom of=windowsXPsp2.iso bs=blocksize count=volume size
</code></pre>
<p><img src="https://i.stack.imgur.com/7MBun.png" alt="enter image description here"></p>
| 0non-cybersec
| Stackexchange | 179 | 575 |
Consider round trip identically. <p>I'm having difficulty for encoding the route variable in R in a way that it assumes a unique value when the route is the same, regardless of the origin and destination point (The origin is the first 4 characters of the variable route and the destination is the last 4). The base is as follows:</p>
<pre><code>base <- data.frame(route = c("SBAA - SBBE", "SBAA - SBBR", "SBAA - SBCI",
"SBBE - SBAA", "SBBE - SBBR", "SBBR - SBBE"),
seats = c(1231, 1021, 715, 989, 759, 695))
base <- as_tibble(base)
# A tibble: 6 x 2
route seats
<chr> <dbl>
1 SBAA - SBBE 1231
2 SBAA - SBBR 1021
3 SBAA - SBCI 715
4 SBBE - SBAA 989
5 SBBE - SBBR 759
6 SBBR - SBBE 695
</code></pre>
<p>I thought of doing a transformation to generate the variable code:</p>
<pre><code>code <-as.numeric (as.factor (route))
</code></pre>
<p>However, the output will be different for same routes (same connecting airports) but with reverse origin and destination airports. For example, "SBAA - SBBE" and SBBE - SBAA "
should have the same code, but will look like this:</p>
<pre><code> route seats code
<chr> <dbl> <dbl>
1 SBAA - SBBE 1231 1
2 SBAA - SBBR 1021 2
3 SBAA - SBCI 715 3
4 SBBE - SBAA 989 4
5 SBBE - SBBR 759 5
6 SBBR - SBBE 695 6
</code></pre>
<p>I need routes that have the same connecting airports to have the same code, so that the code variable returns the following result:</p>
<pre><code> route seats code
<chr> <dbl> <dbl>
1 SBAA - SBBE 1231 1
2 SBAA - SBBR 1021 2
3 SBAA - SBCI 715 3
4 SBBE - SBAA 989 1
5 SBBE - SBBR 759 4
6 SBBR - SBBE 695 4
</code></pre>
<p>Note that the code for "SBAA - SBBE" is identical to "SBBE - SBAA". Thank you for your help.</p>
| 0non-cybersec
| Stackexchange | 686 | 2,097 |
Disable tooltip on certain points in Highcharts. <p>I have a Highcharts line chart going and I have tooltips enabled, however, I would like to disable tooltips for the certain case where x=0. Is there a way of doing this? The closest that I have come so far is this:</p>
<pre><code>tooltip: {
formatter: function() {
if (this.x > 0) {
return this.x;
}
else return null;
}
}
</code></pre>
<p>This just creates an empty tooltip but there is still a popup.</p>
| 0non-cybersec
| Stackexchange | 152 | 509 |
How do a dynamically switch parts of a pipe?. <p>I have a script which should execute a series of commands through a pipe. Depending of the arguments passed to the script:</p>
<ul>
<li>Either it encrypts the file, computes its hash, and sends it to a REST service.</li>
<li>Or it compresses the file, computes its hash, and sends it to a REST service.</li>
<li>Or it simply reads the file, computes its hash, and sends it to a REST service.</li>
</ul>
<pre><code>if [ "$encryption" = "GPG" ]; then
gpg2 \
--batch \
--passphrase-file "$keyFile" \
--output - \
--symmetric \
--compress-level "$compressLevel" \
"$filePath" | \
./scripts/sha1.py --store "$sha1Destination" | \
curl --silent -X PUT --limit-rate "$limitRate" "$uri" -F files[]=@-
elif [ "$encryption" = "disabled" ]; then
if [ "$compressLevel" > 0 ]; then
gzip --stdout "$filePath" -"$compressLevel" | \
./scripts/sha1.py --store "$sha1Destination" | \
curl --silent -X PUT --limit-rate "$limitRate" "$uri" -F files[]=@-
else
cat "$filePath" | \
./scripts/sha1.py --store "$sha1Destination" | \
curl --silent -X PUT --limit-rate "$limitRate" "$uri" -F files[]=@-
fi
fi
</code></pre>
<p>The second and third part of each chain of commands remains the same: only the first part changes, being <code>gpg2</code> in one case, <code>gzip</code> in another, and <code>cat</code> in the last one.</p>
<p>I'm annoyed by the code duplication for the second and third part of the chain.</p>
<p>Is there a way to remove the code duplication, that is to do something like:</p>
<pre><code>if [ "$encryption" = "GPG" ]; then
...
elif [ "$encryption" = "disabled" ]; then
if [ "$compressLevel" > 0 ]; then
...
else
...
fi
fi
... | \
./scripts/sha1.py --store "$sha1Destination" | \
curl --silent -X PUT --limit-rate "$limitRate" "$uri" -F files[]=@-
</code></pre>
| 0non-cybersec
| Stackexchange | 772 | 2,266 |
Confused with CouchDB and Couchbase. <p>I'm investigating CouchDB and Couchbase as I am looking for a DB solution for a web application that I will eventually be able to make into a native Android/iOS app as well. From what I understand, CouchDB/Couchbase excel at being able to use the DB offline and have it synchronize as soon as the connection is restored.</p>
<p>I further understand that CouchDB and Couchbase are 2 distinct products from 2 different organizations - CouchDB is from Apache and Couchbase is from Couchbase. There is a great response in <a href="https://stackoverflow.com/a/15184612/827480">SO here explaining some of the differences</a>.</p>
<p>Couchbase has <a href="https://github.com/couchbase/couchbase-lite-android" rel="nofollow noreferrer">Couchbase-Lite-Android</a> and similar for iOS as native embedded DBs for mobile apps which sync with Couchbase server.</p>
<p>Where I get lost is when I try to find the CouchDB equivalent. Everything points to TouchDB which then says it is no longer actively developed and instead points to Couchbase-Lite-Android as the project that has superceeded it. But does Couchbase-List-Android/iOS sync with CouchDB or just Couchbase? According to the Wiki, it indicates that it can sync with CouchDB, but it is a secondary backend which receives lower priority and/or bug fixes.</p>
<p>So then what are the embedded/mobile versions of CouchDB that should be used for Android/iOS?</p>
| 0non-cybersec
| Stackexchange | 396 | 1,456 |
Trouble with boost::lockfree::queue in shared memory (boost 1.53, gcc 4.7.2 / clang 3.0-6ubuntu3). <p>I have a problem with placing <code>boost::lockfree::queue<<T, fixed_sized<false>, ..></code>
in shared memory. I need it because I have to be able to insert more than 65535 messages into the queue, and fixed_sized queue is limited with 65535.<br>
The following code works properly (but <code>capacity<...></code> option implies <code>fixed_sized<true></code>):</p>
<pre><code>typedef boost::interprocess::allocator<
MessageT,
boost::interprocess::managed_shared_memory::segment_manager>
ShmemAllocator;
typedef boost::lockfree::queue<
MessageT,
boost::lockfree::capacity<65535>,
boost::lockfree::allocator<ShmemAllocator> >
Queue;
m_segment = new boost::interprocess::managed_shared_memory(
boost::interprocess::create_only, segmentName, size);
Queue* m_queue = m_segment->construct<Queue>(
queueName)(
m_segment->get_segment_manager());
...
m_queue->bounded_push(message);
</code></pre>
<p>The following code works properly too (but it doesn't use shared memory):</p>
<pre><code>boost::lockfree::queue<MessageT> q;
....
q.bounded_push(message);
</code></pre>
<p>But when I try to combine it:</p>
<pre><code>typedef boost::interprocess::allocator<
MessageT,
boost::interprocess::managed_shared_memory::segment_manager>
ShmemAllocator;
typedef boost::lockfree::queue<
MessageT,
boost::lockfree::allocator<ShmemAllocator> >
Queue;
m_segment = new boost::interprocess::managed_shared_memory(
boost::interprocess::create_only, segmentName, size);
Queue* m_queue = m_segment->construct<Queue>(
queueName)(
m_segment->get_segment_manager());
...
m_queue->bounded_push(message);
</code></pre>
<p>it fails to compile with the following log: </p>
<pre><code>In file included from src/model/Queue.h:16:
In file included from /home/uppi/lib/include/boost/lockfree/queue.hpp:24:
/home/uppi/lib/include/boost/lockfree/detail/freelist.hpp:171:28: error: no viable conversion from 'pointer' (aka 'offset_ptr<boost::lockfree::queue<PacketMessage,
boost::lockfree::allocator<boost::interprocess::allocator<PacketMessage, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,
boost::interprocess::offset_ptr<void, long, unsigned long, 0>, 0>, iset_index> > >, boost::parameter::void_, boost::parameter::void_>::node, long, unsigned long, 0UL>') to
'boost::lockfree::queue<PacketMessage, boost::lockfree::allocator<boost::interprocess::allocator<PacketMessage, boost::interprocess::segment_manager<char,
boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned long, 0>, 0>, iset_index> > >, boost::parameter::void_,
boost::parameter::void_>::node *'
return Alloc::allocate(1);
~~~~~~~~~~~~~~~~~
/home/uppi/lib/include/boost/lockfree/detail/freelist.hpp:157:20: note: in instantiation of function template specialization 'boost::lockfree::detail::freelist_stack<boost::lockfree::queue<PacketMessage,
boost::lockfree::allocator<boost::interprocess::allocator<PacketMessage, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,
boost::interprocess::offset_ptr<void, long, unsigned long, 0>, 0>, iset_index> > >, boost::parameter::void_, boost::parameter::void_>::node,
boost::interprocess::allocator<boost::lockfree::queue<PacketMessage, boost::lockfree::allocator<boost::interprocess::allocator<PacketMessage, boost::interprocess::segment_manager<char,
boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned long, 0>, 0>, iset_index> > >, boost::parameter::void_,
boost::parameter::void_>::node, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned
long, 0>, 0>, iset_index> > >::allocate_impl<true>' requested here
return allocate_impl<Bounded>();
/home/uppi/lib/include/boost/lockfree/detail/freelist.hpp:89:20: note: in instantiation of function template specialization 'boost::lockfree::detail::freelist_stack<boost::lockfree::queue<PacketMessage,
boost::lockfree::allocator<boost::interprocess::allocator<PacketMessage, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,
boost::interprocess::offset_ptr<void, long, unsigned long, 0>, 0>, iset_index> > >, boost::parameter::void_, boost::parameter::void_>::node,
boost::interprocess::allocator<boost::lockfree::queue<PacketMessage, boost::lockfree::allocator<boost::interprocess::allocator<PacketMessage, boost::interprocess::segment_manager<char,
boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned long, 0>, 0>, iset_index> > >, boost::parameter::void_,
boost::parameter::void_>::node, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned
long, 0>, 0>, iset_index> > >::allocate<true, true>' requested here
T * node = allocate<ThreadSafe, Bounded>();
/home/uppi/lib/include/boost/lockfree/queue.hpp:281:34: note: in instantiation of function template specialization 'boost::lockfree::detail::freelist_stack<boost::lockfree::queue<PacketMessage,
boost::lockfree::allocator<boost::interprocess::allocator<PacketMessage, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,
boost::interprocess::offset_ptr<void, long, unsigned long, 0>, 0>, iset_index> > >, boost::parameter::void_, boost::parameter::void_>::node,
boost::interprocess::allocator<boost::lockfree::queue<PacketMessage, boost::lockfree::allocator<boost::interprocess::allocator<PacketMessage, boost::interprocess::segment_manager<char,
boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned long, 0>, 0>, iset_index> > >, boost::parameter::void_,
boost::parameter::void_>::node, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned
long, 0>, 0>, iset_index> > >::construct<true, true, PacketMessage, boost::lockfree::queue<PacketMessage, boost::lockfree::allocator<boost::interprocess::allocator<PacketMessage,
boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned long, 0>, 0>, iset_index> > >,
boost::parameter::void_, boost::parameter::void_>::node *>' requested here
node * n = pool.template construct<true, Bounded>(t, pool.null_handle());
/home/uppi/lib/include/boost/lockfree/queue.hpp:270:16: note: in instantiation of function template specialization 'boost::lockfree::queue<PacketMessage,
boost::lockfree::allocator<boost::interprocess::allocator<PacketMessage, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,
boost::interprocess::offset_ptr<void, long, unsigned long, 0>, 0>, iset_index> > >, boost::parameter::void_, boost::parameter::void_>::do_push<true>' requested here
return do_push<true>(t);
src/model/Queue.inl:4:18: note: in instantiation of member function 'boost::lockfree::queue<PacketMessage, boost::lockfree::allocator<boost::interprocess::allocator<PacketMessage,
boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, boost::interprocess::offset_ptr<void, long, unsigned long, 0>, 0>, iset_index> > >,
boost::parameter::void_, boost::parameter::void_>::bounded_push' requested here
return m_queue->bounded_push(message);
/home/uppi/lib/include/boost/interprocess/offset_ptr.hpp:450:4: note: candidate function
operator unspecified_bool_type() const
</code></pre>
<p>Please tell me what I'm missing</p>
| 0non-cybersec
| Stackexchange | 2,940 | 9,101 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
Building a shared library using gcc on Linux and MinGW on Windows. <p>I'm having trouble with generating a build setup that allows shared libraries to be built in both Linux and Windows using gcc and MinGW, respectively. In Linux, a shared library doesn't have to resolve all dependencies at compile time; whereas, this appears to the case in Windows. Here is the problem setup:</p>
<hr>
<pre><code>$ cat foo.h
#ifndef FOO_H
#define FOO_H
void printme();
#endif
</code></pre>
<hr>
<pre><code>$ cat foo.c
#include "foo.h"
#include <stdio.h>
void printme() {
printf("Hello World!\n");
}
</code></pre>
<hr>
<pre><code>$ cat bar.h
#ifndef BAR_H
#define BAR_H
void printme2();
#endif
</code></pre>
<hr>
<pre><code>$ cat bar.c
#include "bar.h"
#include "foo.h"
void printme2() {
printme();
printme();
}
</code></pre>
<hr>
<pre><code>$ cat main.c
#include "bar.h"
int main(){
printme2();
}
</code></pre>
<hr>
<pre><code>$ cat Makefile
.c.o:
gcc -fPIC -c $<
all: foo.o bar.o main.o
gcc -shared foo.o -o libfoo.so
gcc -shared bar.o -o libbar.so
gcc main.o -Wl,-rpath=. -L . -lbar -lfoo -o main
</code></pre>
<hr>
<p>Now, in Linux, this compiles and runs just fine:</p>
<pre><code>$ make
gcc -fPIC -c foo.c
gcc -fPIC -c bar.c
gcc -fPIC -c main.c
gcc -shared foo.o -o libfoo.so
gcc -shared bar.o -o libbar.so
gcc main.o -Wl,-rpath=. -L . -lbar -lfoo -o main
$ ./main
Hello World!
Hello World!
</code></pre>
<p>In Windows, we need to change so to dll, which is minor and fine:</p>
<pre><code>$ cat Makefile
.c.o:
gcc -fPIC -c $<
all: foo.o bar.o main.o
gcc -shared foo.o -o libfoo.dll
gcc -shared bar.o -o libbar.dll
gcc main.o -Wl,-rpath=. -L . -lbar -lfoo -o main
</code></pre>
<p>However, when we try to build, we get the following error:</p>
<pre><code>$ make
gcc -fPIC -c foo.c
foo.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
gcc -fPIC -c bar.c
bar.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
gcc -fPIC -c main.c
main.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
gcc -shared foo.o -o libfoo.dll
gcc -shared bar.o -o libbar.dll
bar.o:bar.c:(.text+0x7): undefined reference to `printme'
bar.o:bar.c:(.text+0xc): undefined reference to `printme'
collect2.exe: error: ld returned 1 exit status
make: *** [all] Error 1
</code></pre>
<p>Now, we can fix the error by simply including the objects from foo.o into libbar.dll:</p>
<pre><code>$ cat Makefile
.c.o:
gcc -fPIC -c $<
all: foo.o bar.o main.o
gcc -shared foo.o -o libfoo.dll
gcc -shared bar.o foo.o -o libbar.dll
gcc main.o -Wl,-rpath=. -L . -lbar -lfoo -o main
$ make
gcc -fPIC -c foo.c
foo.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
gcc -fPIC -c bar.c
bar.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
gcc -fPIC -c main.c
main.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
gcc -shared foo.o -o libfoo.dll
gcc -shared bar.o foo.o -o libbar.dll
gcc main.o -Wl,-rpath=. -L . -lbar -lfoo -o main
$ ./main
Hello World!
Hello World!
</code></pre>
<p>However, I don't like this approach since libbar.dll now contains symbols for both foo and bar. In Linux, it only contains symbols for bar. This separation is important for situations where a library depends on some standard numerical library like BLAS. I'd like to be able to deploy the shared library and have it depend on the optimized version of the numerical library on the user's machine and not my own.</p>
<p>In any case, what's the proper procedure to create a shared library where not all of the symbols are present at compile time?</p>
<p>In case it matters, I compiled these examples with gcc 4.6.3 on Linux and mingw-get-inst-20120426.exe with gcc 4.7.2 on Windows.</p>
| 0non-cybersec
| Stackexchange | 1,461 | 4,059 |
Split function - avoid last empty space. <p>I have a doubt on how to use the split function.</p>
<pre><code>str = 'James;Joseph;Arun;'
str.split(';')
</code></pre>
<p>I got the result <code>['James', 'Joseph', 'Arun', '']</code></p>
<p>I need the output as <code>['James', 'Joseph', 'Arun']</code></p>
<p>What is the best way to do it?</p>
| 0non-cybersec
| Stackexchange | 133 | 344 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
How to set up Asus RT-N66U in bridge mode with wired connection to main router?. <p>I have a wired router (TP-Link RT-860) in the basement where the cable service comes in. Eight wired ethernet connections span two buildings. I currently have a Linksys wireless router set up in bridge mode, but its signal doesn't span the whole area. I have purchased an Asus RT-N66U to replace it, but I can't figure out how to set it up in bridge mode. Does anyone know if this is possible? Second question: Would there be any advantage in installing DD-WRT on the Asus?</p>
| 0non-cybersec
| Stackexchange | 143 | 562 |
Deck Finishing Question. Hi All, pardon if this has been asked a lot but I wasn't able to find much after searching through a few years of posts.
Looking to finish our deck and we're torn between using a 'Deckover' type paint and a semi-transparent or solid stain. Does anybody have any experience with the Behr/Rustoleum (or similar) deckover paints and would you recommend? We've seen the class-actions lawsuits and poor reviews for these, but have also heard some first hand accounts of them working quite well.
The other option is to use a stain, but I was hesitant as our pup would likely shred it a bit when he shoots out the back door to chase whatever animal is outside the fence that day.
Any and all advice is much appreciated!! | 0non-cybersec
| Reddit | 174 | 741 |
Is "ref return" a language feature or feature of the CLR. <p>In this SO question: <a href="https://stackoverflow.com/questions/6339602/why-doesnt-c-sharp-support-the-return-of-references">Why doesn't C# support the return of reference</a> (and elsewhere on the web), I can't determine when <code>ref return</code> was introduced to the .NET framework. Is it just syntax sugar?</p>
<p>Reason I'm asking is that many of our hosts are not installed with latest .NET framework version (still on 4.5.2) and I'm wondering how this would affect CLR backwards compatibility, runtime correctness and performance.</p>
<p>Also, where would I be able to find documentation on how older .NET framework handles backwards compatibility? The C# 6.0 Language specification does not seem to cover this, perhaps I'm somehow skipping this?</p>
| 0non-cybersec
| Stackexchange | 220 | 836 |
How can I stop Thunderbird from silently appending .xml to incoming .gpx filenames and making them readonly?. <p>A convenient way for me to get tracklogs off my phone onto my PC is to email them from gmail to my primary account, which is set up in Thunderbird. When I go to open the attachment, I get </p>
<pre>
You have chosen to open:
Myfile.gpx
which is: XML Document (xxx kB)
from Mailbox://
What should Thunderbird do with this file?
Open with [dropdown]
Save
</pre>
<p>If I select "Save", the file is saved correctly, but if I select "Open with" the file saved in %TMP% and sent to my chosen program is <code>MyFile.gpx.xml</code> (not a big deal if I'm opening it in a text editor, but problematic for software that expects <code>.gpx</code>). Presumably it gets that from the MIME type </p>
<p>It also sets the readonly flag, which is more annoying; further tests suggest that it does that for incoming <code>.txt</code> files as well.</p>
<p>This is on my win7 machine, running Thunderbird 52.9.1 (32-bit), I <em>think</em> the behaviour is different on my Linux box at home, or at least was until recently.</p>
<p>Is there a buried setting somewhere to save temporary files under their real names rather than appending the MIME type? Or to disable saving as readonly? The Tools|Options|Attachments|Incoming tab has <code>XML Document (text/xml :.xml) Always ask</code> and no entry for <code>.gpx</code></p>
| 0non-cybersec
| Stackexchange | 404 | 1,424 |
Question about the legendre transform in convex analysis. <p>I'm work through a script about convex analysis, especially with dual problems.
There is one step in a proof, which is not entirely clear to me.</p>
<p>Let $U$ be a function, which is strictly concave, $C^1$ and strictly increasing. We define</p>
<p>$$J(y)=\sup_{x>0}(U(x)-xy)$$</p>
<p>That's the Legendretransform of $-U(-x)$. One can prove that $J$ is $C^1$ too, decreasing and convex. We also have the equality:
$$J(y)=U(I(y))-yI(y)$$</p>
<p>where $I=-J'=(U')^{-1}$. Now, let $J_n(y)=\sup_{n\ge x>0}(U(x)-xy)$ and they claim that for $y\ge I(n)$ $J_n(y)=J(y)$. I think it should be true that for $y\le I(n)$, since:</p>
<p>$$J_n(y)=\sup_{n\ge x>0}(U(x)-xy)$$ and $$J(y)=U(I(y))-yI(y)$$ imply that for $I(y)\le n$ both coincide. Or why am I wrong?</p>
| 0non-cybersec
| Stackexchange | 332 | 831 |
shared_ptr with non-pointer resources. <p>In C++11 is it possible to use <code>shared_ptr</code> to control non-pointer resources?</p>
<hr>
<p>It is possible to use <code>unique_ptr</code> to manage non-pointer resources. This is done by implementing a custom deleter class which provides:</p>
<ol>
<li>A <code>typedef {TYPE} pointer;</code> where <code>{TYPE}</code> is the non-pointer resource type</li>
<li><code>operator()(pointer)</code> which frees the controlled resource</li>
</ol>
<p>...and then instantiating a <code>unique_ptr</code> with the custom deleter as the second template parameter.</p>
<p>For example, under Windows it is possible to create a <code>unique_ptr</code> which manages a <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms685104%28v=vs.85%29.aspx" rel="noreferrer">service control handle</a>. This handle type is not freed by calling <code>delete</code>, but by calling <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms682028%28v=vs.85%29.aspx" rel="noreferrer"><code>CloseServiceHandle()</code></a>. Here is sample code which does this:</p>
<h2>Custom Deleter</h2>
<pre><code>struct SvcHandleDeleter
{
typedef SC_HANDLE pointer;
SvcHandleDeleter() {};
template<class Other> SvcHandleDeleter(const Other&) {};
void operator()(pointer h) const
{
CloseServiceHandle(h);
}
};
typedef std::unique_ptr<SC_HANDLE,SvcHandleDeleter> unique_sch;
</code></pre>
<h2>Instantiation</h2>
<pre><code>unique_sch scm(::OpenSCManagerA(0, 0, SC_MANAGER_ALL_ACCESS));
</code></pre>
<hr>
<p>Is it possible to use <code>shared_ptr</code> to control a non-pointer resource as well?</p>
<p>According to the documentation, there are <a href="http://en.cppreference.com/w/cpp/memory/shared_ptr/shared_ptr" rel="noreferrer"><code>shared_ptr</code> constructor overloads</a> which take provide the means to provide a custom deleter class, but none of the constructors accept a resource type that is not either a pointer or a wrapper around a pointer.</p>
<p>How can this be done?</p>
| 0non-cybersec
| Stackexchange | 681 | 2,091 |
Google Analytics gtag.js ready callback. <p>I try to update my Google Analytics implementation from analytics.js to the new gtag.js.</p>
<p>In the old implementation I am using the <a href="https://developers.google.com/analytics/devguides/collection/analyticsjs/command-queue-reference#ready-callback" rel="noreferrer">ready callback</a> function.</p>
<pre><code>ga(function() {
console.log('Google analytics is ready');
});
</code></pre>
<p>How can I implement a ready callback in the new gtag.js? I can't find any information in Google's documentation.</p>
| 0non-cybersec
| Stackexchange | 166 | 568 |
Confused about what to show a matrix is an element of GL(2,$\mathbb{R}$).. <p>I am kind of confused about what I am supposed to show in the following problem:</p>
<p>Show that for any $\theta \in \mathbb{R}$, we have $$ \begin{pmatrix}
cos \hspace1mm\theta& -sin \hspace1mm\theta \\
sin \hspace1mm \theta & cos \hspace1mm\theta \\
\end{pmatrix} \in GL(2,\mathbb{R})$$</p>
<p>Am I supposed to show that matrices of this form satisfy closure, associativity, existence of an identity and inverse? That is for matrices of this form, but with different $\theta$'s? I am not to sure what exactly it is asking. </p>
| 0non-cybersec
| Stackexchange | 191 | 623 |
Rant: So got called out on my form last night at the gym. Last night at the gym a guy came up to me and said I was doing arm curls all wrong (I know glamour muscles, sorry fittit).
Now I wouldn't have minded the tips, if he hadn't started by yelling at me saying, "Your killing me! I can't watch you do it like that anymore, this is how you do it".
The guy was older and in good shape so I took his advice tried it out and he did have good points about my form.
I am totally for getting help just don't annouce to the entire GD gym that I'm not doing it the way you like!
So if you guys try to help someone with form at the gym, try and do it as discretely as possible
/rant | 0non-cybersec
| Reddit | 183 | 679 |
Official Fedora package for 'xxd' command?. <p>I need to use a script based upon <code>xxd</code>, but it's not installed on my Fedora 21:</p>
<pre><code>$ xxd
bash: xxd: command not found
</code></pre>
<p>So I tried without success to search and install it:</p>
<pre><code>$ yum install xxd
(fails)
$ yum search xxd
(fails)
$ yum search all xxd
(fails - detailed log below)
Loaded plugins: langpacks
================================================================= Matched: xxd ========
perl-Data-HexDump-XXD.noarch : Format hexadecimal dump like xxd
xxdiff.i686 : Graphical file and directories comparator and merge tool
xxdiff-tools.i686 : Tools for xxdiff
</code></pre>
<ul>
<li><strong>Do you know which package <code>xxd</code> is provided with?</strong> (I mean an official package to install with <code>yum</code> from the fedora repositories).</li>
</ul>
<p>Thanks in advance for any help!</p>
| 0non-cybersec
| Stackexchange | 290 | 917 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
How qtpie´s wise words won me a game.. Hi, some of you have probably seen [this video](https://www.youtube.com/watch?v=AnVIz6nOKhQ), where qtpie talks about what separates a pro player from a lesser player. Well, I too have seen the video - and I actually won a game thanks to this awesome gold-making advice. This is what happened:
It was about 50 minutes into the game, I was playing vayne. I had my upgraded boots, IE, BotRK, ghostblade, banshee´s and an avarice blade. There was a teamfight and I died. I had enough money for statikk shiv, but just as I was about to upgrade it, I remembered the wise words of qtpie and waited for the whole duration of my death before upgrading my Shiv. After upgrading it, I realized I have about 335gold, so I decided to wait for redpot before the next teamfight.
So I waited for redpot, and both teams head to baron as it´s just spawned. Long story short, we teamfight and I find myself being the only alive member of our team, sitting on around 40%hp. The only alive member of enemy team was corki. I decided to go ham on him and voila - Corki is dead, I´m left with no more than 70-80 hp. Our creeps are knocking on the door of their base, and since they only have an inhibitor, a nexus tower and nexus, I manage to finish the game before enemy team spawns. Around 3 minutes later, electricity in our part of town goes off because of a storm.
If It wasn´t for qtpie´s excellent advice, I would have upgraded statikk shiv just as I died, which would have left me with around 320 gold when I spawned, and I wouldn´t have bothered waiting for that red elixir. I would then lose the 1v1 with corki, because I survived with 80 hp and red elixir gives 235 at level 18. Corki would have then pushed to our base, and even if we didn´t lose there, we would have lost eventually because my electricity went off and my team wouldn´t have won 4v5.
Thank you based QTpie & big dick club. God bless.
Also, sorry for any grammar mistakes that occured, english is not my main.
TL;DR: Had enough gold for Elixir of fortitude thanks to qtpie´s advice, won game because of it.
EDIT 1: I didnt have all items 50 minutes into the game, because I´m obviously a terrible noob. That´s also the reason why I didn´t buy last whisper.
EDIT 2: To everyone telling me the video is a joke: Thank you so very much! Without you, dear friends, I would remain convinced he was completely serious about everything he said. I obviously somehow missed the part when our lord spends 18 seconds saying he was just joking. | 0non-cybersec
| Reddit | 661 | 2,535 |
Unions and intersections of indexed families of transitive sets are transitive. <p>Let $\{ T_a \}_{a \in A}$ be a family of transitive sets. Prove that $\bigcup_{a \in A} T_a$ and $\bigcap_{a \in A} T_a$ are transitive. Assume $A \neq \emptyset$.</p>
<p>I'm not sure how to apply the definitions to write the proof. </p>
<p>For the union we will have $\bigcup$ $T_a$= {x|x$\in$$T_a$ for some a $\in$A}.</p>
<p>For the intersection we will have $\bigcap$ $T_a$= {x|x$\in$$T_a$ for every a $\in$A}.</p>
| 0non-cybersec
| Stackexchange | 190 | 504 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
Seven months at the gym and I had a real breakthrough today. I fit my jeans AND my calves into my gardening boots! At the same time! WooHoo!!
​
​
When I first joined the gym and decided to make the investment of a personal trainer, he asked me what my 3 main goals were. I told him I want to be stronger, I want more endurance, and I want to get rid of my cankles. I think he thought I was kidding. I was not. Women in my family, no matter their overall size, have absolutely no calf definition and since I'm also fat, the area between my ankles and my calves is annoyingly fat. My ankles themselves are normal though, as are my feet. I always have to wear wide calf boots and I have never been able to fit anything but leggings in them. I used to take off my gardening boots to find a tight imprint of the boots on my legs. I am not fluid overloaded, I just have big, fat calves.
​
The fitness analyzer thingie at the gym is frustrating. I am down 7 pounds since October and have managed to lose skeletal muscle mass despite increasing my protein intake. What I can't see though, I can definitely feel. I am so much stronger and my endurance is exponentially improved. I did about 5 hours of extremely strenuous gardening today and other than being a bit sunburned and sore like I just did an hour at the gym, I feel fine . I was able to use brute strength (along with a spade and a maul) to remove a huge root from the ground without power tools. I pulled many big roots just with my own strength. I spent at least half the time squatting and I can still walk!
​
​
But, despite all the endurance and strength changes, the very small weight change has made it hard to actually see changes. My wardrobe consists of scrubs and leggings for the most part and my only pairs of jeans were bought last month so I have nothing really that shows whether or not my clothes no longer fit due to toning.
​
​
Now though, I have a faint hint of calf definition and that's all the physical proof I need. | 0non-cybersec
| Reddit | 504 | 2,053 |
Increasing swap space and removing previous swap space on ubuntu?. <p>I have a virtual machine (hosted online) with 2Gb swap space.</p>
<p><strong>free -m</strong></p>
<pre><code> total used free shared buffers cached
Mem: 1995 438 1557 37 22 190
-/+ buffers/cache: 225 1770
Swap: 1998 0 1998
</code></pre>
<p>Since the swap space was small, I tried to increase it to 4GB.</p>
<p>Doing <strong>swapon -s</strong>, returned this result (not sure what it means since I don't have a second hard disk sda2)</p>
<pre><code>Filename Type Size Used Priority
/dev/sda2 partition 2046972 0 -1
</code></pre>
<p><strong>df -H</strong></p>
<pre><code>Filesystem Size Used Avail Use% Mounted on
/dev/sda1 25G 19G 4.3G 82% /
udev 1.1G 4.1k 1.1G 1% /dev
tmpfs 210M 492k 209M 1% /run
none 4.1k 0 4.1k 0% /sys/fs/cgroup
none 5.3M 0 5.3M 0% /run/lock
none 1.1G 0 1.1G 0% /run/shm
none 105M 0 105M 0% /run/user
</code></pre>
<p>So I did</p>
<pre><code>swapoff -a #deactivating previous swap space
fallocate -l 4G /swapfile #creating a swapfile
chmod 600 /swapfile #giving permissions
mkswap /swapfile #making swap the file
swapon /swapfile #activating swap on the file
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab #stabilizying swap for it to be there after next reboot
</code></pre>
<p>Now I have the swap space I needed</p>
<p><strong>free -m</strong></p>
<pre><code> total used free shared buffers cached Mem: 1995 1153 842 64 116
455
-/+ buffers/cache: 581 1414 Swap: 4095 0 4095
</code></pre>
<p>But, the 2GB of the previous swap space are still considered occupied if I do a df (maybe they will be free at the next reboot?) and my fstab has two entries for swap space.</p>
<pre><code># <file system> <mount point> <type> <options> <dump> <pass>
/dev/sda1 / ext4 errors=remount-ro,relatime 0 1
/dev/sda2 swap swap defaults 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
devtmpfs /dev devtmpfs rw 0 0
/swapfile none swap sw 0 0
</code></pre>
<p>In this situation, how I may proceed to finalize the procedure? I have to remove the second line referring to swap in the fstab? (I mean /dev/sda2 swap swap defaults 0 0) It is safe to reboot?</p>
| 0non-cybersec
| Stackexchange | 902 | 2,867 |
[Spoilers][Rewatch] Fullmetal Alchemist: Brotherhood Episode 53 Discussion. #Episode 53: *Flame of Vengeance*
---
**Information:**
* [MAL](https://myanimelist.net/anime/5114/Fullmetal_Alchemist__Brotherhood)
* [IMDB](http://www.imdb.com/title/tt1355642/)
---
[↞↞Previous Episode↞↞](https://redd.it/5frs1u)|| [**Rewatch Index**](https://www.reddit.com/r/anime/comments/559rhx/fullmetal_alchemist_brotherhood_rewatch_schedule/) || [↠↠ Next episode↠↠](https://redd.it/5g5e3m)
---
**Legal Streams:** As of October 3rd, the full series is available on [Crunchyroll](http://www.crunchyroll.com/fullmetal-alchemist-brotherhood) in a large number of countries both subbed and dubbed (both of which are highly acclaimed). If it's not available in yours, then you might want to check if it's available on [Netflix](https://www.netflix.com/). Failing that, I believe the only alternative left is the high seas.
Adding to that, For AU/NZ viewers, Full metal alchemist is available on [AnimeLab](https://www.animelab.com/shows/fullmetal-alchemist-brotherhood).
---
**Spoilers PSA:** Rewatchers, please do your absolute best to keep these threads spoiler-free. I want newcomers to have the full experience of this show and wouldn't want them spoiled on key events. Also, please try to minimize your use of spoiler tags. No one wants to scroll through a forest of black.
---
###[Eyecatch album](http://imgur.com/a/BRRA8), courtesy of /u/Magnus_Lux
---
##[~Daily Fanart~](http://i.imgur.com/PkXaUN5.jpg)
##[~Daily Fanart~](http://i.imgur.com/08GXe50.jpg)
##[~Daily Fanart~](http://i.imgur.com/EeC3SAr.jpg)
^^^^^^^^^^^^^^^^^^^^s | 0non-cybersec
| Reddit | 560 | 1,635 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
Show that each of the $35$-roots of unity is the cube of some root of $35$th degree of unity.. <p>After showing that the $n$-roots of unity form a multiplicative group I'm asked the following:</p>
<blockquote>
<p>Show that each of the $35$-roots of unity is the cube of some root of $35$th
degree of unity.</p>
</blockquote>
<p>I don't have idea how to start with this problem. I'm only able to sort of formalize what the problem is asking me to prove, that is: </p>
<blockquote>
<p>Let $(\mathbb{C}^{35}, \cdot)$ be the group of the $35$-roots of
unity. Then I have to show that $\forall a \in \mathbb{C}^{35}\
\exists\ b \in \mathbb{C}^{35}: b = a^3$.</p>
</blockquote>
<p>Any help would be appreciated.</p>
| 0non-cybersec
| Stackexchange | 236 | 722 |
Need an Ubuntu Server image with the minimum possible kernel and packages. <p>I need to build an Ubuntu (16.04 at the moment) base server image for deployment for compliance. We do not want things like... </p>
<ul>
<li>any added libraries (like python, perl)</li>
<li>apt/aptitude/etc (we'll use Chef or Packer.io or something to build an image)</li>
<li>vim</li>
<li>ssh/sshd, sh/bash/etc. </li>
<li>ping </li>
<li>iputils </li>
<li>bzip, gzip, tar, </li>
<li>more, less</li>
<li><p>sudo </p>
<p>and so forth. </p></li>
</ul>
<p>Red Hat has a "minimal" - I see Ubuntu has: Core, MinimalCD, and NetBoot, however, these seem to require network and go and install the "base" Ubuntu image with this sort of stuff. For example, I just did the "Mini"CD which is 57MB, and I didn't select "base" or "standard system utilities", however, it still installed all sorts of stuff... 1.2GB total. 150 packages and 120 libraries... </p>
<p>Research:<br>
This one doesn't answer the question, is too old to resurrect, and the answer starts with "Perhaps" : <a href="https://askubuntu.com/questions/652422/ubuntu-server-minimal-package">Ubuntu Server minimal package</a> </p>
<p>Further goals include minimizing disk and memory usage for VM/Cloud cost savings. </p>
| 0non-cybersec
| Stackexchange | 407 | 1,267 |
Pointers in Swift. <p>I'm trying to understand the use of pointers in Swift, in particular: <code>Unsafe[Mutable]Pointer</code> and <code>UnsafeRaw[Mutable]Pointer</code>. I have several questions on the subject.</p>
<ol>
<li><p>Is <code>UnsafePointer <T></code> equal to <code>const T * Pointer</code> in ? and <code>UnsafeMutablePointer <T></code> is equal to <code>T * Pointer</code> in C?</p></li>
<li><p>What is the difference between <code>Unsafe[Mutable]Pointer</code> and <code>UnsafeRaw[Mutable]Pointer</code>?</p></li>
<li><p>Why does this compile</p></li>
</ol>
<p></p>
<pre><code>func receive(pointer: UnsafePointer<Int> ) {
print("param value is: \(pointer.pointee)")
}
var a: Int = 1
receive(pointer: &a) // prints 1
</code></pre>
<p>but this gives me an error?</p>
<p></p>
<pre><code>var a: Int = 1
var pointer: UnsafePointer<Int> = &a // error : Cannot pass immutable value of type 'Int' as inout argument
</code></pre>
| 0non-cybersec
| Stackexchange | 355 | 979 |
Firefox: make "file://path/to/a/directory/" open Windows Explorer. <p>Is there a way to make FireFox open a Windows Explorer view of the directory when clicking a hyperlink with a href that begins with <code>file://</code> and specifically points to a directory, not a file (perhaps even only when it expicitly does so by ending with a trailing delimiter <code>/</code>?)</p>
<p>Ideally it would do as prescribed under <code>HKEY_CLASSES_ROOT\Folder\shell\open\command</code> (I see now there's something else there under newer Windows versions than what I remember from XP...), but there's <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/bb762153(v=vs.85).aspx" rel="nofollow noreferrer">a Shell API call for that</a>... </p>
<p>Is this possible with changes to <code>about:config</code>? Is it possible with an add-on? Should I post this as a feature request on bugzilla?</p>
| 0non-cybersec
| Stackexchange | 264 | 907 |
$(1-ba)$ left-invertible $\implies (1-ab)$ left-invertible. <p>Suppose <span class="math-container">$(1-ba)$</span> in a ring <span class="math-container">$R$</span> is left-invertible. Then we wish to show that <span class="math-container">$(1-ba)$</span> is left invertible and explicitly construct its inverse. </p>
<p>We have <span class="math-container">$Rb(1-ab)=R(1-ba)b=Rb \subseteq R(1-ab)$</span>. I'm unsure of why the last equality is true <span class="math-container">$R(1-ba)b=Rb$</span>. We do know that <span class="math-container">$(1-ba)$</span> is left-invertible and so there is an <span class="math-container">$x \in R$</span> such that <span class="math-container">$x(1-ba)=1$</span> but I don't know how to actually make the conclusion. Then we conclude that <span class="math-container">$1 \in Rb \implies 1 \in R(1-ab)$</span> and so <span class="math-container">$(1-ab)$</span> is left-invertible as is <span class="math-container">$b$</span>. We have a <span class="math-container">$y \in R$</span> such that <span class="math-container">$yb=1$</span>. Thus, the explicitly constructed inverse is</p>
<p><span class="math-container">$$(yxb)(1-ab)=(yx)(1-ba)b=yb=1$$</span></p>
<p>I'm fairly confident about the construction of the inverse but the set equality has lost me. </p>
<p>(A somewhat relevant post <a href="https://math.stackexchange.com/questions/2341289/in-a-ring-1-ab-is-invertible-implies-1-ba-is-invertible-from-scratch">In a ring, <span class="math-container">$1-ab$</span> is invertible <span class="math-container">$\implies$</span> <span class="math-container">$1-ba$</span> is invertible (from scratch)</a>)</p>
| 0non-cybersec
| Stackexchange | 577 | 1,662 |
IAmA 74-time Jeopardy! champion, Ken Jennings. I will not be answering in the form of a question.. Hey Redditors!
I'll be here on and off today in case anyone wants to Ask Me Anything. Someone told me the questions here can be on any subject, within reason. Well, to me, "within reason" are the two lamest words in the English language, even worse than "miniature golf" or "Corbin Bernsen." So no such caveats apply here. Ask Me ANYTHING.
I've posted some proof of my identity on my blog:
http://ken-jennings.com/blog/?p=2614
and on "Twitter," which I hear is very popular with the young people.
http://twitter.com/kenjennings
**Updated to add**: You magnificent bastards! You brought down my blog!
**Updated again to add**: Okay, since there are only a few thousand unanswered questions now, I'm going to have to call this. (Also, I have to pick up my kids from school.)
But I'll be back, Reddit! When you least expect it! MWAH HA HA! Or, uh, when I have a new book to promote. One of those. Thanks for all the fun.
**Updated posthumously to add**: You can always ask further questions on the [message boards](http://ken-jennings.com/messageboards/) at my site. You can sign up for my [weekly email trivia quiz](http://ken-jennings.com/blog/) or even [buy books](http://www.ken-jennings.com/brainiac.html) there as well.[/whore] | 0non-cybersec
| Reddit | 393 | 1,350 |
Compute $\oint_{\partial D_3(0)}\frac{\cos(z+4)}{z^2+1}dz$. <p>I want to compute <span class="math-container">$$\oint_{\partial D_3(0)}\frac{\cos(z+4)}{z^2+1}dz$$</span> without using the residue theorem. My plan was to do a partial fractians decomposition: <span class="math-container">$$\frac{\cos(z+4)}{z^2+1}=\frac{i}{2}\cos(z+4)\left(\frac{-1}{z-i}+\frac{1}{z+i}\right)$$</span>And then I want to use the Cauchy integral formula: <span class="math-container">$$\oint_{\partial D_3(0)}\frac{\cos(z+4)}{z^2+1}dz=\frac{i}{2}\oint\frac{-\cos(z+4)}{z-i}dz+\frac{i}{2}\oint\frac{\cos(z+4)}{z+i}dz$$</span> <span class="math-container">$$=-\frac{i}{2}\cos(4+i)+\frac{i}{2}\cos(4-i)$$</span></p>
<p>Is this correct? If not, how do I approach it?</p>
| 0non-cybersec
| Stackexchange | 303 | 748 |
Solution for non-IT to update certain AD user account info (phone/address/title/etc.). How do you all manage updates to AD user account info like that found on the General/Address/Telephones/Organization tabs in AD? Today in our organization when someone is promoted (for instance) three different departments separately maintain this info, IT, HR, and Corporate Services (for the corp wide phone/address list.) I'd like to make it so that only one group manages these changes, and ideally have it not be IT since there's really nothing technical about changing a person's job title or department name. Sure, we may have to physically move them, or change their group memberships, but the rest doesn't *have to be* maintained by IT, right?
I want to have the fabled "single source of truth" for user info, which will then allow us to have the correct info also available in Outlook/Exchange, Lync, SharePoint, company directory, etc. I'd also like to start storing thumbnail pics of associates in there so they automatically appear in Outlook/Lync/SP/etc.
My question is... do any of you already do this? If so, how do you give access to someone outside of IT to do it? Obviously I could give them access to ADUC and tweak the permissions just right... but that seems cumbersome for us to maintain (as we grow and add OU's) and them to use. Is there software out there that makes this management easy? Custom apps you've built? Something else I'm not thinking about?
Edit: 450 users and growing | 0non-cybersec
| Reddit | 339 | 1,497 |
Command to create a file owned by another user. <p>I created a directory <code>test</code> owned by the <code>root</code> user, and then I created a file called <code>F1</code> inside <code>test</code> , now I need to create a file called <code>T5</code> inside <code>test</code> but by a user called <code>student</code></p>
<p>What is the command to do that? </p>
<p>This what I did:</p>
<pre><code>root@mylamp:/# mkdir test
root@mylamp:/# touch F1
</code></pre>
<p>Now I need to access <code>test</code> by the user <code>student</code> to create <code>F5</code></p>
<pre><code>student@mylamp:/test$
</code></pre>
| 0non-cybersec
| Stackexchange | 224 | 623 |
python if elif else statement. <p>I'm trying to create a program with python that calculate the cost for shipping. </p>
<p>However, I can't run the program to where it works properly. </p>
<p>What ever my total is the same amount comes out as $6 for US and $8 for Canada. I can't seem to get pass that.</p>
<pre><code>total = raw_input('What is the total amount for your online shopping?')
country = raw_input('Shipping within the US or Canada?')
if country == "US":
if total <= "50":
print "Shipping Costs $6.00"
elif total <= "100":
print "Shipping Costs $9.00"
elif total <= "150":
print "Shipping Costs $12.00"
else:
print "FREE"
if country == "Canada":
if total <= "50":
print "Shipping Costs $8.00"
elif total <= "100":
print "Shipping Costs $12.00"
elif total <= "150":
print "Shipping Costs $15.00"
else:
print "FREE"
</code></pre>
| 0non-cybersec
| Stackexchange | 310 | 967 |
Use Microphone and Headphones on a splitter. <p>I bought this thing:
<a href="http://www.dhgate.com/store/product/3-5mm-1-male-to-2-female-earphone-headphone/157719473.html" rel="nofollow noreferrer">http://www.dhgate.com/store/product/3-5mm-1-male-to-2-female-earphone-headphone/157719473.html</a>
From a shop.My laptop have only a jack port and i don't have Headphones with microphone.And i need this thing to connect my microphone and my headphones on it.I don't know if this works.I tryed this and i can't find the microphone on any program.The headphones are working.</p>
<p>Windows 7 Premium Home |x86| Quad Core</p>
| 0non-cybersec
| Stackexchange | 206 | 624 |
Bounds on the Christoffel symbols in normal coordinates. <p>Given a smooth closed Riemannian manifold <span class="math-container">$(M,g)$</span> with injectivity radius <span class="math-container">$i_M$</span> I can choose for every <span class="math-container">$x \in M$</span> an orthonormal basis of <span class="math-container">$T_x M$</span> and a normal coordinate system <span class="math-container">$ \phi$</span> in <span class="math-container">$x$</span>, such that the Christoffel symbols satisfy
<span class="math-container">$$
(\Gamma^k_{ij})_x(0)=0.
$$</span>
By differentiability we have for <span class="math-container">$p \in B_{i_M}(0)$</span>
<span class="math-container">$$
|(\Gamma^k_{ij})_x(p)| \leq |p| \sup_{p \in B_{i_M}(0)} |D(\Gamma^k_{ij})(p)|
$$</span>
How can I bound <span class="math-container">$\sup_{p \in B_{i_M}(0)}|D(\Gamma^k_{ij})(p)|$</span> in terms of the curvature tensor <span class="math-container">$R$</span> of <span class="math-container">$(M,g)$</span>?
I found that the Christoffel symbols satisfy
<span class="math-container">$$
\Gamma^k_{ij,l} = -\frac{1}{3} ( R^k_{jkl} + R^k_{kjl}).
$$</span>
Does this imply that
<span class="math-container">$$
\sup_{p \in B_{i_M}(0)} |D(\Gamma^k_{ij})(p)| \leq \sup_{p \in B_{i_M}(0)} \sup_{ijkl} R^k_{jkl}(\phi^{-1}(p)).
$$</span></p>
| 0non-cybersec
| Stackexchange | 490 | 1,329 |
How to see if filebeat data is being sent to logstash. <p>When I open up Kibana interface, I get an error to configure index when logstash-* is entered as a query:</p>
<p>kibana error: please specify a default index pattern</p>
<p>How can I see if filebeat is sending logs to logstash? I followed the filebeat and ELK stack tutorials exactly. I can see data when I enter in filebeat-* into Kibana, but nothing when I enter in logstash-* into Kibana.</p>
| 0non-cybersec
| Stackexchange | 134 | 456 |
Proving existence of unique polynomial satisfying some integral. <p>I came across a problem that I was having some trouble with.</p>
<p>Fix a positive integer $n$. Let $f(x) \in C(R)$ be a (real valued) continuous function.
Show that there exists a unique polynomial $q(x) \in P_n(R)$, such that for every
polynomial $p(x) \in P_n(x)$ we have $\int^1_0 p(x)f(x)dx=\int^1_0 p(x)q(x)dx$.</p>
<p>I know that typically to solve uniqueness questions, you need to assume another $g(x)$ exists and then manipulate the resulting equation(s) to show that $g(x)=q(x)$. However, it's not so clear to me here how I should go about this here. I think that the $p(x)$ might be confusing me in this question.</p>
<p>If anyone can give me some pointers, it would be greatly appreciated. Thanks!</p>
| 0non-cybersec
| Stackexchange | 249 | 786 |
How much business logic should the database implement?. <p>I've worked in some projects where most of the business logic was implemented on the database (mostly through stored procedures). On the other side, I've heard from some fellow programmers that this is a bad practice ("Databases are there to store data. Applications are there to do the rest").</p>
<p>Which of these approaches is the generally better?</p>
<p>The pros of implementing business logic in the DB I can think of are:</p>
<ul>
<li>Centralization of business logic;</li>
<li>Independency of application type, programming language, OS, etc;</li>
<li>Databases are less prone to technology migration or big refactorings (AFAIK);</li>
<li>No rework on application technology migration (e.g.: .NET to Java, Perl to Python, etc).</li>
</ul>
<p>The cons:</p>
<ul>
<li>SQL is less productive and more complex for business logic programming, due to the lack of libraries and language constructs the most application-oriented languages offer;</li>
<li>More difficult (if possible at all) code reuse through libraries;</li>
<li>Less productive IDEs.</li>
</ul>
<p>Note: The databases I'm talking about are relational, popular databases like SQL Server, Oracle, MySql etc.</p>
<p>Thanks!</p>
| 0non-cybersec
| Stackexchange | 335 | 1,258 |
Can't "wget" from my home Debian Lenny server! But the ports are opened!. <p>I have a very strange problem for me.
In this example dns and IP is hiden for security reason.
When I try from putty manager to connect to my Debian and write next command:</p>
<pre><code> debian:~# wget http://myhost.no-ip.org:1082/archive.tar
--2011-04-03 03:35:27-- http://myhost.no-ip.org:1082/archive.tar
Resolving myhost.no-ip.org... xx.10x.66.xxx
Connecting to myhost.no-ip.org|xx.10x.66.xxx|:1082... failed: Connection timed out.
Retrying.
--2011-04-03 03:38:42-- (try: 2) http://myhost.no-ip.org:1082/cccam.tar
Connecting to myhost.no-ip.org|xx.10x.66.xxx|:1082... failed: Connection timed out.
Retrying.
--2011-04-03 03:41:53-- (try: 3) http://myhost.no-ip.org:1082/cccam.tar
Connecting to myhost.no-ip.org|xx.10x.66.xxx|:1082... failed: Connection timed out.
Retrying.
</code></pre>
<p>..I can't connect to my Debian server! This message stay till I press ctrl+z.</p>
<p>But when I try to wget any other site it working!
Very strange thing is when I type:</p>
<pre><code>http://myhost.no-ip.org:1082/archive.tar
</code></pre>
<p>command in my firefox web browser the file is reachable and download is strated.
So, my port is open. Am I right?
What can be the problem?
Here is my config from networking :</p>
<pre><code>debian:~# cat /etc/networking/interfaces
cat: /etc/networking/interfaces: No such file or directory
debian:~# cat /etc/network/interfaces
### The loopback network interface
auto lo
iface lo inet loopback
###The primary network interface
allow-hotplug eth1
auto eth1
iface eth1 inet static
address 192.168.50.111
netmask 255.255.255.0
broadcast 192.168.50.255
gateway 192.168.50.99
debian:~#
</code></pre>
<p>The archive.tar file is putted to /vat/www/archive.tar
Local port 80 is forwared in my router to external port 1082
My no.ip dns address is vaild and reachable through firefox.
Have someone any suggestion what coud be a problem?
Thx.</p>
<p>..I can't connect to my Debian server! This message stay till I press ctrl+z.</p>
<p>But when I try to wget any other site it working!
Very strange thing is when I type:</p>
<pre><code>http://myhost.no-ip.org:1082/archive.tar
</code></pre>
<p>command in my firefox web browser the file is reachable and download is strated.
So, my port is open. Am I right?
What can be the problem?
Here is my config from networking :</p>
<pre><code>debian:~# cat /etc/networking/interfaces
cat: /etc/networking/interfaces: No such file or directory
debian:~# cat /etc/network/interfaces
### The loopback network interface
auto lo
iface lo inet loopback
###The primary network interface
allow-hotplug eth1
auto eth1
iface eth1 inet static
address 192.168.50.111
netmask 255.255.255.0
broadcast 192.168.50.255
gateway 192.168.50.99
debian:~#
</code></pre>
<p>The archive.tar file is putted to /vat/www/archive.tar
Local port 80 is forwared in my router to external port 1082
My no.ip dns address is vaild and reachable through firefox.
Have someone any suggestion what coud be a problem?
Thx.</p>
| 0non-cybersec
| Stackexchange | 1,066 | 3,074 |
Write all exception in file. <p>I'm using Timber to write some logs to file which located on device. For now, I'm writing my selected logs and some response from server using HTTP interceptor. But I want to write in file all exception (fatal, for example). Is it possible with Timber or other library?</p>
<p>For now I'm using Fabric, but my app not always have internet connection with outer world</p>
<p>P.S. I want to write ALL fatal exception without try/catch</p>
<h2>TimberLooger.class</h2>
<pre><code>public class FileLoggingTree
{
/**
* Sends an error message to LogCat and to a log file.
* @param context The context of the application.
* @param logMessageTag A tag identifying a group of log messages. Should be a constant in the
* class calling the logger.
* @param logMessage The message to add to the log.
*/
public static void e(Context context, String logMessageTag, String logMessage)
{
if (!Log.isLoggable(logMessageTag, Log.ERROR))
return;
int logResult = Log.e(logMessageTag, logMessage);
if (logResult > 0)
logToFile(context, logMessageTag, logMessage);
}
/**
* Sends an error message and the exception to LogCat and to a log file.
* @param context The context of the application.
* @param logMessageTag A tag identifying a group of log messages. Should be a constant in the
* class calling the logger.
* @param logMessage The message to add to the log.
* @param throwableException An exception to log
*/
public static void e
(Context context, String logMessageTag, String logMessage, Throwable throwableException)
{
if (!Log.isLoggable(logMessageTag, Log.ERROR))
return;
int logResult = Log.e(logMessageTag, logMessage, throwableException);
if (logResult > 0)
logToFile(context, logMessageTag,
logMessage + "\r\n" + Log.getStackTraceString(throwableException));
}
// The i and w method for info and warning logs
// should be implemented in the same way as the e method for error logs.
/**
* Sends a message to LogCat and to a log file.
* @param context The context of the application.
* @param logMessageTag A tag identifying a group of log messages. Should be a constant in the
* class calling the logger.
* @param logMessage The message to add to the log.
*/
public static void v(Context context, String logMessageTag, String logMessage)
{
// If the build is not debug, do not try to log, the logcat be
// stripped at compilation.
if (!BuildConfig.DEBUG || !Log.isLoggable(logMessageTag, Log.VERBOSE))
return;
int logResult = Log.v(logMessageTag, logMessage);
if (logResult > 0)
logToFile(context, logMessageTag, logMessage);
}
/**
* Sends a message and the exception to LogCat and to a log file.
* @param logMessageTag A tag identifying a group of log messages. Should be a constant in the
* class calling the logger.
* @param logMessage The message to add to the log.
* @param throwableException An exception to log
*/
public static void v
(Context context,String logMessageTag, String logMessage, Throwable throwableException)
{
// If the build is not debug, do not try to log, the logcat be
// stripped at compilation.
if (!BuildConfig.DEBUG || !Log.isLoggable(logMessageTag, Log.VERBOSE))
return;
int logResult = Log.v(logMessageTag, logMessage, throwableException);
if (logResult > 0)
logToFile(context, logMessageTag,
logMessage + "\r\n" + Log.getStackTraceString(throwableException));
}
// The d method for debug logs should be implemented in the same way as the v method for verbose logs.
/**
* Gets a stamp containing the current date and time to write to the log.
* @return The stamp for the current date and time.
*/
private static String getDateTimeStamp()
{
Date dateNow = Calendar.getInstance().getTime();
// My locale, so all the log files have the same date and time format
return (DateFormat.getDateTimeInstance
(DateFormat.SHORT, DateFormat.SHORT, Locale.CANADA_FRENCH).format(dateNow));
}
/**
* Writes a message to the log file on the device.
* @param logMessageTag A tag identifying a group of log messages.
* @param logMessage The message to add to the log.
*/
private static void logToFile(Context context, String logMessageTag, String logMessage)
{
try
{
// Gets the log file from the root of the primary storage. If it does
// not exist, the file is created.
File logFile = new File(Environment.getRootDirectory(),
"TestApplicationLog.txt");
if (!logFile.exists())
logFile.createNewFile();
// Write the message to the log with a timestamp
BufferedWriter writer = new BufferedWriter(new FileWriter(logFile, true));
writer.write(String.format("%1s [%2s]:%3s\r\n",
getDateTimeStamp(), logMessageTag, logMessage));
writer.close();
// Refresh the data so it can seen when the device is plugged in a
// computer. You may have to unplug and replug to see the latest
// changes
MediaScannerConnection.scanFile(context,
new String[] { logFile.toString() },
null,
null);
}
catch (IOException e)
{
Log.e("com.cindypotvin.Logger", "Unable to log exception to file.");
}
}
}
</code></pre>
<h2>TimberLogger.class</h2>
<pre><code>public class TimberLooger extends Timber.DebugTree {
private static final String TAG = FileLoggingTree.class.getSimpleName();
private Context context;
public TimberLooger(Context context) {
this.context = context;
}
@Override
protected void log(int priority, String tag, String message, Throwable t) {
try {
File direct = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/FileLocation");
if (!direct.exists()) {
direct.mkdir();
}
String fileNameTimeStamp = new SimpleDateFormat("dd-MM-yyyy", Locale.getDefault()).format(new Date());
String logTimeStamp = new SimpleDateFormat("E MMM dd yyyy 'at' hh:mm:ss:SSS aaa", Locale.getDefault()).format(new Date());
String fileName = fileNameTimeStamp + ".html";
File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/FileLocation" + File.separator + fileName);
file.createNewFile();
if (file.exists()) {
OutputStream fileOutputStream = new FileOutputStream(file, true);
fileOutputStream.write(("<p style=\"background:lightgray;\"><strong style=\"background:lightblue;\">&nbsp&nbsp" + logTimeStamp + " :&nbsp&nbsp</strong>&nbsp&nbsp" + message + "</p>").getBytes());
fileOutputStream.close();
}
//if (context != null)
//MediaScannerConnection.scanFile(context, new String[]{file.getAbsolutePath()}, null, null);
} catch (Exception e) {
Log.e(TAG, "Error while logging into file : " + e);
}
}
}
</code></pre>
| 0non-cybersec
| Stackexchange | 2,029 | 7,747 |
What is `tic` and what can I do about it using 100% CPU?. <p>I have a process named <code>tic</code> that occasionally shows its ugly face in <code>htop</code> or Activity Monitor, consuming around 100% CPU. I couldn't find any good info on it last time I tried. What is it for, what would make it suck up my processor cycles, and what can be done about it. </p>
<p>I'm on the latest sub-version of Mojave: 10.14.3 (18D42).</p>
<p>Update: this happened again, and about 80% of the lines displayed by <code>sudo lsof -p PID</code> were related in some way to Visual Studio Code. I don't know if that's a useful clue for anyone about the cause... but I'll put it out there...</p>
| 0non-cybersec
| Stackexchange | 205 | 683 |
Why can't this specific device be enumerated by UsbManager.getDevicesList()?. <p>As the title states, I am having troubles enumerating a specific USB device on a USB capable Android phone using UsbManager.getDeviceList(). I've had no trouble enumerating and communicating with other USB devices on this and other phones, but this specific USB device cannot be found. It also cannot be enumerated with 3rd party apps such as <a href="https://play.google.com/store/apps/details?id=aws.apps.usbDeviceEnumerator&hl=en" rel="nofollow noreferrer">USB Device Info</a>.</p>
<p>Below are the USB properties enumerated properly on a PC. I've communicated with the device manufacturer who has confirmed that an outside firm certified the device followed the USB 2.0 spec. Originally, my suspicion was that the device was rejected by Android because it omitted the following fields: iManufacturer, iProduct, and iSerialNumber, which were included by other compliant devices. However, it seems these fields aren't necessary after reviewing this excerpt from Section 9.5 of the <a href="http://www.usb.org/developers/docs/usb20_docs/" rel="nofollow noreferrer">USB 2.0 Spec</a>:</p>
<blockquote>
<p>Where appropriate, descriptors contain references to string descriptors that provide displayable information describing a descriptor in human-readable form. The inclusion of string descriptors is optional. However, the reference fields within descriptors are mandatory. If a device does not support string descriptors, string reference fields must be reset to zero to indicate no string descriptor is available.</p>
</blockquote>
<p>My question, then, is what is causing the UsbManager to reject enumeration of this USB device? And, more importantly, is there anything I can do about it to force Android to enumerate this device? Ideally, I am most interested in a solution that does not require root access, but it is not necessarily a deal-breaker.</p>
<p><a href="https://i.stack.imgur.com/qRIIC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qRIIC.png" alt="USB properties"></a></p>
<hr>
<p>EDIT: Some sample code.</p>
<pre><code>UsbManager usbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
HashMap<String, UsbDevice> deviceList = usbManager.getDeviceList();
// When I plug in this USB device, deviceList is empty.
// Other devices are discoverable, however.
</code></pre>
<hr>
<p>EDIT 2: I've tested with some more phones. I have successfully enumerated the USB device with the following phones:</p>
<ul>
<li>Note 2</li>
<li>LG-V400</li>
</ul>
<p>The following devices could not enumerate the device:</p>
<ul>
<li>Nexus 5</li>
<li>Galaxy S4, S5, S6</li>
<li>LG G2, 4G LTE</li>
</ul>
<hr>
<p>EDIT 3: <a href="https://gist.github.com/MikeOrtiz/92fc07d4761ce6e0b4d3" rel="nofollow noreferrer">Here are the logs</a> from calling <code>adb shell dmesg</code> on a Nexus 5 after plugging in the USB device. You can clearly see on lines 4-16 that the phone fails to enumerate the device.</p>
| 0non-cybersec
| Stackexchange | 861 | 3,041 |
Side plank foot placement. First off, sorry if this has been talked about before, but I couldn't find it in the FAQ or exercise wiki.
My question is, are there any advantages or disadvantages to the different foot placements in the side plank?
I was first taught to perform it like this http://mandee.files.wordpress.com/2008/03/side-plank.jpg with one foot on the other, but if I am barefoot I feel like the bones in my feet are going to crumble
More recently I started doing it like this http://www.sparkpeople.com/assets/exercises/Side-Plank.gif just because I can hold it longer and my ankles don't go out before my obliques. Am I doing it wrong? Should I switch back to the foot on foot and deal with the pain or am I good doing the one foot in front of the other?
Here is a slightly nsfw pic of the second version http://i.imgur.com/dqrk3BF.jpg | 0non-cybersec
| Reddit | 228 | 854 |
The Point of Hollandaise?. Okay, serious question, not trolling.
I've always felt like I've missed the point of hollandaise, specifically in the context of Eggs Benedict. It's a pain to make right and is basically just adding a redundant egg sauce to eggs. I also tend to batch-cook my dinners ahead of time (single dude on a budget!), and the fact that it doesn't keep makes experimenting with other hollandaise vehicles like asparagus or chicken somewhat impractical.
Since hollandaise is one of the classic sauces, I feel like I should learn how to do it right. What am I not understanding? Have I always had bad hollandaise? Is it just not to my taste?
[UPDATE](https://www.reddit.com/r/Cooking/comments/e5m0cm/update_the_point_of_hollandaise/?utm_medium=android_app&utm_source=share) | 0non-cybersec
| Reddit | 217 | 791 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
Parse String date in (yyyy-MM-dd) format. <p>I have a string in the form "2013-09-18". I want to convert it into a java.util.Date.
I am doing this</p>
<pre><code>SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date convertedCurrentDate = sdf.parse(currentDateText);
</code></pre>
<p>The convertedCurrentDate is coming as 'Wed Sep 18 00:00:00 IST 2013'</p>
<p>I want my output in the form '2013-09-18'</p>
<p>Hour, minutes and seconds shouldnt come and it should be in the form yyyy-MM-dd.</p>
| 0non-cybersec
| Stackexchange | 181 | 509 |
How to have only 1 ListView item active and others disabled in a Xamarin Forms app (android). <p>Having a ListView as below with items that represent <code>Tasks</code> with their respective <code>Status</code>: </p>
<p><a href="https://i.stack.imgur.com/6w4XO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6w4XO.png" alt="ListView"></a></p>
<p>The <code>TasksPage</code> XAML: </p>
<pre><code><?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:iFacilityMob;assembly=iFacilityMob"
x:Class="iFacilityMob.TasksPage">
<ContentPage.Content>
...
<ListView
Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2"
x:Name="TasksListView"
HasUnevenRows="True"
SeparatorVisibility="None"
SelectionMode="None"
IsPullToRefreshEnabled="True"
Refreshing="TasksListView_OnRefreshing"
CachingStrategy="RetainElement">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<local:TaskCardTemplate></local:TaskCardTemplate>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
...
</ContentPage.Content>
</code></pre>
<p></p>
<p>TaskCardTemplate XAML:</p>
<pre><code><ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="iFacilityMob.TaskCardTemplate">
<ContentView.Content>
<Frame x:Name="Frame"
IsClippedToBounds="True"
HasShadow="True"
Padding="2,5,5,2"
BackgroundColor="White"
Margin="10"
CornerRadius="5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!-- Vertical colored bar on the left which indicates the current Status -->
<BoxView x:Name="BVInitial" Grid.Row="0" Color="Green" IsVisible="{Binding InitialStatus}" Grid.RowSpan="2" Grid.Column="0" WidthRequest="8" Margin="0" CornerRadius="3"/>
<BoxView x:Name="BVStarted" Grid.Row="0" Color="DarkOrange" IsVisible="{Binding Started}" Grid.RowSpan="2" Grid.Column="0" WidthRequest="8" Margin="0" CornerRadius="3"/>
<BoxView x:Name="BVPaused" Grid.Row="0" Color="DodgerBlue" IsVisible="{Binding Paused}" Grid.RowSpan="2" Grid.Column="0" WidthRequest="8" Margin="0" CornerRadius="3"/>
<BoxView x:Name="BVFinished" Grid.Row="0" Color="Black" IsVisible="{Binding Finished}" Grid.RowSpan="2" Grid.Column="0" WidthRequest="8" Margin="0" CornerRadius="3"/>
<!-- Button Start -->
<Button Grid.Row="0" Grid.Column="1" x:Name="BtnStartTask" Text="Start" TextColor="White" BackgroundColor="Green" CornerRadius="5" Margin="5,5,0,0" HeightRequest="40"
Clicked="BtnStartTask_OnClicked" IsEnabled="{Binding StartEnabledAndVisible}" IsVisible="{Binding StartEnabledAndVisible}" CommandParameter="{Binding .}" />
<!-- Button Pause -->
<Button Grid.Row="0" Grid.Column="1" x:Name="BtnPauseTask" Text="Pause" TextColor="White" BackgroundColor="DodgerBlue" CornerRadius="5" Margin="5,5,0,0" HeightRequest="40"
Clicked="BtnPauseTask_OnClicked" IsEnabled="{Binding PauseEnabled}" IsVisible="{Binding PauseVisible}" CommandParameter="{Binding . }" />
<!-- Button End -->
<Button Grid.Row="1" Grid.Column="1" x:Name="BtnEndTask" Text="End" TextColor="White" BackgroundColor="Red" CornerRadius="5" Margin="5,0,0,5" HeightRequest="40"
Clicked="BtnEndTask_OnClicked" IsEnabled="{Binding EndEnabled}" CommandParameter="{Binding .}" />
...
<!-- The data of each Task, not important in this case -->
</Grid>
</Frame>
</ContentView.Content>
</code></pre>
<p></p>
<p>By clicking the buttons I can change the Status and the view of any <code>Task</code> item.</p>
<pre><code>private async void BtnStartTask_OnClicked(object sender, EventArgs e)
{
var btn = (Button)sender;
if (btn.CommandParameter is TaskViewModel model)
{
// Task
if (model.ModelType == Enums.ModelType.Task.ToString())
{
await _api.UpdateStatus(new StatusUpdateDTO
{ID = model.ID, ModelType = Enums.ModelType.Task.ToString(), StatusID = (int) Enums.TaskStatus.Started});
}
else// Ticket
{
await _api.UpdateStatus(new StatusUpdateDTO
{ ID = model.ID, ModelType = Enums.ModelType.Ticket.ToString(), StatusID = (int)Enums.TicketStatus.Assigned });
}
UpdateView(Enums.Buttons.Start);
}
</code></pre>
<p>}</p>
<pre><code>private void UpdateView(Enums.Buttons buttonPressed)
{
switch (buttonPressed)
{
case Enums.Buttons.Start:
// Hide Start
BtnStartTask.IsEnabled = false;
BtnStartTask.IsVisible = false;
// Show Pause
BtnPauseTask.IsEnabled = true;
BtnPauseTask.IsVisible = true;
// Enable End
BtnEndTask.IsEnabled = true;
BtnEndTask.IsVisible = true;
BVStarted.IsVisible = true;
BVFinished.IsVisible = false;
BVInitial.IsVisible = false;
BVPaused.IsVisible = false;
break;
case Enums.Buttons.Pause:
...
case Enums.Buttons.End:
...
}
}
</code></pre>
<p>How can I achieve that once a <code>Task</code> is <code>Started</code>, I somehow disable (an overlay and buttons disabled) all the other <code>Tasks</code> and eventually re-enable them when the active Task is <code>Paused</code> or was <code>Ended</code> ?</p>
<p>Edit:</p>
<p>TasksPage ViewModel:</p>
<pre><code>public class TaskViewModel: INotifyPropertyChanged
{
public int ID { get; set; }// TaskID or TicketID
public string ModelType { get; set; }// Task or Ticket
public string Title { get; set; }
public string Description { get; set; }
public int FloorID { get; set; }
public string FloorName { get; set; }
public int AreaID { get; set; }
public string AreaName { get; set; }
public int? ScheduledTaskID { get; set; }
public int? ScheduleID { get; set; }
private int _statusID { get; set; } // Task Status or TicketTask
public int StatusID
{
get => _statusID;
set
{
_statusID = value;
OnPropertyChanged();
}
}
public bool ActiveItem => (IsTask && (StatusID == (int) Enums.TaskStatus.Started )) || IsTicket && (StatusID == (int) Enums.TicketStatus.InProgress);
public bool NotActive => !ActiveItem;
public List<ProductDTO> Products { get; set; }
public bool IsTask => ModelType == ModelTypes.Task.ToString();
public bool IsTicket => ModelType == ModelTypes.Ticket.ToString();
public bool StartEnabledAndVisible
{
get
{
if (IsTask && StatusID == (int)Enums.TaskStatus.Created || StatusID == (int) Enums.TaskStatus.Paused)
{
return true;
}
return IsTicket && StatusID == (int) Enums.TicketStatus.Assigned;
}
}
public bool PauseEnabled
{
get
{
if (IsTask && StatusID == (int)Enums.TaskStatus.Started)
{
return true;
}
return IsTicket && StatusID == (int)Enums.TicketStatus.InProgress;
}
}
public bool PauseVisible
{
get
{
if (IsTask && StatusID == (int)Enums.TaskStatus.Started || StatusID == (int)Enums.TaskStatus.Finished)
{
return true;
}
return IsTicket && StatusID == (int)Enums.TicketStatus.InProgress || StatusID == (int)Enums.TicketStatus.Closed;
}
}
public bool EndEnabled
{
get
{
if (IsTask && StatusID == (int)Enums.TaskStatus.Started || StatusID == (int)Enums.TaskStatus.Paused)
{
return true;
}
return IsTicket && StatusID == (int)Enums.TicketStatus.InProgress || StatusID == (int)Enums.TicketStatus.Assigned;
}
}
public bool InitialStatus => IsTask && StatusID == (int) Enums.TaskStatus.Created || IsTicket && StatusID == (int)Enums.TicketStatus.Assigned;
public bool Started => IsTask && StatusID == (int)Enums.TaskStatus.Started || IsTicket && StatusID == (int)Enums.TicketStatus.InProgress;
public bool Paused => IsTask && StatusID == (int)Enums.TaskStatus.Paused || IsTicket && StatusID == (int)Enums.TicketStatus.Assigned;
public bool Finished => IsTask && StatusID == (int)Enums.TaskStatus.Finished || IsTicket && StatusID == (int)Enums.TicketStatus.Closed;
public string ProductsLabel
{
get
{
return Products != null ? string.Join(", ", Products.Select(p => p.Name)) : "";
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
</code></pre>
<p>And in TasksPage, the parent page: </p>
<pre><code>protected override async void OnAppearing()
{
_scheduledTasks = new ObservableCollection<TaskViewModel>(_schedule.ScheduledTasks.OrderBy(st => st.Finished));
TasksListView.ItemsSource = _scheduledTasks;
}
</code></pre>
<p>TasksPage model:</p>
<pre><code>public class ScheduleDTO
{
public int ScheduleID { get; set; }
public DateTime ScheduleDate { get; set; }
public int WorkerID { get; set; }
public bool OnHoliday { get; set; }
public DateTime StartDatetime { get; set; }
public DateTime StopDatetime { get; set; }
public DateTime CurrentDateTime { get; set; }
public DateTime? LoggedInTime { get; set; }
public DateTime? LoggedOutTime { get; set; }
public string LateReason { get; set; }
public string EarlyLogoutReason { get; set; }
public string LateLogoutReason { get; set; }
// This should be the source for the Listview
public List<TaskViewModel> ScheduledTasks { get; set; }
}
</code></pre>
| 0non-cybersec
| Stackexchange | 3,500 | 11,392 |
Quadratic equation with greatest integer functioin. <p>$[x]^2-7[x]+12=0$</p>
<p>find $x$?
where $[x]$ is Greatest Integer function </p>
<p>I have tried to solve the question like this:
putting $[x]=y$ , we have the equation:
$y^2-7x+12=0$
by solving this equation we get $y=3$ and $y=4$ </p>
<p>since $y=[x]$, therefore $[x]=3$ and $[x]=4$</p>
<p>according to the above statement we can say that $x=[3,5)$</p>
<p>I want to know weather my solution is correct or not.
and if it not correct then how to solve this equation.</p>
| 0non-cybersec
| Stackexchange | 202 | 536 |
Connecting two HDMI screen to laptop via type C port using USB hub. <p>Connecting two (USB 3.0 to HDMI adapter) to (Type C to 4 Port USB 3.0 HUB) and connecting the type c to my HP laptop windows 10 will works in order to connect two HDMI screen ?</p>
<p>example of hardware:</p>
<ul>
<li><p>Type C to 4 Port USB 3.0 HUB (<a href="https://www.aliexpress.com/item/USB-C-3-1-Type-C-to-4-Port-USB-3-0-HUB-Adapter-For-Apple/32710545605.html" rel="nofollow noreferrer">https://www.aliexpress.com/item/USB-C-3-1-Type-C-to-4-Port-USB-3-0-HUB-Adapter-For-Apple/32710545605.html</a>)</p></li>
<li><p>USB 3.0 to HDMI Output (<a href="https://www.aliexpress.com/item/5Gbps-Input-USB-3-0-to-HDMI-Output-Graphic-Adapter-1080P-Cable-Converter-for-MAC-HDTV/32825312669.html" rel="nofollow noreferrer">https://www.aliexpress.com/item/5Gbps-Input-USB-3-0-to-HDMI-Output-Graphic-Adapter-1080P-Cable-Converter-for-MAC-HDTV/32825312669.html</a>)</p></li>
</ul>
| 0non-cybersec
| Stackexchange | 391 | 943 |
Rainbow Tables: What is the Reduction Used for?. <p>This is a follow up from <a href="https://security.stackexchange.com/questions/379/what-are-rainbow-tables-and-how-are-they-used/440#440">this answer</a>.</p>
<p>The answer is very good, and it put me to thinking and doing some research. I have found another good explanation on <a href="http://kestas.kuliukas.com/RainbowTables/" rel="nofollow noreferrer">this site</a>.</p>
<p>At some point, the author says:</p>
<blockquote>
<p>If the set of plaintexts is [0123456789]{6} (we want a rainbow table of all numeric passwords of length 6), and the hashing function is MD5(), a hash of a plaintext might be MD5("493823") -> "222f00dc4b7f9131c89cff641d1a8c50".
In this case the reduction function R() might be as simple as taking the first six numbers from the hash; R("222f00dc4b7f9131c89cff641d1a8c50") -> "222004".
We now have generated another plaintext from the hash of the previous plaintext, this is the purpose of the reduction function.</p>
</blockquote>
<p>However, I don't seem to have grasped the use of the reduction as it seems pretty arbitrary. How does reducing a hash to its first numbers help retrieving the plaintext. Is the choosing of the reduction (that is selecting the first few number of the hash) really arbitrary? Could I instead of taking the <strong>first</strong> six numbers use, say, the <strong>last</strong> six numbers?</p>
| 1cybersec
| Stackexchange | 426 | 1,418 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.