text
stringlengths 36
35k
| label
class label 2
classes | source
stringclasses 3
values | tokens_length
int64 128
4.1k
| text_length
int64 36
35k
|
---|---|---|---|---|
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 |
Z-index not applying on :hover for flex elements. <p>I have two side by side divs. The right div is set to expand on hover and display a message. I have set the z-index on the expanding div to be <code>z-index: 1</code> and the left div and all its children to be <code>z-index: 0</code>, however the expanding div will only expand as far as the text in the div beside it.</p>
<p>I have read multiple questions here about z-index and flex items but can't work out what I am doing wrong. I have added a higher z-index to my first flex-item as described here <a href="https://stackoverflow.com/questions/45398088/z-index-doesnt-work-with-flex-elements">Z-index doesn't work with flex elements?</a> but that has not fixed it.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>.container {
display: flex;
background-color: lightgray;
height: 48px;
width: 139px;
border-radius: 4px;
}
.container .inner {
height: 48px;
}
.container .inner > div {
display: flex;
z-index: 0;
}
.container .inner.left {
display: flex;
flex-direction: column;
flex: 1 0 auto;
padding-left: 10px;
justify-content: center;
}
.container .inner.right {
display: flex;
flex: 0 1 8px;
background-color: red;
border-radius: 0 4px 4px 0;
overflow: hidden;
transition: 0.3s;
cursor: pointer;
z-index: 1;
}
.container .inner.right .info-msg {
display: none;
transition: 0.3s;
}
.container .inner.right:hover {
flex: 0 1 150px;
}
.container .inner.right:hover .info-msg {
display: flex;
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="container">
<div class="inner left">
<div class="time">9:00am - 5:00pm</div>
<div class="name">Worker</div>
</div>
<div class="inner right">
<div class="info-msg">Message</div>
</div>
</div></code></pre>
</div>
</div>
</p>
| 0non-cybersec
| Stackexchange | 756 | 2,118 |
Trying to compute Lebesgue outer measure of irrationals by constructing a cover. <p>It is known that to compute the Lebesgue outer measure $\lambda^*$ of irrationals $\Bbb{I}$ we make use of the following property:</p>
<p>$$\lambda^*(\Bbb{I}) +\lambda^* (\Bbb{Q}) = \lambda^* (\Bbb{R})$$</p>
<p>and noting that since $\Bbb{Q}$ has zero measure being a countable union of singletons and using countable subadditivity of $\lambda^*$, we thus conclude that $\Bbb{I}$ has full measure and more generally $\lambda^*([a,b]\cap \Bbb{I}) = b-a$</p>
<p>However, in order to better understand what features of uncountable sets controls the value of its Lebesgue outer measure, I tried to compute $\lambda^*([a,b]\cap \Bbb{I})$ by constructing an open cover to exclude all rationals (Without loss of generality, and for ease of writing down the enumeration of rationals I use, we consider $\lambda^*([-1,1]\cap \Bbb{I})$ and the general result can be obtained by appropriate translation and scaling of the interval)</p>
<p>I first give an enumeration of the rationals within $[-1,1]$ as follows:</p>
<p>$S=\{(p, q) \in \Bbb{N}^2 - \{n\in \Bbb{N} : (n+2,1)\} : \pm \frac{p}{q} \in \Bbb{Q} \land \text{lcm} (p,q)=pq\}=\{0,1,-1,\frac{1}{2},-\frac{1}{2},\frac{1}{3},-\frac{1}{3},\frac{2}{3},-\frac{2}{3}, \frac{1}{4},-\frac{1}{4},\frac{3}{4},-\frac{3}{4},\frac{1}{5},-\frac{1}{5}, \frac{2}{5},-\frac{2}{5},\frac{3}{5},-\frac{3}{5},\frac{4}{5},-\frac{4}{5},...\}$</p>
<p>and then construct my open cover $C$ in stages (which for the later stages, I abbreviated the union by using n-tuples). Each later stage splits up the interval from the previous stage by the next two rationals in the order given by $S$:</p>
<p>\begin{align}
C_0 & =(-1,1)\\
C_1 & = (-1,0) \cup (0,1) := (-1,0,1)\\
C_2 & = (-1,-\frac{1}{2}) \cup (-\frac{1}{2},0) \cup (0,\frac{1}{2}) \cup (\frac{1}{2},1) := (-1,-\frac{1}{2},0,\frac{1}{2},1)\\
C_3 & = (-1,-\frac{1}{2},-\frac{1}{3},0,\frac{1}{3},\frac{1}{2},1)\\
C_4 & = (-1,-\frac{2}{3},-\frac{1}{2},-\frac{1}{3},0,\frac{1}{3},\frac{1}{2},\frac{2}{3},1)\\
C_5 & = (-1,-\frac{2}{3},-\frac{1}{2},-\frac{1}{3},-\frac{1}{4},0,\frac{1}{4},\frac{1}{3},\frac{1}{2},\frac{2}{3},1)\\
C_6 & = (-1,-\frac{3}{4},-\frac{2}{3},-\frac{1}{2},-\frac{1}{3},-\frac{1}{4},0,\frac{1}{4},\frac{1}{3},\frac{1}{2},\frac{2}{3},\frac{3}{4},1)\\
C_7 & = (-1,-\frac{3}{4},-\frac{2}{3},-\frac{1}{2},-\frac{1}{3},-\frac{1}{4}, -\frac{1}{5},0,\frac{1}{5},\frac{1}{4},\frac{1}{3},\frac{1}{2},\frac{2}{3},\frac{3}{4},1)\\
C_8 & = (-1,-\frac{3}{4},-\frac{2}{3},-\frac{1}{2},-\frac{1}{3},-\frac{2}{5}, -\frac{1}{4}, -\frac{1}{5},0,\frac{1}{5},\frac{1}{4},\frac{2}{5},\frac{1}{3},\frac{1}{2}, \frac{2}{3},\frac{3}{4},1)\\
C_9 & = (-1,-\frac{3}{4},-\frac{2}{3},-\frac{1}{2},-\frac{3}{5},-\frac{1}{3}, -\frac{2}{5},-\frac{1}{4},-\frac{1}{5},0,\frac{1}{5},\frac{1}{4},\frac{2}{5},\frac{1}{3}, \frac{3}{5},\frac{1}{2}, \frac{2}{3},\frac{3}{4},1)\\
C_{10} & = (-1,-\frac{3}{4},-\frac{2}{3},-\frac{1}{2},-\frac{3}{5},-\frac{1}{3}, -\frac{2}{5}, -\frac{1}{4},-\frac{1}{5},-\frac{1}{6},0,\frac{1}{6},\frac{1}{5},\frac{1}{4},\frac{2}{5},\frac{1}{3}, \frac{3}{5},\frac{1}{2}, \frac{2}{3},\frac{3}{4},1)
\end{align}</p>
<p>and therefore: $C = \lim_{k\to \infty}C_k$</p>
<p>By construction, $C$ will exclude all rationals. We can also show that the lengths of all the intervals will converge to zero by considering the following subsequence $T$ of $S$</p>
<p>$T=\{n : \Bbb{N}-\{0\} : \pm \frac{1}{n}\} \cup \{0\} = \{-1,-\frac{1}{2},-\frac{1}{3},-\frac{1}{4},-\frac{1}{5},-\frac{1}{6},...,0,...\frac{1}{6},\frac{1}{5},\frac{1}{4},\frac{1}{3},\frac{1}{2},1\}$</p>
<p>and the difference between consecutive terms (except $0$) given by $\frac{1}{n}-\frac{1}{n+1} = \frac{1}{n(n+1)}$ which tends to zero as $n \to \infty$, and that any elements of $S$ will lie somewhere between the elements of $T$ thus the lengths of intervals with those endpoints will be $\leq \frac{1}{n(n+1)}$ for some $n \in \Bbb{N}$</p>
<p>However the above conclusion result in a couple of confusing issues:</p>
<ol>
<li>$\Bbb{I} \cap [-1,1]$ is neither open nor closed (in the open interval topology of $\Bbb{R}$), but $C$ must exclude all rationals by construction (because $S$ enumerates all the rationals in $[-1,1]$, including troublesome limit of endpoints like $0$). This brought into question on what those progressively getting smaller intervals in $C$ are containing.</li>
<li>Every interval, no matter how small, must contain uncountable many irrationals and countably many rationals. But $C$ excludes all the rationals, so that would mean those intervals contains only irrationals. But this contradicts with the fact that no uncountable subset of irrationals are open nor closed (though finite union of irrationals can be closed as finite union of singletons (which are closed sets) are closed) thus no open interval can contain only irrationals</li>
<li>If the intervals tends to zero, it means their infimum length will be zero as $C$ only has countably many of them (thus by countable subadditivity of $\lambda^*$ this sums to zero). But we know this is incorrect as using the standard proofs in paragraph 1, we would conclude $\lambda^*([-1,1]\cap \Bbb{I}) = 2$ and not zero measure.</li>
</ol>
<blockquote>
<p>Since $C$ must exclude all rationals by construction, what exactly are the intervals in $C$ are containing in order to be consistent with the issues raised in 1,2,3? Does $C$ actually contains intervals?</p>
</blockquote>
| 0non-cybersec
| Stackexchange | 2,108 | 5,564 |
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 |
Topological localization of (infinite) inverse limits. <p>The classical localization of topological spaces at a given set of primes $\mathcal{P}$ is a functor $\mathcal{T}\xrightarrow{(-)_{(\mathcal{P)}}}\mathcal{T}$ from a suitable category of topological spaces to itself that has seen many equivalent definition. It factors $\mathcal{T}\xrightarrow{(-)_{(\mathcal{P)}}}\mathcal{T}_{\mathcal{(P)}}\hookrightarrow\mathcal{T}$ through the full subcategory of $\mathcal{P}$-local members of $\mathcal{T}$ and is left adjoint to the inclusion. Thus is preserves all colimits. It also preserves some limits. It preserves homotopy pullbacks and in particular fibre sequences. Which brings me to my question.</p>
<p>What are the conditions for a homotopy limit to be preserved by localization? More importantly, how does one compute the localization of infinite homotopy limits?</p>
<p>As an illustration I wish to calculate the rational homotopy type of the component of the based mapping space $Map_*^{B\iota}(BU(1),BU(2))$ where $\iota:U(1)\hookrightarrow U(2)$ is the canonical inclusion. I write $BU(1)=\mathbb{C}P^{\infty}$ as the homotopy colimit over $\mathbb{C}P^n$. Then I have </p>
<p>$Map_*^{B\iota}(BU(1),BU(2))_\mathbb{Q}=\left(Map_*^{B\iota}(hocolim_n\mathbb{C}P^n,BU(2))\right)_\mathbb{Q}=\left(holim_n Map_*^{B\iota|}(\mathbb{C}P^n,BU(2))\right)_\mathbb{Q}$. </p>
<p>On the inside I have </p>
<p>$Map_*^{B\iota|}(\mathbb{C}P^n,BU(2))_\mathbb{Q}=Map_*^{B\iota|\mathbb{Q}}(\mathbb{C}P^n,BU(2)_\mathbb{Q})=Map_*^{B\iota|_\mathbb{Q}}(\mathbb{C}P^n,K(\mathbb{Q},2)\times K(\mathbb{Q},4))=K(\mathbb{Q},2)$</p>
<p>and naively commuting localization with the homotopy inverse limit i get</p>
<p>$Map_*^{B\iota}(BU(1),BU(2))_\mathbb{Q}=holim K(\mathbb{Q},2)=K(\mathbb{Q},2)$</p>
<p>What is the obstruction to performing this naive commutation?</p>
| 0non-cybersec
| Stackexchange | 589 | 1,859 |
OneSignal - Send scheduled notification. <p>I want to send scheduled messages for OneSignal but instead of using their dashboard I want to use an API to do this and I did read their documentation but I could not find anything is there away to modify their current API so I can send the scheduled notification</p>
<pre><code>function sendMessage(){
$content = array(
"en" => $message,
);
$fields = array(
'app_id' => "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
'included_segments' => array('All'),
'data' => array("foo" => "bar"),
'contents' => $content
);
$fields = json_encode($fields);
print("\nJSON sent:\n");
print($fields);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://onesignal.com/api/v1/notifications");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=utf-8',
'Authorization: Basic NGEwMGZmMjItY2NkNy0xMWUzLTk5ZDUtMDAwYzI5NDBlNjJj'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
$response = sendMessage();
$return["allresponses"] = $response;
$return = json_encode( $return);
print("\n\nJSON received:\n");
print($return);
print("\n");
</code></pre>
| 0non-cybersec
| Stackexchange | 500 | 1,544 |
Why i am getting same output and plot for spline and cubic?. <p>Input of digital systems is usually analog but after processing signals in digital form they give back output in analog form</p>
<p>I am trying to write a code for reconstruction of signal in matlab using interpolation technique but i am getting same output/plot for both interpolation types as shown in last plot of code.</p>
<p>My code is below:</p>
<pre><code>t= 0:0.001:1;
fm= 10
fs= 8*48
x= sin(2*pi*fm*t) % Message Signal
% Plotting discrete time sampled signal x[n]
% Pulse Traain
d= 0:1/50:1;
y= pulstran(t,d,'rectpuls',0.001)
% Sampling
z= x.*y
% Non-uniformly quantize the discrete time signal using u-law companding
% method, u= 100 and number of bits= 8.
% Quantization
N= 8
V= max(x)
u= 100
compsig= compand(x,u,V,'mu/compressor');
L= 2.^N
D= [max(compsig)-min(compsig)]./(L-1);
quants= quant(compsig,D);
xq= compand(quants,u,max(quants),'mu/expander')
% Encode the Signal into discrete levels.
H_e= dsp.UniformEncoder(max(xq),N);
encoder= step(H_e,xq)
% Decoding the signal from discrete level and reconstruct using spline and cubic
% interpolation to reconstruct the analog signal x'(t) from the
% discrete time signal using $t= 0.001.
H_d= dsp.UniformDecoder(max(xq),N);
decoder= step(H_d,encoder)
% Cubic Interpolation
time= 0:0.0001:1;
ci= interp1(t,decoder,time,'cubic')
% Spline interpolation
time=0:0.0001:1
si= interp1(t,decoder,time,'spline')
figure(01)
subplot(2,1,1)
plot(t,x,'R','LineWidth',2)
xlabel('Time')
ylabel('Amplitude')
legend('x')
title('Message Signal')
subplot(2,1,2)
plot(t,y,'B','LineWidth',2)
xlabel('Time')
ylabel('Amplitude')
legend('y')
title('Pulse Train')
figure(02)
subplot(2,1,1)
plot(t,z,'C','LineWidth',2)
xlabel('Time')
ylabel('Amplitude')
legend('z')
title('Sampled Signal')
subplot(2,1,2)
plot(t,xq,'G','LineWidth',2)
xlabel('Time')
ylabel('Amplitude')
legend('xq')
title('Quantized Signal')
figure(03)
subplot(2,1,1)
plot(t,encoder,'M','LineWidth',2)
xlabel('Time')
ylabel('Amplitude')
legend('encoder')
title('Encoded Signal')
subplot(2,1,2)
plot(t,decoder,'K','LineWidth',2)
ylim([-1 1])
xlabel('Time')
ylabel('Amplitude')
legend('decoder')
title('Decoded Signal')
figure(04)
subplot(2,1,1)
plot(time,ci,'B','LineWidth',2)
ylim([-1 1])
xlabel('Time')
ylabel('Amplitude')
legend('ci')
title('Cubic Interpolation')
subplot(2,1,2)
plot(time,ci,'R',time,si,'G')
xlabel('Time')
ylabel('Amplitude')
legend('si')
title('Spline & cubic Interpolation')
</code></pre>
<p>How can i see difference in output/plots of both types of interpolation?</p>
| 0non-cybersec
| Stackexchange | 1,011 | 2,595 |
Change menu at run-time. <p>How do I change the options menu at run-time in android 2.3.3? I have two xml menus and need to switch menu type at run-time. </p>
<p>I would like to destroy or update the menu and when the user then presses the menu button, onCreateOptions menu is then called again selecting the appropriate xml menu.</p>
<pre><code>@Override
public boolean onCreateOptionsMenu(Menu menu) {
if(OPTIONS_TYPE == 0) // Photo option
getMenuInflater().inflate(R.menu.photomenu, menu);
else // Photo + delete option
getMenuInflater().inflate(R.menu.photodeletemenu, menu);
return super.onCreateOptionsMenu(menu);
}
</code></pre>
| 0non-cybersec
| Stackexchange | 192 | 668 |
Coloring rows in View based NSTableview. <p>I have a view based nstableview. I want to color entire row based on some condtion for which I have used code below</p>
<pre><code>- (NSTableRowView *)tableView:(NSTableView *)tableView rowViewForRow:(NSInteger)row
{
NSTableRowView *view = [[NSTableRowView alloc] initWithFrame:NSMakeRect(1, 1, 100, 50)];
[view setBackgroundColor:[NSColor redColor]];
return view;;
}
</code></pre>
<p>The delegate method is called, but table doesn't seem to be using <code>NSTableRowView</code> returned by delegate method.</p>
<p>Main aim here is coloring entire row based on some condition. Whats wrong in above implementation?</p>
| 0non-cybersec
| Stackexchange | 204 | 679 |
sign in the polarization of Hodge structures. <p>I have been trying to understand signs and conventions in the Hodge theory. Clearly, I am no expert in this area. I apologize if I ask stupid question(s) and make wrong comment(s).</p>
<p>In Deligne's paper "Theorie de Hodge II", he defined the polarization of a $\mathbb Q$-Hodge structure $(V, h)$ of weight $n$ to be a homomorphism $\psi: V \otimes V \to \mathbb Q(-n)$ such that $(2 \pi \mathbf i)^n \psi(x, h(\mathbf i)y)$ is symmetric and positive definite on $V_\mathbb R$. Here $\mathrm i$ is a chosen root of $x^2+1=0$. The condition above is equivalent to $\psi(x,y) = (-1)^n\psi(y,x)$ and $(2 \pi \mathbf i)^n \mathbf i^{p-q}\psi_\mathbb C(z, \bar z)>0$ for all $z \in V^{pq}$ ($n=p+q$).</p>
<p>Clearly his choice of sign is so that, for a smooth complex projective variety $X$ of dimension $d$, the cup-product pairing on the primitive part of $H^n(X,\mathbb Q)$ given by $(x,y) \mapsto x \wedge y \wedge c_1(\mathcal O(1))^{d-n}$ is a polarization of weight $n$.</p>
<ol>
<li><p>My first question is probably my ignorance: I went back to check the Hodge-Riemann bilinear relation in Griffith-Harris' AG book. There is a sign of the form $(-1)^{n(n-1)/2}$ which doesn't seem to die no matter how I normalize things. Could someone give me a hint on how everything is converted? Or a reference where this is explained?</p></li>
<li><p>Deligne claimed that if we had chosen the other root $-\mathbf i$ instead, the theory works out equivalently. But I didn't quite get this part. At least, if $\psi$ were a polarization before, we will have to take $(-1)^n \psi$ to get a polarization. I have a bit of difficult time to rap my head around this. There's gotta be something else changed here.</p></li>
<li><p>Even more confusing to me: in the paper I just mentioned, Deligne's convention is that $h(z)$ acts on $V^{pq}$ by $z^p \bar z^q$. Later, he decided (for good cause of course) that $h(z)$ should act on $V^{pq}$ by $z^{-p} \bar z^{-q}$. For example, this is the case of his paper in Covallis on Shimura varieties. My feeling is that, due to the change of convention, one needs to change the positivity of $(2 \pi \mathbf i)^n \psi(x, h(\mathbf i)y)$ into the positivity of $(2 \pi \mathbf i)^n \psi(x, h(\mathbf i)^{-1}y)$. (The latter is the same as $(2 \pi \mathbf i)^n \psi( h(\mathbf i) x,y)$.) Deligne didn't seem to have addressed this change. But note that this has the same effect as changing $\mathbf i$ to $-\bf i$. Maybe this is just a convention thing? Or have I missed out something?</p></li>
</ol>
<p>Many thanks in advance!</p>
| 0non-cybersec
| Stackexchange | 817 | 2,636 |
Postfix authentication issues after I configured TLS. <p>I've setup my mail server with Postfix for SMTP and Dovecot for IMAP. Instead of virtual users I simply listened to the suggestion of someone from Server Fault and went with Linux users. I'm using RainLoop as a webmail service. I have configured SPF and in order to have my emails reach other providers, I have to use authentication.</p>
<p>So I (tried to) setup TLS to work with the SSL certificate I have got by using the Let's Encrypt client. The following is my <code>main.cf</code> file:</p>
<pre><code># domain name and public server ip are replaced with mydomain.co.il and 127.0.0.1
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# TLS parameters
smtpd_tls_cert_file=/etc/letsencrypt/live/mydomain.co.il/cert.pem
smtpd_tls_key_file=/etc/letsencrypt/live/mydomain.co.il/privkey.pem
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_tls_received_header = yes
smtpd_tls_security_level = may
smtp_tls_security_level = may
smtp_tls_loglevel = 1
smtpd_tls_loglevel = 1
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = mail.mydomain.co.il
alias_maps = hash:/etc/postfix/aliases
alias_database = hash:/etc/postfix/aliases
transport_maps = hash:/etc/postfix/transport
myorigin = mydomain.co.il
mydestination = mail.mydomain.co.il, localhost.mydomain.co.il, localhost, hash:/etc/postfix/transport
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.10.0/24 127.0.0.1 # last one is the server's public ip
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
mime_header_checks = regexp:/etc/postfix/header_checks
header_checks = regexp:/etc/postfix/header_checks
</code></pre>
<p>And the following is my <code>master.cf</code> file:</p>
<pre><code>#
# Postfix master process configuration file. For details on the format
# of the file, see the master(5) manual page (command: "man 5 master" or
# on-line: http://www.postfix.org/master.5.html).
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (no) (never) (100)
# ==========================================================================
smtp inet n - y - - smtpd
#smtp inet n - y - 1 postscreen
#smtpd pass - - y - - smtpd
#dnsblog unix - - y - 0 dnsblog
#tlsproxy unix - - y - 0 tlsproxy
submission inet n - y - - smtpd
# -o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_reject_unlisted_recipient=no
# -o smtpd_client_restrictions=$mua_client_restrictions
# -o smtpd_helo_restrictions=$mua_helo_restrictions
# -o smtpd_sender_restrictions=$mua_sender_restrictions
# -o smtpd_recipient_restrictions=
# -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
#smtps inet n - y - - smtpd
# -o syslog_name=postfix/smtps
# -o smtpd_tls_wrappermode=yes
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_reject_unlisted_recipient=no
# -o smtpd_client_restrictions=$mua_client_restrictions
# -o smtpd_helo_restrictions=$mua_helo_restrictions
# -o smtpd_sender_restrictions=$mua_sender_restrictions
# -o smtpd_recipient_restrictions=
# -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
#628 inet n - y - - qmqpd
pickup unix n - y 60 1 pickup
cleanup unix n - y - 0 cleanup
qmgr unix n - n 300 1 qmgr
#qmgr unix n - n 300 1 oqmgr
tlsmgr unix - - y 1000? 1 tlsmgr
rewrite unix - - y - - trivial-rewrite
bounce unix - - y - 0 bounce
defer unix - - y - 0 bounce
trace unix - - y - 0 bounce
verify unix - - y - 1 verify
flush unix n - y 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - y - - smtp
relay unix - - y - - smtp
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - y - - showq
error unix - - y - - error
retry unix - - y - - error
discard unix - - y - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - y - - lmtp
anvil unix - - y - 1 anvil
scache unix - - y - 1 scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent. See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
#
# ====================================================================
#
# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
#
# Specify in cyrus.conf:
# lmtp cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
#
# Specify in main.cf one or more of the following:
# mailbox_transport = lmtp:inet:localhost
# virtual_transport = lmtp:inet:localhost
#
# ====================================================================
#
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
#
#cyrus unix - n n - - pipe
# user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
#
# ====================================================================
# Old example of delivery via Cyrus.
#
#old-cyrus unix - n n - - pipe
# flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
#
# ====================================================================
#
# See the Postfix UUCP_README file for configuration details.
#
uucp unix - n n - - pipe
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#
ifmail unix - n n - - pipe
flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp unix - n n - - pipe
flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix - n n - 2 pipe
flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman unix - n n - - pipe
flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
${nexthop} ${user}
</code></pre>
<p>I basically just enabled <code>sumbission</code>.</p>
<p>RainLoop connects to both my IMAP server and SMTP server:</p>
<p><a href="https://i.stack.imgur.com/O08ET.png" rel="nofollow noreferrer">RainLoop screenshot</a></p>
<p>As long as "Use Authentication" is disabled or if I use the php <code>mail();</code> function, I'm able to send emails and receive them everywhere. They get marked as spam, so I figured out I need to enable authentication but if I do so; I'm unable to send emails, this is from my <code>mail.log</code> file:</p>
<pre><code># i replaced my server's public ip address with 127.0.0.1
Jun 23 05:14:57 mailserver dovecot: imap-login: Login: user=<shavit>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=16305, TLS, session=<QVtwdek15swlOzfP>
Jun 23 05:14:57 mailserver postfix/smtpd[16306]: connect from mydomain.co.il[127.0.0.1]
Jun 23 05:14:57 mailserver postfix/smtpd[16306]: Anonymous TLS connection established from mydomain.co.il[127.0.0.1]: TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)
Jun 23 05:14:57 mailserver postfix/smtpd[16306]: warning: mydomain.co.il[127.0.0.1]: SASL CRAM-MD5 authentication failed: authentication failure
Jun 23 05:14:57 mailserver postfix/smtpd[16306]: disconnect from mydomain.co.il[127.0.0.1] ehlo=2 starttls=1 auth=0/1 quit=1 commands=4/5
Jun 23 05:14:57 mailserver dovecot: imap(shavit): Logged out in=11 out=401
Jun 23 05:14:57 mailserver dovecot: imap-login: Login: user=<shavit>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=16310, TLS, session=<BsR2dek16MwlOzfP>
Jun 23 05:14:57 mailserver dovecot: imap(shavit): Logged out in=90 out=884
</code></pre>
<p>My SSL certificate is valid; I'm using it with <code>nginx</code> for 5 virtual hosts under the same domain and they all work, so this option could be eliminated.</p>
<p>What am I doing wrong, or; how would I fix it? Help would be appreciated!</p>
| 0non-cybersec
| Stackexchange | 3,514 | 10,571 |
Area-preserving map of punctured disk to itself. <p>If <span class="math-container">$D_r = \{v\in \mathbb{R}^2 : 0 \lt |v| \lt r\}$</span>, consider the map <span class="math-container">$f_r: D_r \to D_r$</span> given by:</p>
<p><span class="math-container">$$f_r(x,y) = \frac{\sqrt{r^2-x^2-y^2}}{\sqrt{x^2+y^2}}\left(-y,x\right)$$</span></p>
<p>Geometrically, <span class="math-container">$f_r(v) \cdot v =0$</span> and <span class="math-container">$|v|^2 + |f_r(v)|^2=r^2$</span>, i.e. <span class="math-container">$f_r$</span> rotates <span class="math-container">$v$</span> by <span class="math-container">$\frac{\pi}{2}$</span> and rescales it to its “Pythagorean conjugate” wrt <span class="math-container">$r$</span>. It is easy to see that <span class="math-container">$f_r(f_r(v))=-v$</span>.</p>
<p>While it is not hard to show by an explicit computation that the determinant of the Jacobian for <span class="math-container">$f_r$</span> is <span class="math-container">$-1$</span>, and hence <span class="math-container">$f_r$</span> is area-preserving, my question is whether there is a more direct or conceptual route to that conclusion. I don't think the mere fact that <span class="math-container">$f_r(f_r(v))=-v$</span> suffices, since this only tells us that the product of the Jacobian at two different points, <span class="math-container">$v$</span> and <span class="math-container">$f_r(v)$</span>, is minus the identity matrix.</p>
<p>This function doesn't satisfy the Cauchy-Riemann equations, so it does not correspond to a holomorphic function of a complex variable. But I am curious as to whether it has been given a label in the literature; it seems like a kind of “conjugate” that might have shown up in a range of contexts in geometry or analysis.</p>
<p>The map <span class="math-container">$f_r$</span> can be used to show that the volume of the unit ball in <span class="math-container">$\mathbb{R}^{2n}$</span> is equal to <span class="math-container">$\frac{\pi^n}{n!}$</span>, by means of the following argument. If we pick <span class="math-container">$n$</span> points <span class="math-container">$p_i$</span> uniformly in the square in <span class="math-container">$\mathbb{R}^2$</span> of side length 2, and compute the probability <span class="math-container">$P_1$</span> that:</p>
<p><span class="math-container">$$|p_n| \le |p_{n-1}| \le \dots \le |p_1| \le 1$$</span></p>
<p>we have:</p>
<p><span class="math-container">$$P_1 = \frac{\pi^n}{4^n n!}$$</span></p>
<p>since all <span class="math-container">$n$</span> points must lie in the unit disk, and there will be equal probabilities for each of the <span class="math-container">$n!$</span> permutations to have descending magnitudes.</p>
<p>We can also pick <span class="math-container">$n$</span> points <span class="math-container">$q_i$</span> uniformly from the same square and ask whether:</p>
<p><span class="math-container">$$|q_1|^2+|q_2|^2+\dots +|q_n|^2 \le 1$$</span></p>
<p>i.e. whether the <span class="math-container">$n$</span> points taken together give the coordinates of a point in the unit ball in <span class="math-container">$\mathbb{R}^{2n}$</span>. The probability for this will be:</p>
<p><span class="math-container">$$P_2 = \frac{V(B^{2n})}{4^n}$$</span></p>
<p>If the <span class="math-container">$q_i$</span> correspond to a point in the unit ball, we can construct <span class="math-container">$n$</span> points:</p>
<p><span class="math-container">$$p'_1 = f_1(q_1)$$</span>
<span class="math-container">$$|p'_1|^2 = 1 - |q_1|^2$$</span>
<span class="math-container">$$p'_2 = f_{|p'_1|}(q_2)$$</span>
<span class="math-container">$$|p'_2|^2 = 1 - |q_1|^2 - |q_2|^2$$</span>
<span class="math-container">$$p'_3 = f_{|p'_2|}(q_3)$$</span>
<span class="math-container">$$\dots$$</span></p>
<p>These <span class="math-container">$p'_i$</span> will then satisfy:</p>
<p><span class="math-container">$$|p'_n| \le |p'_{n-1}| \le \dots \le |p'_1| \le 1$$</span></p>
<p>Since each <span class="math-container">$f_r$</span> is area-preserving, the probability of arriving at these <span class="math-container">$p'_i$</span> will be the same as that of picking the <span class="math-container">$q_i$</span> from which they were computed. But the probability of the <span class="math-container">$q_i$</span> giving us a point in the unit ball in <span class="math-container">$\mathbb{R}^{2n}$</span> must then be the same as <span class="math-container">$P_1$</span>, since the <span class="math-container">$p'_i$</span> satisfy the relevant condition. So:</p>
<p><span class="math-container">$$P_1=P_2$$</span></p>
<p>and so:</p>
<p><span class="math-container">$$V(B^{2n}) = \frac{\pi^n}{n!}$$</span></p>
| 0non-cybersec
| Stackexchange | 1,666 | 4,748 |
CGContextDrawPDFPage memory Leak - App Crash. <p>When I analyze my app with Instruments, I found out that data allocated by <code>CGContextDrawPDFPage</code> is not released immediately. App getting crash because of <code>CGContextDrawPDFPage</code>.</p>
<p><a href="https://i.stack.imgur.com/DSlRm.png" rel="noreferrer"><img src="https://i.stack.imgur.com/DSlRm.png" alt="enter image description here"></a></p>
<p><a href="https://i.stack.imgur.com/uNbD8.png" rel="noreferrer"><img src="https://i.stack.imgur.com/uNbD8.png" alt="enter image description here"></a></p>
<p>Hello here is my code for drawing pdf in CATiledlayer</p>
<pre><code> - (void)drawLayer:(CATiledLayer *)layer inContext:(CGContextRef)context
{
if (_PDFPageRef == nil) {
return;
}
CGPDFPageRef drawPDFPageRef = NULL;
CGPDFDocumentRef drawPDFDocRef = NULL;
@synchronized(self) // Briefly block main thread
{
drawPDFDocRef = CGPDFDocumentRetain(_PDFDocRef);
if( _PDFPageRef != (__bridge CGPDFPageRef)([NSNull null]) )
drawPDFPageRef = CGPDFPageRetain(_PDFPageRef);
else
return;
}
//CGContextSetRGBFillColor(context, 0.0f, 0.0f, 0.0f, 0.0f);
//CGContextFillRect(context, CGContextGetClipBoundingBox(context));
if (drawPDFPageRef != NULL) // Render the page into the context
{
CGFloat boundsHeight = viewBounds.size.height;
if (CGPDFPageGetRotationAngle(drawPDFPageRef) == 0)
{
CGFloat boundsWidth = viewBounds.size.width;
CGRect cropBox = CGPDFPageGetBoxRect(drawPDFPageRef, kCGPDFCropBox);
int pageRotation = CGPDFPageGetRotationAngle(drawPDFPageRef);
CGSize pageVisibleSize = CGSizeMake(cropBox.size.width, cropBox.size.height);
if ((pageRotation == 90) || (pageRotation == 270) ||(pageRotation == -90)) {
pageVisibleSize = CGSizeMake(cropBox.size.height, cropBox.size.width);
}
float scaleX = boundsWidth / pageVisibleSize.width;
float scaleY = boundsHeight / pageVisibleSize.height;
float scale = scaleX < scaleY ? scaleX : scaleY;
// Offset relative to top left corner of rectangle where the page will be displayed
float offsetX = 0;
float offsetY = 0;
float rectangleAspectRatio = boundsWidth / boundsHeight;
float pageAspectRatio = pageVisibleSize.width / pageVisibleSize.height;
if (pageAspectRatio < rectangleAspectRatio) {
// The page is narrower than the rectangle, we place it at center on the horizontal
offsetX = (boundsWidth - pageVisibleSize.width * scale) / 2;
}
else {
// The page is wider than the rectangle, we place it at center on the vertical
offsetY = (boundsHeight - pageVisibleSize.height * scale) / 2;
}
CGPoint point = CGPointMake(offsetX, offsetY);
//CGRect cropBox = CGPDFPageGetBoxRect(drawPDFPageRef, kCGPDFCropBox);
int rotate = CGPDFPageGetRotationAngle(drawPDFPageRef);
//CGContextSaveGState(context);
// Setup the coordinate system.
// Top left corner of the displayed page must be located at the point specified by the 'point' parameter.
CGContextTranslateCTM(context, point.x, point.y);
// Scale the page to desired zoom level.
CGContextScaleCTM(context, scale , scale);
// The coordinate system must be set to match the PDF coordinate system.
switch (rotate) {
case 0:
CGContextTranslateCTM(context, 0, cropBox.size.height);
CGContextScaleCTM(context, 1, -1);
break;
case 90:
CGContextScaleCTM(context, 1, -1);
CGContextRotateCTM(context, -M_PI / 2);
break;
case 180:
case -180:
CGContextScaleCTM(context, 1, -1);
CGContextTranslateCTM(context, cropBox.size.width, 0);
CGContextRotateCTM(context, M_PI);
break;
case 270:
case -90:
CGContextTranslateCTM(context, cropBox.size.height, cropBox.size.width);
CGContextRotateCTM(context, M_PI / 2);
CGContextScaleCTM(context, -1, 1);
break;
}
// The CropBox defines the page visible area, clip everything outside it.
CGRect clipRect = CGRectMake(0, 0, cropBox.size.width, cropBox.size.height);
CGContextAddRect(context, clipRect);
CGContextClip(context);
CGContextSetRGBFillColor(context, 1.0, 1.0, 1.0, 1.0);
CGContextFillRect(context, clipRect);
CGContextTranslateCTM(context, -cropBox.origin.x, -cropBox.origin.y);
CGContextSetInterpolationQuality(context, kCGInterpolationHigh);
// CGContextSetInterpolationQuality(context, kCGInterpolationMedium);
CGContextSetRenderingIntent(context, kCGRenderingIntentDefault);
if(context != nil && context != (__bridge CGContextRef)([NSNull null]))
{
CGContextDrawPDFPage(context, drawPDFPageRef);
//CGContextRestoreGState(context);
}
}
else // Use CGPDFPageGetDrawingTransform for pages with rotation (AKA kludge)
{
CGContextTranslateCTM(context, 0.0f, boundsHeight); CGContextScaleCTM(context, 1.0f, -1.0f);
CGContextConcatCTM(context, CGPDFPageGetDrawingTransform(drawPDFPageRef, kCGPDFCropBox, viewBounds, 0, true));
}
//CGContextDrawPDFPage(context, drawPDFPageRef);
}
CGPDFPageRelease(drawPDFPageRef); // Cleanup
CGPDFDocumentRelease(drawPDFDocRef);
}
</code></pre>
| 0non-cybersec
| Stackexchange | 1,688 | 6,037 |
Refactor Pro versus Visual Assist X for C++ Development. <p>There are two major refactoring tools which can be installed for Visual Studio that provide C++ support. The full versions of both tools are $250, and they seem to offer similar functionality. They are:</p>
<ul>
<li><a href="http://www.devexpress.com/Products/Visual_Studio_Add-in/Coding_Assistance/" rel="noreferrer">Developer Express' Refactor Pro + CodeRush</a></li>
<li><a href="http://www.wholetomato.com/products/default.asp" rel="noreferrer">Whole Tomato's Visual Assist X</a></li>
</ul>
<p>Which tool is better?</p>
<p>EDIT: My initial evaluation of the tools seems to be that Refactor Pro/CodeRush has several more features, but is also quite buggy on occasion. It doesn't seem to like macros:
<a href="https://i.stack.imgur.com/zoUzl.png" rel="noreferrer"><img src="https://i.stack.imgur.com/zoUzl.png" alt="" /></a><br />
<sub>(source: <a href="http://billy-oneal.com/forums/4-9-2010%2010-31-50%20PM.png" rel="noreferrer">billy-oneal.com</a>)</sub></p>
<p>Here's Visual Assist's interpretation of the same:
<a href="https://i.stack.imgur.com/0PBvo.png" rel="noreferrer"><img src="https://i.stack.imgur.com/0PBvo.png" alt="" /></a><br />
<sub>(source: <a href="http://billy-oneal.com/forums/4-10-2010%201-52-24%20AM.png" rel="noreferrer">billy-oneal.com</a>)</sub></p>
<p>EDIT2: I think I like CodeRush over Visual Assist, but I'm not sure I can trust CR. CodeRush does seem to have problems parsing some C++ constructs, like the macros above. But it's UI is <em>much</em> more polished. For example:
<a href="https://i.stack.imgur.com/R5eSz.png" rel="noreferrer"><img src="https://i.stack.imgur.com/R5eSz.png" alt="" /></a><br />
<sub>(source: <a href="http://billy-oneal.com/forums/4-10-2010%201-37-12%20AM.png" rel="noreferrer">billy-oneal.com</a>)</sub></p>
<p>On the other hand Visual Assist X seems to have a much larger following among C++ developers, and it's code analysis is MUCH better. It doesn't seem to make mistakes like R! Pro was making from time to time.</p>
<p>I think at this point I just have to play with both tools and see which one proves more useful. But I'm still curious if anyone has had horror / success stories with either tool.</p>
| 0non-cybersec
| Stackexchange | 750 | 2,233 |
Possible bug in VB.NET 'Like' operator?. <p>Why is it that the following evaluates as <code>True</code>?</p>
<pre><code>Dim result = "b" Like "*a*b"
</code></pre>
<p>Thanks.</p>
<p>EDIT:<br>
To generalize this a bit, the following returns <code>True</code>:</p>
<pre><code>"String1" Like "*AnyText1*AnyText2*AnyText???******????*String1"
</code></pre>
<p>VBA works correctly, returning <code>False</code>.<br>
PowerShell works correctly, returning <code>False</code>:</p>
<pre><code>PS C:\Users\XXX> "b" -Like "*a*b"
False
</code></pre>
<p>EDIT2:<br>
The link to the bug report:<br>
<a href="https://connect.microsoft.com/VisualStudio/feedback/details/748415/a-bug-in-net-like-operator" rel="nofollow">https://connect.microsoft.com/VisualStudio/feedback/details/748415/a-bug-in-net-like-operator</a></p>
| 0non-cybersec
| Stackexchange | 311 | 822 |
Share Application Program for All Users on Windows 10. <p>Just setup a Windows 10 Laptop, I have one base account which is administrator and 2 user accounts to be used by two other users.</p>
<p>I installed an application ( <a href="https://scratch.mit.edu/download" rel="nofollow noreferrer">Scratch Desktop</a> ) from base user account but other users are unable to see this.</p>
<p>Installation steps did not prompt in any way to make it available to all users.
How to I make this program available to all users, anything that involves not copying the full program to each user profile folders is appreciated.</p>
<p>OS: Windows 10 Pro</p>
| 0non-cybersec
| Stackexchange | 169 | 646 |
AITA] for wanting my girlfriend's friend to pay late fees for rent?. So my girlfriend and I are sharing an apartment. We have a spare bedroom, and my girlfriend's friend needed a place for a month, so he moved in and agreed to pay the rent for the room (It's student apartments so rent goes by room instead of for the whole apt). Rent was due yesterday, originally he was going to pay some now and some later, but now asked to pay us a month from now. Well my girlfriend was relying on that money to pay for her portion of the rent as she doesn't get paid at her new job until next Friday. She's now going to get charged $30 today and $10 every day after that in late fees as a result, and I brought up that she should have him pay for at least part of those fees.
She asked him, and he said he would try to get the money in two weeks instead of a month, but that is still going to rack up $170 in late fees. She thinks it's rude to ask him for extra money, but considering it is partially his fault for why the rent is late, I think it's reasonable to ask if he can pay *some* of it. Am I an asshole for that?
| 0non-cybersec
| Reddit | 265 | 1,114 |
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 |
Complementary slackness in Hilbert spaces. <p>Suppose we were going to obtain the KKT conditions for a inequality constrained problem in $\mathbb{R}^n$</p>
<p>\begin{align*}
\underset{\mathbf{x}\in \mathbb{R}^n}{\text{min}} &~ f(\mathbf{x}) \\
\text{s.t.}&~ x_i \leq \beta ~\forall ~i=1...n \\
\end{align*}</p>
<p>Introduce a slack variable
\begin{align*}
\underset{x\in \mathbb{R}^n}{\text{min}} &~ f(x) \\
\text{s.t.}&~ x_i - \beta + s_i = 0 &~~\forall ~i=1...n\\
& s_i \geq 0 &~~\forall ~i=1...n
\end{align*}
Obtain the optimality conditions. Lagrangian:</p>
<p>\begin{equation*}
\mathcal{L} \left(x, \lambda, s, \mu \right) = f(x) + \mathbf{\lambda}^T (\mathbf{x} -\mathbf{\beta} + \mathbf{s}) + \mathbf{\mu}^T \mathbf{s}
\end{equation*}</p>
<p>KKT conditions:
\begin{align}
\nabla_x \mathcal{L} &= \nabla f(x) + \mathbf{\lambda} &=0\\
\nabla_{\lambda} \mathcal{L} &= \mathbf{x} -\mathbf{\beta} + \mathbf{s}&=0 \\
\nabla_{s} \mathcal{L} &= \mathbf{\lambda} + \mathbf{\mu} &=0\\
s_i &\geq 0 ~~\forall ~i=1...n \\
\mu_i &\leq 0 ~~\forall ~i=1...n &~\text{dual feasibility} \\
\mu_i s_i &= 0 ~~\forall ~i=1...n &~\text{complementary slackness}
\end{align}
Doing some manipulations we can obtain:
\begin{align}
\nabla_x \mathcal{L} &= \nabla f(x) + \mathbf{\lambda} &=0\\
\lambda_i (x_i -\mathbf{\beta}) &= 0 ~~\forall ~i=1...n &~\text{complementary slackness}
\end{align}</p>
<p>and we can solve for these conditions. Now, how would we go about the same problem in a $L_2$?</p>
<p>\begin{align*}
\underset{x\in L_2}{\text{min}} &~ f(x) \\
\text{s.t.}&~ x \leq \beta ~a.e. \\
\end{align*}</p>
<p>$f:L_2 \rightarrow \mathbb{R}$. Including a slack variable:
\begin{align*}
\underset{x\in L_2}{\text{min}} &~ f(x) \\
\text{s.t.}&~ x - \beta + s &= 0 ~a.e. \\
&~ s &\geq 0 ~a.e. \\
\end{align*}</p>
<p>Here for the Lagrangian, am I correct in doing the lagrange multiplier-constraints inner products in $L_2$ ?
\begin{equation*}
\mathcal{L} \left(x, \lambda, s, \mu \right) = f(x) + \langle \lambda, x -\beta + s \rangle_{L_2} +\langle \mu, s \rangle_{L_2}
\end{equation*}</p>
<p>KKT conditions $\forall \delta \lambda, \delta x, \delta \mu, \delta s$
\begin{align*}
\mathcal{L}_x (\delta x) &= \langle f'(x), \delta x \rangle_{L_2} + \langle \lambda, \delta x \rangle_{L_2} &= 0\\
\mathcal{L}_{\lambda} (\delta \lambda) &= \langle x - \beta + s, \delta \lambda \rangle_{L_2} &= 0 \\
\mathcal{L}_{s} (\delta s) &= \langle \lambda , \delta s \rangle_{L_2} + \langle \mu, \delta s \rangle_{L_2}&= 0 \\
s &\geq 0 \\
\mu &\leq 0 \\
\mu s&= 0 ~\text{a.e.}
\end{align*}</p>
<p>Solving
\begin{align*}
\mathcal{L}_{\lambda} (\delta \lambda) &= \langle x - \beta + s, \delta \lambda \rangle_{L_2} &= 0 ~ \forall \delta \lambda \\
s &= -(x - \beta) &~\text{a.e.}\\
\mathcal{L}_{s} (\delta s) &= \langle \lambda , \delta s \rangle_{L_2} + \langle \mu, \delta s \rangle_{L_2} &= 0 ~ \forall \delta s \\
\mu &= -\lambda &~\text{a.e.}
\end{align*}</p>
<p>Therefore, the KKT conditions for the continuous case are:
\begin{align}
\mathcal{L}_x (\delta x) &= \langle f'(x), \delta x \rangle_{L_2} + \langle \lambda, \delta x \rangle_{L_2} &= 0 ~ \forall \delta x\\
\lambda \left(x - \beta \right) &= 0 ~ \text{a.e.}
\end{align}</p>
<p>Are these KKT correct? Is using the $L_2$ inner product the way to go or I should have used another space such as $L_{\infty}$?</p>
| 0non-cybersec
| Stackexchange | 1,506 | 3,623 |
Querystring search on array elements in Elastic Search. <p>I'm trying to learn elasticsearch with a simple example application, that lists quotations associated with people. The example mapping might look like:</p>
<pre><code>{
"people" : {
"properties" : {
"name" : { "type" : "string"},
"quotations" : { "type" : "string" }
}
}
}
</code></pre>
<p>Some example data might look like: </p>
<pre><code>{ "name" : "Mr A",
"quotations" : [ "quotation one, this and that and these"
, "quotation two, those and that"]
}
{ "name" : "Mr B",
"quotations" : [ "quotation three, this and that"
, "quotation four, those and these"]
}
</code></pre>
<p>I would like to be able to use the querystring api on individual quotations, and return the people who match. For instance, I might want to find people who have a quotation that contains (this AND these) - which should return "Mr A" but not "Mr B", and so on. How can I achieve this?</p>
<p>EDIT1:</p>
<p>Andrei's answer below seems to work, with data values now looking like:</p>
<pre><code>{"name":"Mr A","quotations":[{"value" : "quotation one, this and that and these"}, {"value" : "quotation two, those and that"}]}
</code></pre>
<p>However, I can't seem to get a query_string query to work. The following produces no results:</p>
<pre><code>{
"query": {
"nested": {
"path": "quotations",
"query": {
"query_string": {
"default_field": "quotations",
"query": "quotations.value:this AND these"
}
}
}
}
}
</code></pre>
<p>Is there a way to get a query_string query working with a nested object?</p>
<p>Edit2: Yes it is, see Andrei's answer.</p>
| 0non-cybersec
| Stackexchange | 543 | 1,731 |
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 |
Theoretical question. If you would take physical appearance out of the equation - would workouts change?. Let's say you don't really care about being toned or big or muscular. You just want to get faster, stronger, more physically capable. Able to run faster for longer, carry heavy things with more ease. Just be a better working machine overall. (I've never been in the military but I imagine this is something they try to achieve in military training). Would the popular workouts stay the same or would one be advised on doing something else.
One of the reasons I am asking is that I would like to get fit however I need my mind to be on board. My mind - although it would like for me to look good (currently I am what one would call skinny fat or what has recently been called the dad bod (lol) nearly 30 years old and male) does not accept looking good as the single argument to start inflicting pain to myself. It is not sufficient as an argument for me to start doing stuff I hate.
I can however get on board with becoming a better human. A well oiled machine capable of more difficult feats - not just for the looks. I don't really want a six pack or the stress which comes with acquiring and keeping one. Also can't really get on board with acquiring everything in 30, 60, 90 days. I don't care about quick results more about changing my life altogether and become a more balanced, healthy human in the process.
Maybe there even is a workout which wants to achieve precisely that or maybe it's all the same.
Thoughts?
Thank you | 0non-cybersec
| Reddit | 343 | 1,544 |
Setting up Passenger + Nginx on Arch. <p>I'm trying to setup passenger and nginx on Arch, but I can't seem to get the nginx server to even start. </p>
<p>I've followed the guide found here: <a href="https://wiki.archlinux.org/index.php/Nginx#Ruby_Integration_.28Ruby_on_Rails_and_Rack-based.29" rel="nofollow noreferrer">https://wiki.archlinux.org/index.php/Nginx#Ruby_Integration_.28Ruby_on_Rails_and_Rack-based.29</a> under option A using the ruby gems to do the installation. I have nginx installed in the /opt/nginx/ directory.</p>
<p>I've symbolically linked /opt/nginx/sbin/nginx to /usr/bin/nginx and added the init script found at <a href="https://wiki.archlinux.org/index.php/Nginx/Init_script" rel="nofollow noreferrer">https://wiki.archlinux.org/index.php/Nginx/Init_script</a>. I've also changed the permissions to 755 and it is owned by root as suggested.</p>
<p>I get the following error though when I run <code>sudo /etc/rc.d/nginx start</code></p>
<pre><code>/etc/rc.d/nginx: line 5: /etc/conf.d/nginx: No such file or directory
:: Checking configuration
[BUSY] nginx: [crit] pread() "/opt/nginx/" failed (21: Is a directory)
nginx: configuration file /opt/nginx/ test failed
</code></pre>
<p>What does this mean?</p>
| 0non-cybersec
| Stackexchange | 425 | 1,239 |
Pulling Data in Excel into Separate Sheet. <p>I am looking to pull all rows in an excel sheet matching a certain condition programatically:
Given 3 Sheets in a workbook:
Sheet 1 Contains a spreadsheet with multiple rows and columns where some rows have repeated values.</p>
<p>My goal is to be able to input a certain value for a column in Sheet 2 and have Sheet 3 list all rows in Sheet 1 that match that criteria. Thus, I want to avoid manually filtering and copying where possible. </p>
<p>The only way I can think to do this is using Index and Match, but so far I have only been able to modify this to return the first matching result from Sheet 1, even if there are multiple rows containing that value. </p>
| 0non-cybersec
| Stackexchange | 171 | 715 |
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 |
[NAW] For anybody that thinks abortion is the easy way out.. My friend is going through one right now. It's been four hours since it's begun and she's screaming in pain. She's vomiting from the pain. She's begging for it to stop. She's pleading for it to stop.
Some women don't have the resources to carry to full term. Some women don't have a choice to carry full term. Some women don't have anybody to help them. To support them. To love them.
For anybody that thinks this is the easy way out, nothing about this is easy. You might think this is a sin. You might think this is wrong. You might think it's her fault for having sex in the first place. She was on birth control. She used a condom. She did everything she could to prevent this, but it still happened. Shame on you for making women feel guilty for having sex. Shame on you for making women feel guilty about not being able to have a baby. Shame on you for making women feel guilty for choosing what's best for us and the fetus. Shame on you for thinking this is easy. You don't understand the pain. You don't understand the trauma. You don't understand, so don't try to tell us what we're allowed to do with our body.
Nothing about this is easy. | 0non-cybersec
| Reddit | 289 | 1,215 |
How do I setup my own home to pen test? What laptop is best for it <$300-400. I recently bought a vps to play for fun in hosting my own cloud. Then I had to go through so many things about securing my server. This is what got me into thinking of going into more of the field of pen testing and securing my own home router and network. It feels like a interesting hobby and good for myself in learning networking and etc.
I would like to buy a laptop dedicated to pen testing don't mind buying refurbished/used/and etc. I just don't know how good of a specs you would need for a laptop just to do pen testing. Also which brands/models would be good for a pen testing laptop for kali/backtrack/ and etc. If there's any sales atm for these laptops. Whats the opinion of chromebooks for pen testing?
I plan to mainly crack into my own personal router and maybe using one of my computers as a server and try to get into it. Im thinking of trying to exploit my own site as well. But im unsure of if thats legal to do pen testing on your own site hosted on a shared hosting or vps so i rather not risk it. If anything ill just host it on my raspberry pi or make a server at home to host it wont be on all the time just when i want to do pen testing. I do also have alot of spare routers lying around as well. At the end of all of this i just want to learn more about securing my own stuff and maybe with my friends permission i would like to offer to secure their routers and etc as well. I also heard its bad to have kali as your main os?
**What laptop brands/model are you using right now for pen testing and what limitations have you been hitting with it**
**This is what i currently own**
D-link routers
Couple of computers
raspberry pi (too slow to use as my main for pen testing i would like to set up
something on it and try to get into it)
TP-link wireless adapter
Sandisk ssd 32gb i think.
1tb hdd unused.
| 1cybersec
| Reddit | 475 | 1,926 |
how to get an object from a closure?. <p>How to get an object from a closure, that's confusion with me, here is the question:</p>
<pre class="lang-js prettyprint-override"><code>var o = function () {
var person = {
name: 'jonathan',
age: 24
}
return {
run: function (key) {
return person[key]
}
}
}
</code></pre>
<p><strong>question:</strong> How do i get original <code>person</code> object without changing the source code.</p>
| 0non-cybersec
| Stackexchange | 148 | 484 |
How can I learn about typography, fonts, glyphs, etc.?. <p>I know so little about this that I'm having trouble formulating the question.</p>
<p>Apparently due to technical limitations, <a href="http://en.wikipedia.org/wiki/Nasta%CA%BFl%C4%ABq_script" rel="nofollow">nastaleeq</a> style of writing <a href="http://en.wikipedia.org/wiki/Urdu" rel="nofollow">Urdu</a> is very difficult, perhaps impossible, given current standards used on the web. I'd like to do a deep dive into why this is so (the technical aspects, at least).</p>
<p>My, very rough, understanding is this:</p>
<p>Unicode is the standard right now, but it doesn't define how characters look, it only define the names of characters and a numbering system to represent them.</p>
<p>"Fonts," such as Halvetica or Times New Roman, actually define the look of characters.</p>
<p>What is True Type then, and how is it different from Open Type or Postscript or LaTex?</p>
<p>If a language requires that shapes of characters, <em>and how the connect to each other</em> (think cursive), change, based on their location in text...how is that handled? If Unicode is only a representation system and fonts only concern themselves with single characters, where do these location based algorithms go?</p>
<p>Is the current set of standards too limited to handle complex cursive style typography? If so, can HTML's canvas be used to create an alternative/experimental "font system?" If I do need to "roll my own" is Knuth's work on digital typography still relevant or are there more modern references?</p>
| 0non-cybersec
| Stackexchange | 421 | 1,565 |
The Life of A Dispatcher - Patrick. Personally, I’ve always had a deep routed fear of home invasions and it has everything to do with the fact that I was the victim of one when I was 12 years old. I don't talk about it much because it wasn’t tragic whatsoever, but nonetheless, it was still deeply terrifying to go through alone. I remember dialing 911 for my first time, and in the midst of all potential danger, the dispatcher kept me relatively calm and helped me get through, what at the time, seemed like my impending doom. That day changed my life - I don't think I would have ever thought about becoming part of law enforcement without it happening.
Home invasions are possibly some of the more intense calls that I get as a dispatcher. I think it’s because I never truly know how it’ll play out or what the outcome will be. According to the United States Department of Justice, 38% of assaults and 60% of rapes occur during a home invasion. It is also said that there are about 32,000 people that are killed during home invasions each year in the U.S. And in the northern parts of North America, in Canada, the percentages of victims that are either seriously injured or killed make up 35%. Most people who invade a home are not looking to hurt someone, but in the midst of getting caught feel like they have no other choice and resort to violence. However, sometimes that isn’t the case. Sometimes people have the intent to rape, assault and/or kill someone.
For confidentiality reasons, all names have been made up.
*****
**PATRICK**
This call came in around 9 pm.
*“911, what’s your emergency?”*
*“I think someone is watching me or following me. I think they might be in the house.”* A young man’s voice came over the line, he sounded scared.
*“Okay, where are you right now? Are you in a safe place?”*
*“I’m at my friend Dylan’s house, he left to go to the corner store but I don’t know it’s been a little longer than usual. It doesn’t feel right.”*
*“Do you know Dylan’s address? What’s your name?”*
*“My name’s Patrick and yeah, it’s (address). I’m freaking out, man.”* He was panting a little.
*“You said that you think someone might be in the house, correct? Are you in a safe place? Can you give me more details?”* I sent out the dispatch.
*“Yeah, I’m in the basement now. I closed the door but I think I can hear someone walking around, I don’t know I might just be tripping out – but like yesterday I noticed this car outside my apartment and it’s been everywhere since. I went to class and saw it in the parking lot on my way in this morning. I tried to tell Dylan about it but he told me that I’m a pussy. I – I don’t know, it feels weird. Like the car is outside Dylan’s right now. It’s weird, right?”* He was talking fast, he was obviously freaked out.
*“It does sound a little suspicious. I’ve sent the dispatch, someone should be there shortly. Did you get a chance to look at their license plate? If the car is gone when the police arrive, they can run the plates.”*
*“No – but I can go out and look.”*
*“No, that’s not a good idea. Stay where you are. What does the car look like?”*
*“It’s a black Ford Focus, the windows are tinted and everything.”* His breathing was ragged as he spoke.
*“Okay, I’m just adding to the dispatch and letting them know to look out for a black Ford Focus. Can you still hear someone upstairs?”*
*“No – hold on.”* I could hear the phone being handled and them he came back over the line. *“Dylan just texted me, he’s gone to the grocery store to get munchies. Fuck – what do I do?”*
*“Can you ask him if there’s a possibility that anyone else could be at his house? His parents, sibling, a girlfriend or something?”*
*“They’re gone on vacation and he had to work, that’s why we’re crashing here. He’s got cable – I don’t. He doesn’t have a girlfriend either so I think whoever is following me is in the house.”*
*“Okay, is the door locked to the basement?”* I was trying to make him as safe as possible.
*“Yeah, I locked it when Dylan left. I’m not just paranoid, right?”*
*“No, I don’t think so. Just to be safe, I want you to stay in the basement. Text Dylan and let him know what’s going on so that he doesn’t walk into a potentially harmful situation.”* The phone shuffled around a little and he came back over the line.
*“Someone’s trying to get in, I can hear them trying the doorknob.”* His voice dropped to a small whisper.
*“Patrick, is there somewhere you can hide?”*
*“There’s a bathroom?”*
*“Okay, go in there and lock the door. I want you to stay there until the police arrive.”* We sat on the phone for about a minute in silence and then all of a sudden, the fire alarm went off.
*“Is that the fire alarm?”* I asked before continuing *“I want you to slowly exit the bathroom and I want you to tell me if you smell or see any smoke.”*
*“Yeah, the house is kind of foggy. Did someone start a fire in the house? What do I do?”* He started to panic.
*“Are there any windows in the basement?”*
*“No.”* He started to hyperventilate.
*“Okay, so you’ll have to go up through the basement door and to the nearest exit. But first, I want you to go into the bathroom.”* I paused and then continued. *“Do you see any towels?”* He agreed “I want you to soak it in cold water and put it over yourself and over your mouth and nose. It’ll help you to breathe, can you do that?”* I heard him turn on the water and soak some towels as quickly as he could possibly do, then I heard him running up the stairs.
*“It’s locked!”* He yelled and he banged against the door. *“The smoke’s really bad up here.”* He coughed through his sentence.
*“Try your best to break through the door, do you know if there’s another way out of the house from the basement?”*
*“I can’t break the fucking door, I think there’s something in front of it. What the fuck do I do?”* He started to cry.
*“Patrick, go down to where you were in the basement, the smoke won’t be as bad down there. Do you know if there’s any other way out of the house or any other way upstairs?”*
*“No – no there’s no way out of here. There’s a laundry shoot, but like I don’t know if I’ll be able to fit through the hole.”* He was still sobbing.
*“I want you to try to squeeze through it, unless you think you’ll get stuck. We’re going to try to get you out of this house, okay?”* I tried to remain calm, as I myself was feeling the pressure of the situation. He mumbled his way over to where the laundry shoot was and started to move some items around.
*“Okay, I made something to stand on.”* I could hear him trying to wiggle his way through the shoot when there was some commotion and then a thud. The phone had fallen and the impact of it hitting the ground disconnected the call.
The following morning I was off, I heard the news about the fire. The news read something along the lines of “Family home gets torched as family is away on vacation.” In the details they mentioned that a boy had been stuck in the basement and they had found him unconscious and badly burned. He was sent to the hospital for immediate care.
Upon further investigation, they found out that the fire was set intentionally and that Patrick had been trapped in the basement on purpose. Patrick himself had third degree burns to over 50% of his body and he was put into an induced coma for recovery. After spending 60 days in a coma, the doctors decided to wake him. He was awake for nearly a week before he suffered a stroke and died. He was only 21 years old. Police still don’t know who set the fire and why, but I’m positive it had to do with the car that he said was following him. | 0non-cybersec
| Reddit | 1,987 | 7,666 |
5e Favorite Non Combat Encounters?. So I've just starting DM'ing and have most of my stuff in order. I have my party in an open world where they can go where they want and am in the process of getting the map I made sorted out, i.e., what is going to be in this ruin/dungeon/etc...
Giving each place a unique combat encounter would be fairly easy, but I also don't want every place to necessitate combat. So my question to you guys is this: What have been your favorite non combat encounters? So puzzles, roleplay encounter, stuff like that.
Thanks for your feedback! | 0non-cybersec
| Reddit | 141 | 570 |
Combine multiple disks to one 'big' disk on my external HDD. <p>I run into a problem with my external HDD, i used it for backups but when i reinstalled windows (and forgot to remove the HDD) my HDD got wiped. After the wipe suddenly my HDD split itself into multiple Disks.</p>
<p>I would like to bring it back to one disk, just like it was when i bought it.</p>
<p>Can anyone help me out, or give me some tips on how to achieve this?</p>
<p>Here is an image of the partitions, if you need any extra details of information let me know and i will post it!</p>
<p>Disk management:</p>
<p><a href="https://i.stack.imgur.com/XGryJ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XGryJ.jpg" alt="enter image description here"></a></p>
| 0non-cybersec
| Stackexchange | 241 | 762 |
Mapping a Dataframe into another using conditionals. <p>I would like to map one dataframe into another, though it is not so simple because I am using 2 conditions to execute the mapping - I will explain them below. Basically, what I am trying to do is given two dataframes, df1 and df2, such that:</p>
<p>df1:</p>
<pre><code>A B Type
Heart Spades Boo
Heart Clubs Fog
Spades Diamonds Bler
</code></pre>
<p>df2:</p>
<pre><code>A B Boo Fog Bler
Heart Spades True True True
Spades Diamonds True False True
Heart Spades True True False
</code></pre>
<p>I could map the values contained in the columns 'Boo','Fog,'Bler' into a new column in df1 called 'Verification', resulting in:</p>
<pre><code>A B Type Verification
Heart Spades Boo True
Heart Clubs Fog
Spades Diamonds Bler True
</code></pre>
<p>Then, to do this process I have 2 conditions that need to be filled: the values in df1 and the values in df2 for the columns A and B must be equal - as they were acting as keys, and the mapping should take the values in some column of df2 based on the value in the type of df1. I am having two difficulties:</p>
<ol>
<li>The mapping requires two columns so I am not able to figure out a way to use pandas.series.map; furthermore I was not able to apply Dataframe.loc[conditions] in this context so that the conditions compare df1 and df2.</li>
<li>The example above is quite short, but the data set that I am working on has several combinations from the values of A and B, hence is unreasonable to write a function of association between A,B and value to each type.</li>
</ol>
<p>Do you have any suggestions?</p>
| 0non-cybersec
| Stackexchange | 503 | 1,728 |
Python: is it possible to link two variable belonging to two different classes?. <p>I would like to connect two variables totwo different classes but I don't know if what I'm trying to do is possible or not.</p>
<p>for instance, if I have those two classes:</p>
<pre><code>class one():
def __init__(self):
self.a = 0
def compute(self):
self.a = self.a + 1
class two():
def __init__(self):
self.a = 0
self.C_one = one()
self.link()
def link(self):
self.a = self.C_one.a
def compute(self):
self.C_one.compute()
print('C_one a=',self.C_one.a )
print('C_two a=',self.a )
C_two = two()
for i in range(5):
C_two.compute()
</code></pre>
<p>In the class <code>two</code> I would like connect the variable <code>a</code> with the variable <code>a</code> of class <code>one</code>, so I don't have to explicitly call <code>self.a = self.C_one.a</code> each time I execute <code>C_two.compute</code></p>
<p>The code in example give me this:</p>
<pre><code>C_one a= 1
C_two a= 0
C_one a= 2
C_two a= 0
C_one a= 3
C_two a= 0
C_one a= 4
C_two a= 0
C_one a= 5
C_two a= 0
</code></pre>
<p>Which is not the result I expect.
Somebody know if I can do that in python?</p>
<h2>update</h2>
<p>From the example below</p>
<pre><code>class one():
def __init__(self):
self.a = 0
def compute(self):
self.a = self.a + 1
class two():
def __init__(self):
self.a = 0
class three():
def __init__(self):
self.C_one = one()
self.C_two = two()
self.b = 0
def compute(self):
self.C_one.compute()
#self.C_two.a = self.C_one.a
print('C_one a=',self.C_one.a )
print('C_two a=',self.C_two.a )
C_three = three()
for i in range(5):
C_three.compute()
</code></pre>
<p>is it possible to use the answer of deceze and replace the commented line <code>#self.C_two.a = self.C_one.a</code>with a property ? Like that classes <code>one</code> and <code>two</code> are linked in the class <code>three</code>.</p>
<h2>answer from deceze</h2>
<pre><code>class one():
def __init__(self):
self.a = 0
def compute(self):
self.a = self.a + 1
class two():
def __init__(self,one):
self.C_one = one
@property
def a(self):
return self.C_one.a
class three():
def __init__(self):
self.C_one = one()
self.C_two = two(self.C_one)
self.b = 0
def compute(self):
self.C_one.compute()
print('C_one a=',self.C_one.a )
print('C_two a=',self.C_two.a )
C_three = three()
for i in range(5):
C_three.compute()
</code></pre>
| 0non-cybersec
| Stackexchange | 984 | 2,678 |
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 |
Perl Program to efficiently process 500,000 small files in a directory. <p>I am processing a large directory every night. It accumulates around 1 million files each night, half of which are <code>.txt</code> files that I need to move to a different directory according to their contents.</p>
<p>Each <code>.txt</code> file is pipe-delimited and contains only 20 records. Record 6 is the one that contains the information I need to determine which directory to move the file to.</p>
<p>Example Record: </p>
<pre><code>A|CHNL_ID|4
</code></pre>
<p>In this case the file would be moved to <code>/out/4</code>.</p>
<p>This script is processing at a rate of 80,000 files per hour.</p>
<p>Are there any recommendations on how I could speed this up?</p>
<pre><code>opendir(DIR, $dir) or die "$!\n";
while ( defined( my $txtFile = readdir DIR ) ) {
next if( $txtFile !~ /.txt$/ );
$cnt++;
local $/;
open my $fh, '<', $txtFile or die $!, $/;
my $data = <$fh>;
my ($channel) = $data =~ /A\|CHNL_ID\|(\d+)/i;
close($fh);
move ($txtFile, "$outDir/$channel") or die $!, $/;
}
closedir(DIR);
</code></pre>
| 0non-cybersec
| Stackexchange | 384 | 1,144 |
How to correctly render coincident polygons in OpenGL (ES). <p>I understand that by setting the depth function in OpenGL ES one can control how overlapping geometries are rendered in a 3D scene. I use <code>gl.depthFunc(gl.LEQUAL)</code> (webgl) in my code.</p>
<p>However when two sets of polygons are coincident and are of different color, the resulting surface turns out to be an arbitrary mixed pattern of the two colors (which changes as the camera location changes, hence leads to flickering). Take a look at this image:</p>
<p><img src="https://i.stack.imgur.com/WN1xg.png" alt="enter image description here"></p>
<p>How can I fix this? I have tried different depthFunc values, but none of them solves this problem. I would like the coincident polygons to have single color, it doesn't matter which one.</p>
| 0non-cybersec
| Stackexchange | 216 | 818 |
How can I console.log the value of a observable?. <p>I am using angular 2 and RxJS, and I am wondering how i can do the following:</p>
<p>In my component, I have defined the following:</p>
<p><code>count: Observable<number>;</code></p>
<p>In my component's constructor, I am doing the following:</p>
<pre><code>constructor(
private store: Store<any>
) {
this.count = this.store.select<any>(state => state.count);
}
</code></pre>
<p>How can I view the current value for the count? Right now if I <code>console.log(this.count)</code> I get a big object to log. If I want to view just the value for this.count, how can I do that?</p>
| 0non-cybersec
| Stackexchange | 225 | 671 |
XOR in Swift 5?. <p>I'm trying to do an XOR operation in Swift 5. The documentation does not seem to mention explicitly doing it with two boolean values here:</p>
<p><a href="https://docs.swift.org/swift-book/LanguageGuide/AdvancedOperators.html" rel="noreferrer">https://docs.swift.org/swift-book/LanguageGuide/AdvancedOperators.html</a></p>
<p>Is this possible? It says to use the <code>^</code> operation but I get the error when trying: </p>
<pre><code> card != nil ^ appointment.instructor == nil
</code></pre>
<blockquote>
<p>ERROR Adjacent operators are in non-associative precedence group 'ComparisonPrecedence' </p>
</blockquote>
| 0non-cybersec
| Stackexchange | 197 | 645 |
control of an integral using maximal function. <p>Let $I$ be a compact interval with center $c(I)$ and N be a large positive integer. It seems to me that there exists a constant $C$ such that for any good function $f$ (e.g. Schwartz function) we have
$$
\frac{1}{|I|}\int\frac{|f(x)|}{(1+\frac{|x-c(I)|}{|I|})^N} dx\le C\inf_{x\in I}Mf(x)
,$$ where $Mf$ is the Hardy-Littlewood maximal function of $f$.</p>
<p>I was unable to prove it. I know that $\int\frac{1}{(1+\frac{|x-c(I)|}{|I|})^N} dx$ is almost the same as $\int_I\frac{1}{(1+\frac{|x-c(I)|}{|I|})^N} dx$ because of the fast decay outside $I$. But when there is an $f(x)$ on the top, I'm worried about the situation $f$ is supported far away from $I$. Any help is appreciated. </p>
| 0non-cybersec
| Stackexchange | 262 | 742 |
Check if value exists before copy-paste. <p>Can someone help please as I am new to Google Scripts.</p>
<p>I have this simple code that copies values from one sheet to another</p>
<pre><code>function copyrevision() {
var ss = SpreadsheetApp.getActiveSpreadsheet ();
var destSheet = ss.getSheetByName("Fallas Tecnicas");
//DATE
var source = ss.getRange ("D4");
var destRange = destSheet.getRange(destSheet.getLastRow()+1,1);
source.copyTo (destRange, {contentsOnly: true});
//REPORT NUMBER
var source2 = ss.getRange ("C4");
var destRange = destSheet.getRange(destSheet.getLastRow(),2);
source2.copyTo (destRange, {contentsOnly: true});
//OBSERVACION
var source6 = ss.getRange ("E49");
var destRange = destSheet.getRange(destSheet.getLastRow(),6);
source6.copyTo (destRange, {contentsOnly: true});
}
</code></pre>
<p>I need this operation to be done only if the report number value does not exist in the column 2 of destination sheet.</p>
<p>How can it be done?</p>
| 0non-cybersec
| Stackexchange | 328 | 998 |
Inserting an HTTP stream into a AVMutableComposition. <p>I am trying to insert an AVURLAsset of a AVPlayerItem that states <code>AVPlayerItemStatusReadyToPlay</code> into an <code>AVMutableComposition</code> like this:</p>
<pre><code>composition_ = [[AVMutableComposition alloc] init];
insertionPoint_ = kCMTimeZero;
item_ = [[AVPlayerItem playerItemWithURL:[NSURL URLWithString:@"http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"]] retain];
[item_ addObserver:self forKeyPath:@"status" options:0 context:nil];
player_ = [[AVPlayer playerWithPlayerItem:item_] retain];
[player_ addObserver:self forKeyPath:@"currentItem.duration" options:0 context:nil];
/**
* append a player-item to our composition
*/
- (void)addItemToComposition:(AVPlayerItem *)item
{
NSError *error = nil;
VTRACE(@"item duration: %g", CMTimeGetSeconds(item.duration));
if (![composition_ insertTimeRange:CMTimeRangeMake(kCMTimeZero, item.duration)
ofAsset:item.asset
atTime:insertionPoint_
error:&error])
{
VTRACE(@"error: %@", error);
}
}
/**
* simplified value observer callback
*/
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if ([object isKindOfClass:[AVPlayerItem class]])
{
AVPlayerItem *item = (AVPlayerItem *)object;
//playerItem status value changed?
if ([keyPath isEqualToString:@"status"])
{ //yes->
switch(item.status)
{
case AVPlayerItemStatusFailed:
VTRACE(@"player item status failed");
break;
case AVPlayerItemStatusReadyToPlay:
VTRACE(@"player item status is ready to play");
[self addItemToComposition:player_.currentItem];
break;
case AVPlayerItemStatusUnknown:
VTRACE(@"player item status is unknown");
break;
}
}
}
else if([object isKindOfClass:[AVPlayer class]])
{
if ([keyPath isEqualToString:@"currentItem.duration"])
{ //yes->
VTRACE(@"player item duration available");
}
}
}
</code></pre>
<p>Unfortunately, all I get is this lousy error message from the attempt to invoke <code>AVMutableComposition insertTimeRange:ofAsset:atTime:error:</code></p>
<blockquote>
<p>2011-11-29 22:24:59.446 XXX[13626:10703] -[XXX addItemToComposition:]
-- error: Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo=0x7699f30
{NSLocalizedFailureReason=An unknown error occurred (-12780),
NSUnderlyingError=0xd124dd0 "The operation couldn’t be completed.
(OSStatus error -12780.)", NSLocalizedDescription=The operation could
not be completed}</p>
</blockquote>
<p>What am I missing?</p>
<p>Why is it not possible to insert the item into the composition? </p>
<p>When inspecting the <code>AVURLAsset</code> of that <code>AVPlayerItem</code> I also noticed that the tracks array is allocated but empty. Could that be the reason, and if so, how do I get the <code>AVURLAsset</code> to properly hold valid tracks?</p>
| 0non-cybersec
| Stackexchange | 937 | 3,308 |
Spring's JdbcTemplate and Transactions. <p>When using JdbcTemplate, do I need to explicitly configure transactions?</p>
<p>My code layout looks like the following:</p>
<p>I will have a UserDao that will be injected into my UserService, and then my Controllers will make calls on methods in my UserService.</p>
<p>I want to keep things as simple as possible transaction wise, and I don't need multiple database calls to span a transaction.</p>
<p>By default, do I have to do anything in my configuration file or use a <code>@Transaction</code> annotation anywhere?</p>
<p>Now say in my controller I need to make 2 calls on my userService and accountService, could I explicitly wrap it in a transaction somehow?</p>
<pre><code>userService.updateUser(user);
accountService.updateXXX(...);
</code></pre>
| 0non-cybersec
| Stackexchange | 223 | 810 |
Copy column to automatically update in Excel. <p>I currently have a column of numbers in, say, sheet A. I'd like to copy this column to sheet B which is easy enough.<br>
However, if i make a change to a value in the column in sheet A is there a way to make the value automatically alter in sheet B?
(I am working on a Mac but answers in either Windows or Mac would be helpful).</p>
<p>Currently, sheet A is a long list of numbers and sheet B is identical with the duplicates removed. If I add a new value into A I would like this to automatically appear in B.</p>
| 0non-cybersec
| Stackexchange | 144 | 566 |
Nothing in /sys/class/bluetooth. <p>Using Arch Linux and a bluetooth USB dongle identified as RTL8192CU.</p>
<p>Have all the recommended bluez packages installed and a few others besides:</p>
<pre><code>extra/bluez 5.51-2 [installed]
Daemons for the bluetooth protocol stack
extra/bluez-libs 5.51-2 [installed]
Deprecated libraries for the bluetooth protocol stack
extra/bluez-qt 5.63.0-1 (kf5) [installed]
Qt wrapper for Bluez 5 DBus API
extra/bluez-utils 5.51-2 [installed]
Development and debugging utilities for the bluetooth protocol stack
community/bluez-tools 0.2.0-4 [installed]
A set of tools to manage Bluetooth devices for Linux
local/bluez-hciconfig 5.50-1 [installed]
deprecated hciconfig tool from bluez
local/bluez-hcitool 5.45-1 [installed]
deprecated rfcomm tool from bluez
</code></pre>
<p>I have been following the wikis from Arch Linux: <a href="https://wiki.archlinux.org/index.php/Bluetooth#Debugging" rel="nofollow noreferrer">Bluetooth</a> and <a href="https://wiki.archlinux.org/index.php/Bluetooth_headset#Legacy_documentation:_ALSA,_bluez5_and_PulseAudio_method" rel="nofollow noreferrer">Bluetooth Headset</a></p>
<p>Initially I had problems starting the bluetooth.service in systemd. It would not start if /sys/class/bluetooth was absent. I managed to force this to happen by adding btusb in a file in /etc/modules-load.d. I now have a directory called /sys/class/bluetooth, but this remains resolutely empty.</p>
<p>In dmesg I can see that the adapter is identified and the microcode loaded.</p>
<pre><code>[ 23.984058] rtl8192cu: Chip version 0x10
[ 24.072147] rtl8192cu: Board Type 0
[ 24.073623] rtl_usb: rx_max_size 15360, rx_urb_num 8, in_ep 1
[ 24.074935] rtl8192cu: Loading firmware rtlwifi/rtl8192cufw_TMSC.bin
[ 24.076401] ieee80211 phy0: Selected rate control algorithm 'rtl_rc'
[ 24.077927] usbcore: registered new interface driver rtl8192cu
</code></pre>
<p>I think the correct modules are loaded:</p>
<pre><code>Module Size Used by
bnep 28672 2
fuse 139264 3
rtl8xxxu 139264 0
rtl8192cu 94208 0
snd_hda_codec_hdmi 69632 1
rtl_usb 24576 1 rtl8192cu
rtl8192c_common 65536 1 rtl8192cu
snd_hda_codec_via 24576 1
rtlwifi 126976 3 rtl8192c_common,rtl_usb,rtl8192cu
snd_hda_codec_generic 94208 1 snd_hda_codec_via
ledtrig_audio 16384 1 snd_hda_codec_generic
mac80211 999424 4 rtl_usb,rtl8192cu,rtlwifi,rtl8xxxu
saa7134_alsa 28672 1
intel_rapl_msr 20480 0
intel_rapl_common 28672 1 intel_rapl_msr
cfg80211 856064 2 rtlwifi,mac80211
i915 2326528 26
libarc4 16384 1 mac80211
i2c_algo_bit 16384 1 i915
x86_pkg_temp_thermal 20480 0
saa7134 192512 1 saa7134_alsa
input_leds 16384 0
intel_powerclamp 20480 0
joydev 28672 0
mousedev 24576 0
drm_kms_helper 212992 1 i915
drm 516096 15 drm_kms_helper,i915
tveeprom 28672 1 saa7134
coretemp 20480 0
v4l2_common 16384 1 saa7134
intel_gtt 24576 1 i915
snd_hda_intel 53248 5
videobuf2_dma_sg 16384 1 saa7134
agpgart 53248 2 intel_gtt,drm
videobuf2_memops 20480 1 videobuf2_dma_sg
videobuf2_v4l2 28672 1 saa7134
snd_hda_codec 159744 4 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec_via
kvm 778240 0
videobuf2_common 57344 2 saa7134,videobuf2_v4l2
syscopyarea 16384 1 drm_kms_helper
snd_hda_core 102400 5 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,snd_hda_codec_via
videodev 237568 4 v4l2_common,saa7134,videobuf2_v4l2,videobuf2_common
sysfillrect 16384 1 drm_kms_helper
irqbypass 16384 1 kvm
mc 61440 4 videodev,saa7134,videobuf2_v4l2,videobuf2_common
rc_core 57344 1 saa7134
r8169 94208 0
sysimgblt 16384 1 drm_kms_helper
iTCO_wdt 16384 0
iTCO_vendor_support 16384 1 iTCO_wdt
snd_hwdep 20480 1 snd_hda_codec
fb_sys_fops 16384 1 drm_kms_helper
realtek 20480 1
libphy 98304 2 r8169,realtek
mei_wdt 16384 0
eeepc_wmi 16384 0
snd_pcm 135168 6 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,saa7134_alsa,snd_hda_core
asus_wmi 36864 1 eeepc_wmi
snd_timer 40960 1 snd_pcm
crct10dif_pclmul 16384 1
wmi_bmof 16384 0
ppdev 24576 0
mei_hdcp 24576 0
sparse_keymap 16384 1 asus_wmi
snd 110592 20 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hwdep,snd_hda_intel,snd_hda_codec,snd_timer,snd_hda_codec_via,saa7134_alsa,snd_pcm
lpc_ich 28672 0
soundcore 16384 1 snd
crc32_pclmul 16384 0
mei_me 45056 2
ghash_clmulni_intel 16384 0
mei 122880 5 mei_wdt,mei_hdcp,mei_me
parport_pc 53248 0
i2c_i801 36864 0
aesni_intel 372736 0
parport 61440 2 parport_pc,ppdev
aes_x86_64 20480 1 aesni_intel
crypto_simd 16384 1 aesni_intel
cryptd 24576 2 crypto_simd,ghash_clmulni_intel
evdev 24576 12
mac_hid 16384 0
glue_helper 16384 1 aesni_intel
intel_cstate 16384 0
intel_uncore 147456 0
pcspkr 16384 0
wmi 36864 2 asus_wmi,wmi_bmof
intel_rapl_perf 16384 0
sg 40960 0
crypto_user 16384 0
btusb 65536 0
btrtl 24576 1 btusb
btbcm 16384 1 btusb
btintel 28672 1 btusb
bluetooth 675840 11 btrtl,btintel,btbcm,bnep,btusb
ecdh_generic 16384 1 bluetooth
rfkill 28672 7 asus_wmi,bluetooth,cfg80211
ecc 32768 1 ecdh_generic
ip_tables 36864 0
x_tables 49152 1 ip_tables
ext4 770048 3
crc32c_generic 16384 0
crc16 16384 2 bluetooth,ext4
mbcache 16384 1 ext4
jbd2 135168 1 ext4
uas 28672 0
hid_generic 16384 0
usb_storage 77824 1 uas
usbhid 65536 0
hid 143360 2 usbhid,hid_generic
sr_mod 28672 0
cdrom 73728 1 sr_mod
sd_mod 57344 6
ata_generic 16384 0
pata_acpi 16384 0
ata_piix 36864 4
libata 282624 3 ata_piix,pata_acpi,ata_generic
xhci_pci 20480 0
ehci_pci 20480 0
scsi_mod 249856 6 sd_mod,usb_storage,uas,libata,sg,sr_mod
xhci_hcd 278528 1 xhci_pci
crc32c_intel 24576 6
ehci_hcd 98304 1 ehci_pci
</code></pre>
| 0non-cybersec
| Stackexchange | 2,511 | 7,208 |
Haven't purchased greens in months.. Zone 6b here. Thought I'd share my [recent bounty.](http://imgur.com/a/vg1S7#0)
Since about mid-March, I've been smugly mocking the pricey boxes of prewashed greens at the grocery store as I walk past. Organic spinach? Arugula? Cilantro? Lettuce? Yeah, I got those. *For free.*
Nature gets all the credit, though, since all of these veggies were from plants I let go to seed last season, and the weather has been nice and cool for these guys to flourish. I've just watered and kept the weeds at bay.
And, I got my first radish! This was a big deal for me, you guys. I've never had success. It was so cute and perfect, that I almost felt bad for eating it. But it's deliciousness gave me no regrets.
Small victories. | 0non-cybersec
| Reddit | 208 | 756 |
Solve the inverse of $y = \dfrac{2x+1}{3-4x}$. <p>So I just got back from a Calculus test and I have some trouble figuring out one of the questions, it states:</p>
<p>"Calculate the inverse of the function $y=\dfrac{2x+1}{3-4x}$."</p>
<p>What first came into my mind was to eliminate the denominator somehow. But I quickly realized that it would be rather difficult science the numerator is also of degree one. I then got desperate and just tried to move the denominator and got this expression witch did not help me at all.
$$y(3-4x) = 2x+1$$
After several more equally stupid moves I gave up. Even now with the help of Wolfram Alpha I can not figure out how to solve it. Can anyone explain? </p>
| 0non-cybersec
| Stackexchange | 197 | 700 |
[S7E1] Post-Premiere Discussion - S7E1 'Dragonstone'. #Post-Premiere Discussion Thread
Discuss your thoughts and reactions to the current episode you just watched. What exactly just happened in the episode? Please make sure to reserve your predictions for the next episode to the [Pre-Episode Discussion Thread](/r/gameofthrones/w/episode_discussion) which will be posted later this week on Friday. Don't forget to fill out our Post-Episode Survey! A link to the Post-Episode Survey for this week's episode will be stickied to the top of this thread as soon as it is made.
---
##This thread is scoped for [S7E1](http://i.imgur.com/E5QW4TD.jpg) SPOILERS
* Turn away now if you are not caught up watching or have not seen the episode! Open discussion of all aired TV events up to and including S7E1 is okay without tags.
* **[S7E2 spoilers must be tagged!](#s)** Or save your comments about the S7E2 trailer for the trailer thread when it is posted.
* **[Book spoilers must be tagged!](#b)** If it did not happen in the show, even if the show will probably never cover it, it must be labelled and tagged.
* **Production spoilers are not allowed!** Make your own post labelled [S7 Production] if you'd like to discuss plot details which have leaked out on social media or through media reports. [Everything] posts do not cover this type of spoiler.
* **Please read the [Posting Policy](/r/gameofthrones/w/posting_policy) before posting.**
---
##S7E1 - "Dragonstone"
* Directed By: Jeremy Podeswa
* Written By: David Benioff & D. B. Weiss
* Airs: July 16, 2017
Jon organizes the defense of the North. Cersei tries to even the odds. Daenerys comes home.
---
* [Posting Policy](/r/gameofthrones/w/posting_policy)
* [Spoiler Guide](/r/gameofthrones/w/spoiler_guide)
* [Frequently Asked Questions](/r/gameofthrones/w/faq)
* [Original Episode Discussions](/r/gameofthrones/w/episode_discussion)
* [Previous Rewatch Discussions](/r/gameofthrones/w/rewatch)
* [Our Discord](https://discord.gg/nJz3WmH)
* [Our Twitter](https://twitter.com/RedditThrones)
| 0non-cybersec
| Reddit | 621 | 2,057 |
disk space keeps filling up on EC2 instance with no apperent files/directories. <p>How come os shows 6.5G used but I see only 3.6G in files/directories?</p>
<p>Running as root on an Amazon Linux AMI (seems like Centos), lots of free memory available, no swapping going on, no apparent file descriptors issue.
The only thing I can think of is a log file that was deleted while applications append to it.</p>
<p>Disk space usage is slowly but continuously rising towards full capacity (~1k/min with very small decreases from time to time)</p>
<p>Any explanation?
Solution?</p>
<blockquote>
<p><strong>du --max-depth=1 -h /<br/></strong>
1.2G /usr<br/>
4.0K /cgroup<br/>
22M /lib64<br/>
11M /sbin<br/>
19M /etc<br/>
52K /dev<br/>
2.1G /var<br/>
4.0K /media<br/>
0 /sys<br/>
4.0K /selinux<br/>
du: cannot access <code>/proc/14024/task/14024/fd/4': No such file or directory du: cannot access<br/>
</code>/proc/14024/task/14024/fdinfo/4': No such file or directory du:<br/>
cannot access <code>/proc/14024/fd/4': No such file or directory du: cannot<br/>
access</code>/proc/14024/fdinfo/4': No such file or directory
0 /proc <br/>
18M /home<br/>
4.0K /logs<br/>
8.1M /bin<br/>
16K /lost+found<br/>
12M /tmp<br/>
4.0K /srv<br/>
35M /boot<br/>
79M /lib<br/>
56K /root<br/>
67M /opt<br/>
4.0K /local<br/>
4.0K /mnt<br/>
<strong>3.6G</strong> /<br/></p>
<p><strong>df -h</strong><br/></p>
<p>Filesystem Size Used Avail Use% Mounted on <br/>
/dev/xvda1 <strong>7.9G</strong> 6.5G 1.4G 84% / tmpfs 3.7G 0 3.7G 0% /dev/shm<br/></p>
<p>sysctl fs.file-nr fs.file-nr = 864 0 761182<br/></p>
</blockquote>
| 0non-cybersec
| Stackexchange | 731 | 1,823 |
sum cells of certain columns for each row. <p>I would like to calculate sums for certain columns and then apply this summation for every row. Unfortunately, I can only get to the first step. How do I now make it happen for each row? I know that R doesn't need loops; what are good approaches?</p>
<p>My matrix (zscore) looks like this:</p>
<pre><code> a b c t y
1 3 4 7 7 4
2 4 56 6 6 4
3 3 3 2 1 7
4 3 88 9 9 9
</code></pre>
<p>Now I would want to calculate the row sum for each row, based on some of the columns. For one row it could look like this:</p>
<pre><code>f1 <- sum(zscore[1,1:2], zscore[1,3], zscore[1,5])
</code></pre>
<p>How do I do that now for each row?</p>
| 0non-cybersec
| Stackexchange | 261 | 744 |
Console logging using script command output unreadable. <p>I wanted to log my program's (the python program boots up a headless embedded device connected to a serial port) output to a text file <code>console_log.txt</code> using a shell script, for which, I wrote the following script:</p>
<pre><code>#!/bin/bash
current_time=$(date "+%Y.%m.%d-%H.%M.%S")
gnome-terminal -x bash -c "cd ~/Scripts;pwd;script -c \"python test.py $1\" ~/Output/console_log_$current_time.txt;exec $SHELL"
</code></pre>
<p>The above writes unreadable (non ASCII) characters to the file along the lines of:</p>
<pre><code>捓楲瑰猠慴瑲摥漠桔牵摳祡〠‶灁楲〲㜱〠㨳㔲㈺‸䵐䤠呓ഊ上漠慰慲敭整獲瀠潲楶敤祢琠敨甠敳›ㄠ敔瑳漠瑰潩湥整敲›〠獕湩敤慦汵⁴潣普杩牵瑡潩楦敬⸮⸮⨪⨪⨪⨪⨪桔潣普杩牵瑡潩楦敬琠慨❴潧湩潴戠獵摥椠›㰠潮敮ാ猊慴瑲湩慭湩猠牣灩൴⼊潨敭愯瑵浯瑡潩㑮愯瑵浯瑡潩⽮噄㥆弹畁潴慭楴湯栯浯⽥畡潴慭楴湯⼴畡潴慭楴湯䐯䙖㤹䅟瑵浯瑡潩⽮湉異⽴❛灳捥牴浵睟形档物慷❶洧污彥欸眮癡Ⱗ✠灳捥牴浵湟形楤捳㍟〶⸰慷❶猧数瑣畲彭扮损楨灲眮癡Ⱗ✠灳捥牴浵睟形楤捳㕟〸⸰慷❶琧獥慷❶洧污彥㘱慷❶昧汭扟灵慟瑴潟杲眮癡崧㠠栯浯⽥畡潴慭楴湯⼴畡潴慭楴湯䐯䙖㤹䅟瑵浯瑡潩⽮湉異⽴潣普杩琮瑸††††††††††唠䕓⁒†††倠䑉䄠䍃卅⁓佃䵍乁ൄ⼊敤⽶瑴啹䉓㨸††††畡潴慭楴湯‴㈠㘲㔷䘠⸮⸮氠杯湩楟楮൴⼊敤⽶瑴啹䉓㨹††††畡潴慭楴湯‴㈠㘲㔶䘠⸮⸮氠杯湩楟楮൴匊牥慩潐瑲楬瑳㨠†❛✹㠧崧敓楲污瀠牯獴㨠†❛搯癥琯祴单㥂Ⱗ✠搯癥琯祴单㡂崧桃灩敳⁴‱›ㄠ桃灩敳⁴′›ㄠ潂牡‱敓楲污倠牯⁴›⼠敤⽶瑴啹䉓ഹ䈊慯摲㈠匠牥慩潐瑲㨠†搯癥琯祴单㡂潂牡ㅤ䤠⁐›ㄠ㈷㈮⸸⸴㈳潂牡㉤䤠⁐›ㄠ㈷㈮⸸⸴㘳潂牡㍤䤠⁐›ㄠ㈷㈮⸸⸴㔲潂牡㑤䤠⁐›ㄠ㈷㈮⸸⸴㜲潂牡㕤䤠⁐›ㄠ㈷㈮⸸⸴㠵汯敲畳瑬搠汥猠捵散獳⸮慰獳潔‽❛牳敥慫瑮䁳獤杰挮浯崧灓楬⁴潶灩‽ര⨊⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪潓湵慃摲䌠湯捥楴湯⩳⨪⨪⨪⨪⨪⨪പ⨊⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪佂剁ㅄⴠ㸭戠弱畯彴潰瑲漽瑵档ⰱ戠弱湩灟牯㵴湩档റ䈊䅏䑒′ⴭ‾㉢潟瑵灟牯㵴畯捴㉨㉢楟彮潰瑲椽据㉨⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪⨪പഊ嬊⼧敤⽶瑴啹䉓✹⼧敤⽶瑴啹䉓✸⼧敤⽶瑴啹䉓✳⼧敤⽶瑴啹䉓✲⼧敤⽶瑴啹䉓✱⼧敤⽶瑴啹䉓✰⼧敤⽶瑴卹✰൝嬊⼧敤⽶瑴啹䉓✹⼧敤⽶瑴啹䉓✸⼧敤⽶瑴啹䉓✳⼧敤⽶瑴啹䉓✲⼧敤⽶瑴啹䉓✱⼧敤⽶瑴啹䉓✰⼧敤⽶瑴卹✰൝䈊慯摲†椠⁰†‽㜱⸲㠲㐮㈮㤰慇整慷⁹灩†㴠ㄠ㈷㈮⸸⸴㔲ഴ䌊浯瀠牯
</code></pre>
<p>Or <code>gedit</code> displays messages like:</p>
<pre><code>Could not open the file “/home/user4/con…g_2017.04.06-16.05.48.txt”.
Unexpected error: Invalid byte sequence in conversion input
</code></pre>
<p>when I try to open the file.</p>
<p>When I run some thing simpler like:</p>
<pre><code>script -c ifconfig ~/user4/Scripts/test.txt
</code></pre>
<p>it runs just fine, i.e, I get the expected output at the log file. How to avoid such unreadable characters?</p>
| 0non-cybersec
| Stackexchange | 2,559 | 1,978 |
Goodness of fit tests in SciPy. <p>I'm new to Python and coming from the R world. I'm trying to fit distributions to sample data using SciPy and having good success. I can make <code>distribution.fit(data)</code> return sane results. What I've been unable to do is create the goodness of fit statistics which I'm used to with the <code>fitdistrplus</code> package in R. Is there a common method for comparing "best fit" from a number of different distributions with SciPy? </p>
<p>I'm looking for something like the Kolmogorov-Smirnov test or Cramer-von Mises or
Anderson-darling tests</p>
| 0non-cybersec
| Stackexchange | 158 | 591 |
Is it possible to reuse HTML like a template on multiple pages?. <p>I have several pages on a website that use the same header for each page. I was wondering if there was some way to simply reference a file with the html for the header sort of like in this pseudo code:</p>
<pre><code><!-- Main Page -->
<body>
<html_import_element src = "myheadertemplate.html">
<body>
</code></pre>
<p>Then in a separate file:</p>
<pre><code><!-- my header template html -->
<div>
<h1>This is my header</h1>
<div id = "navbar">
<div class = "Tab">Home</div>
<div class = "Tab">Contact</div>
</div>
</div>
</code></pre>
<p>This way I could write the header html once and just import it in each of my pages where I need it by writing one simple tag. Is this possible? Can I do this with XML?</p>
| 0non-cybersec
| Stackexchange | 317 | 891 |
Run lightning-charge on c-lightning regtest. <p>I'm trying to run lighting-charge (<a href="https://github.com/ElementsProject/lightning-charge" rel="nofollow noreferrer">https://github.com/ElementsProject/lightning-charge</a>) on top of one of my 2 lightning (<a href="https://github.com/ElementsProject/lightning" rel="nofollow noreferrer">https://github.com/ElementsProject/lightning</a>) instances. I am running 2 nodes using the script here: <code>lightning/contrib/startup_regtest.sh</code>. This file will start a bitcoin instance as well as 2 lightning nodes (<code>/tmp/l1-regtest</code>, <code>/tmp/l2-regtest</code>)</p>
<p>I then tried to run lightning-charge with:</p>
<pre><code>$ NETWORK=regtest charged --api-token super_secret_1 --ln-path ~/.lightning --db-path ~/charge1.db --port 9112
</code></pre>
<p>Which gives me this error:</p>
<pre><code>Lightning client connection error { Error: connect ECONNREFUSED ~/.lightning
at Object._errnoException (util.js:1022:11)
at _exceptionWithHostPort (util.js:1044:20)
at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1198:14)
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '~/.lightning' }
events.js:183
throw er; // Unhandled 'error' event
^
Error: connect ECONNREFUSED ~/.lightning
at Object._errnoException (util.js:1022:11)
at _exceptionWithHostPort (util.js:1044:20)
at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1198:14)
</code></pre>
<p>I've also tried running it with <code>ln-path</code> set to <code>/tmp/l1-regtest/</code></p>
<p>with <code>ps aux</code> I can see lightning is running with this command:</p>
<pre><code>~/git/lightning/lightningd/lightningd --lightning-dir=/tmp/l1-regtest
and
~/git/lightning/lightningd/lightningd --lightning-dir=/tmp/l2-regtest
</code></pre>
<p>Does anyone know how to get <code>lightning-charge</code> to connect to my regtest lightning node?</p>
<p>There are instructions on how to do this in docker in the readme file (<a href="https://github.com/ElementsProject/lightning-charge/blob/master/README.md" rel="nofollow noreferrer">https://github.com/ElementsProject/lightning-charge/blob/master/README.md</a>), but it doesn't seem to work outside of docker.</p>
| 0non-cybersec
| Stackexchange | 759 | 2,268 |
How the NSA tampers with US-made internet routers. [How the NSA tampers with US-made internet routers](http://www.theguardian.com/books/2014/may/12/glenn-greenwald-nsa-tampers-us-internet-routers-snowden)
>While American companies were being warned away from supposedly untrustworthy Chinese routers, foreign organisations would have been well advised to beware of American-made ones. A June 2010 report from the head of the NSA's Access and Target Development department is shockingly explicit. The NSA routinely receives – or intercepts – routers, servers and other computer network devices being exported from the US before they are delivered to the international customers.
>The agency then implants backdoor surveillance tools, repackages the devices with a factory seal and sends them on. The NSA thus gains access to entire networks and all their users. The document gleefully observes that some "SIGINT tradecraft … is very hands-on (literally!)".
>Eventually, the implanted device connects back to the NSA. The report continues: "In one recent case, after several months a beacon implanted through supply-chain interdiction called back to the NSA covert infrastructure. This call back provided us access to further exploit the device and survey the network."
>It is quite possible that Chinese firms are implanting surveillance mechanisms in their network devices. But the US is certainly doing the same.
>Warning the world about Chinese surveillance could have been one of the motives behind the US government's claims that Chinese devices cannot be trusted. But an equally important motive seems to have been preventing Chinese devices from supplanting American-made ones, which would have limited the NSA's own reach. In other words, Chinese routers and servers represent not only economic competition but also surveillance competition.
| 1cybersec
| Reddit | 392 | 1,855 |
My [m28] girlfriend [f27] farts A LOT during sex. She's awesome in every other way though. Help?!. M28/f27. We've only been together for 3 months, and get along great. She's the type of woman I could see marrying. But she farts during sex. A lot (sometimes 10+ times). She also thinks it's hilarious, so halfway through sex sometimes devolves into her giggling as I'm basically holding my nose and trying to pretend like I did not just feel another draft of air past my privates.
I contend that she should be able to hold it - she doesn't fart much the rest of the day, but she says it's unavoidable. I'm not really sure what to do.
Tl;dr: girlfriend farts a lot during sex and thinks it's funny,
but I have a tough time with it. | 0non-cybersec
| Reddit | 192 | 732 |
stdfloat.h version of stdint.h. <p>What standard naming conventions and or math libraries do you use? I currently use</p>
<pre><code>#include <stdint.h>
typedef float float32_t;
typedef double float64_t;
/*! ISO C99: 7.18 Integer types 8, 16, 32, or 64 bits
intN_t = two’s complement signed integer type with width N, no padding bits.
uintN_t = an unsigned integer type with width N.
floatN_t = N bit IEE 754 float.
uintN_t intN_t floatN_t
bits unsigned-integer signed-integer IEE754 float
8
16 unsigned short short ??"half"
32 unsigned int float
64 unsigned long long double
128 ?? "Long double" "quad" ??*/
</code></pre>
<p>but as you can see I am yet to decide upon a math library.
<hr/>
Original Question:
<strong>Recommendation for a small math library with Straight forward naming convention.</strong></p>
<p>Does anyone know of any small C libraries with straightforward naming conventions? This is what im using right now:</p>
<pre><code>typedef unsigned short UInt16; typedef short Int16;
typedef unsigned UInt32; typedef int Int32; typedef float Float32;
typedef unsigned long UInt64; typedef long int Int64; typedef double Float64;
</code></pre>
<p>What do you use??</p>
| 0non-cybersec
| Stackexchange | 379 | 1,388 |
web server behind NAT cannot be accessed by the same network using NAT router IP or domain. <p>I have 1 <strong>host server</strong> as NAT server, it has public domain name <code>example.com</code> tied to its public IP address <code>PUB_IP_ADD</code>.</p>
<p>I have another <strong>web server</strong> behind NAT with IP address <code>192.168.1.100</code> and port forwarding rules is done on the <strong>host server</strong>:</p>
<blockquote>
<p>-A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.1.100:80</p>
</blockquote>
<p>I have some <strong>other servers</strong> behind NAT with fixed ip address range <code>192.168.1.101-110</code> and the <code>masquerade</code> rules are done for the whole <code>192.168.1.0/24</code> range:</p>
<blockquote>
<p>-A POSTROUTING -s 192.168.1.0/24 -o vmbr0 -j MASQUERADE</p>
</blockquote>
<p>the above rules can let my servers behind NAT access internet. (download and ping public ips).</p>
<p>My web page can be accessed from the internet by visiting <code>example.com</code> but cannot be accessed from inside the NAT network in those <code>192.168.1.0/24</code> by using the same domain name or <strong>host server</strong> ip address.</p>
<p>I wonder, why the web server behind the NAT firewall cannot be accessed by its peers by using NAT server domain name or IP?</p>
<p>Do I need to add <code>SNAT</code> rules specifically to the <strong>web server</strong> and remove the <code>masquerade</code> line?</p>
| 0non-cybersec
| Stackexchange | 481 | 1,500 |
Combination of smartphone's pattern lock.. <p><strong>Note:</strong> Please do not mark this question as duplicate of <a href="https://math.stackexchange.com/questions/37167/combination-of-smartphones-pattern-password">Combination of smartphones' pattern password</a> because no answer given there is correct and I have an extra question related to it. </p>
<p>This is a smartphone Pattern lock.</p>
<p><a href="https://i.stack.imgur.com/1DVoo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1DVoo.png" alt="enter image description here"></a></p>
<p>The rules are as follows:<br>
1. At least 4 nodes should be selected.<br>
2. The pattern should be continuous.<br>
3. Cycles are not allowed.<br>
4. Any node cannot be revisited. </p>
<p>So, if we choose only four nodes. The number of arrangements are $^9P_4$.<br>
If we choose five, the number of arrangements are $^9P_5$ and so on. </p>
<p>But the total number of possible combinations is not $^9P_4 + ^9P_5 + ^9P_6 + ... + ^9P_9$. </p>
<p>The problem is here, that, if we choose an arrangement in which while connecting two points we go over another point, we are counting it twice. For example, if we choose the four point in the corners and join them cyclically, it goes over three more points so it comes under $^9P_4$ and also under $^9P_5$, $^9P_6$ and $^9P_7$. </p>
<p>What shall I do to remove these extra configurations? Is there any other problem with my method?</p>
| 0non-cybersec
| Stackexchange | 456 | 1,467 |
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 |
Solving a Recurrence Relationship. <p>Given recurrence relationship:</p>
<p>$g(1) = 5;\\
g(2n) = 4g(n);\\
g(2n+1) = 4g(n).$</p>
<p>I feel lost because of $g(2n)$ and $g(2n+1)$.</p>
<p>Based on my coursebook, there is the common standard form, which can be used in order to find the relation:</p>
<p>$g(n) = A(n)\alpha + B(n)\beta + C(n)\gamma$</p>
<p>$A(n),B(n)$ and $C(n)$ are functions, $\alpha, \beta, \gamma$ are constants.
I suppose this form is for the case when there is 3 constants? Thus in this case the form should be
$g(n) = A(n)\alpha$?</p>
<p>How does one use this knowledge in order to solve the relationship?</p>
<p>=====</p>
<p>$f(1)=α;\\
f(2n)=2f(n)+1;\\
f(2n+1)=2f(n)+β.$</p>
<p>This is the case when I do not have a number, but a constant - how does one solve the relationship?</p>
| 0non-cybersec
| Stackexchange | 332 | 810 |
Understanding Lang's Chapter 6 Theorem 9.1. <p>For the past week, I've been trying to dissect and make rigorous my understanding of Lang's theorem, which says that:</p>
<blockquote>
<p>Theorem 9.1 Let <span class="math-container">$k$</span> be a field and n an integer <span class="math-container">$\geq$</span> 2. Let <span class="math-container">$a \in k, a \neq 0.$</span> Assume that for all prime numbers <span class="math-container">$p$</span> such that <span class="math-container">$p \mid n$</span> we have that <span class="math-container">$a \notin k^p,$</span> and if <span class="math-container">$4 \mid n$</span> then <span class="math-container">$a \notin -4k^4.$</span> Then <span class="math-container">$X^n - a$</span> is irreducible in <span class="math-container">$k[x].$</span> </p>
</blockquote>
<p>What follows is a portion of Lang's proof. I cut the argument off where my understanding broke down.</p>
<blockquote>
<p>Our first assumption means that <span class="math-container">$a$</span> is not a <span class="math-container">$p$</span>-th power in <span class="math-container">$k.$</span> We shall reduce our theorem to the case when <span class="math-container">$n$</span> is a prime power, by induction.
Write <span class="math-container">$n = p^rm$</span> with <span class="math-container">$p$</span> prime to <span class="math-container">$m,$</span> and <span class="math-container">$p$</span> odd. Let </p>
<p><span class="math-container">$$x^m - a = \prod^m_{v = 1}(x - \alpha_v)$$</span></p>
<p>be the factorization of <span class="math-container">$x^m - a$</span> into linear factors, and say <span class="math-container">$\alpha
> = \alpha_1$</span>. Substituting <span class="math-container">$x^{p^r}$</span> for <span class="math-container">$x$</span> we get </p>
<p><span class="math-container">$$x^n - a = x^{p^rm} - a = \prod^m_{v = 1}(x^{p^r} - \alpha_v).$$</span></p>
</blockquote>
<p>So far, there is not much to comment on about Lang's set up. His preliminary work is quite straight forward. </p>
<blockquote>
<p>We may assume inductively that <span class="math-container">$x^m - a$</span> is irreducible in <span class="math-container">$k[x].$</span> We
contend that <span class="math-container">$\alpha$</span> is not a <span class="math-container">$p$</span>-th power in <span class="math-container">$k(\alpha).$</span> Otherwise,
<span class="math-container">$\alpha = \beta^p, \beta \in k(\alpha).$</span> Let <span class="math-container">$N$</span> be the norm from
<span class="math-container">$k(\alpha)$</span> to <span class="math-container">$k$</span> then </p>
<p><span class="math-container">$$-a = (-1)^mN(\alpha) = (-1)^mN(\beta^p) = (-1)^mN(\beta)^p.$$</span></p>
</blockquote>
<p>This is where Lang begins to lose me. I understand his field Norm argument, as it follows from substitution and the realization of the field Norm as the product of Galois conjugates. And here <span class="math-container">$-a$</span> coincides with this product, hence this equality follows. But I don't see why Lang begins to invoke induction here. If someone could explain how this helps us, I would be extremely grateful. </p>
| 0non-cybersec
| Stackexchange | 1,057 | 3,219 |
Ping fails: is a webserver configuration issue or not?. <p>When I ping a dedicated ip on my server I get the following:</p>
<pre><code>ping XXX.XXX.95.175
PING XXX.XXX.95.175 (109.72.95.175): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
</code></pre>
<p>If I ping the main ip on my server instead it works:</p>
<pre><code>ping XXX.XXX.95.174
PING XXX.XXX.95.174 (109.72.95.174): 56 data bytes
64 bytes from XXX.XXX.95.174: icmp_seq=0 ttl=57 time=15.813 ms
64 bytes from XXX.XXX.95.174: icmp_seq=1 ttl=57 time=15.183 ms
64 bytes from XXX.XXX.95.174: icmp_seq=2 ttl=57 time=36.285 ms
</code></pre>
<p>So I was now wondering: is it an issue in my webserver configuration file or should I contact my hosting provider ? </p>
<p>They already told me that it is my webserver configuration issue.. but I'm not sure about it.. could you give me some tip please ?</p>
<p><strong>Update</strong></p>
<p>Should I just add this ?</p>
<pre><code>iface eth0:1 inet static
address XXX.XXX.95.175
netmask 255.255.255.0
gateway XXX.XXX.95.174
</code></pre>
| 0non-cybersec
| Stackexchange | 406 | 1,140 |
How to selectively transition from safe mode to normal mode?. <p>This question is very closely related to <a href="https://askubuntu.com/q/16274/13003">What exactly is "Ubuntu Desktop Edition" safe mode?</a> (and I'm having exactly the same problem), as the comment says the answer given may be confusing safe mode from the boot menu and safe mode from GDM.</p>
<p>Assuming we choose the "Ubuntu Desktop Edition (safe mode)" from the login screen, firstly what does this not load in relation to not safe mode? and secondly is there a way of finding out which modules differ between them, and then selectively starting them to find out which one is causing the problem?</p>
<p>Effectively doing the transition from safe mode to normal mode step by step.</p>
<p>Thanks.</p>
| 0non-cybersec
| Stackexchange | 196 | 785 |
14.04 LTS Ubuntu wifi stops working and disconnects after few minutes from rebooting. <p>I installed ( ubuntu 14.4 ) 2 days ago (it's important to mention I'm still a beginner).</p>
<p>On the first day my home WiFi worked fine, but on the second day and until now my WiFi stopped working and if I reboot, it works for about 5 minutes and disconnects again .</p>
<p>Edit 2 : I've run the wireless script AGAIN when the WiFi is NOT working <a href="http://pastebin.ubuntu.com/9597828/" rel="nofollow">here</a> </p>
<p>and when working <a href="http://pastebin.ubuntu.com/9597302/" rel="nofollow">here</a> </p>
<p>When running a <code>tail -f /var/log/{messages,kernel,dmesg,syslog}</code> in one window and open an additional terminal and doing a <code>sudo rmmod rtl8723be&&sleep 5&&sudo modprobe rtl8723be</code> I get the <a href="http://pastebin.ubuntu.com/9554278" rel="nofollow">following output</a></p>
<p>Edit 2 : here's the tail again <a href="http://pastebin.ubuntu.com/9598000/" rel="nofollow">here</a></p>
<p>How should I proceed?</p>
| 0non-cybersec
| Stackexchange | 353 | 1,067 |
All the videos about the Flotilla massacre. . EDIT: add video: [http://vimeo.com/12429821](http://vimeo.com/12429821) (15 min)
EDIT: add video (american citizen killed) [http://www.youtube.com/watch?v=RlElXOJV4CA](http://www.youtube.com/watch?v=RlElXOJV4CA) (22 sec)
onboard: [http://www.youtube.com/watch?v=DSFwyWyVo74&feature=player_embedded](http://www.youtube.com/watch?v=DSFwyWyVo74&feature=player_embedded) 2:50 -
israeli side video: [http://www.youtube.com/watch?v=-7i9WSfnDNc](http://www.youtube.com/watch?v=-7i9WSfnDNc) 2:21 -
aerial: [http://www.youtube.com/watch?v=dLrX7fznVgI](http://www.youtube.com/watch?v=dLrX7fznVgI) 1:50
more: [http://www.livestream.com/insaniyardim/CUT](http://www.livestream.com/insaniyardim/share?utm_source=lsplayer&utm_medium=ui-share&utm_campaign=insaniyardim&utm_content=insaniyardim)
report: [http://www.youtube.com/watch?v=MB-Mk4bFz-U&feature=player_embedded](http://www.youtube.com/watch?v=MB-Mk4bFz-U&feature=player_embedded) 9:36 -
more (israeli side): [http://www.youtube.com/watch?v=XAMFnu8ZBwk&feature=player_embedded#!](http://www.youtube.com/watch?v=XAMFnu8ZBwk&feature=player_embedded#!) 1:38
YOUTUBE: [Gaza flotilla search](http://www.youtube.com/results?search_query=gaza+flotilla&aq=f)
Please post the videos you find and I'll add them here.
| 0non-cybersec
| Reddit | 546 | 1,310 |
How can I get Pandora to play a certain song?. <p>Are there any tricks to get Pandora to play a specific song you want to listen to?</p>
<p>I <a href="https://webapps.stackexchange.com/questions/5445/pandora-song-seed-vs-thumbs-up-whats-the-difference">have noticed</a> that songs that I use as seeds are usually not played on the same radio station. I don't mind that when you start a station it doesn't play the specific song you used as the seed, but I think that it's ridiculous how it <strong>goes out of it's way</strong> to specifically not play that song, ever, on that station.</p>
<p>Besides the obvious benefit of playing a song you like, there are also other reasons it's important for a song to play on a station, such as when you want to thumbs-up a specific song in order to <a href="https://webapps.stackexchange.com/questions/5448/how-can-i-narrow-the-focus-of-a-station-on-pandora">narrow a station's variety</a>.</p>
| 0non-cybersec
| Stackexchange | 279 | 938 |
Distribution of $\bar{X}$ of n Bernoulli's. <p>I am trying to derive the distribution of <span class="math-container">$\bar{X}_n$</span> where <span class="math-container">$X_1, X_2,...,X_n$</span> are iid <span class="math-container">$\sim \mathrm{Bern}(p)$</span>. I used two approaches but I am debating myself and questioning which one would be correct (if any).</p>
<p>Method 1: Using MGF
I used the moment generating function and ended up with <span class="math-container">$\bar{X}_n \sim \mathrm{Bern}(p^n)$</span></p>
<p>Method 2:
I used the CLT and ended up with <span class="math-container">$\bar{X}_n \sim N(p, \sqrt{pq}/n$</span>) for n being large.</p>
<p>I am not sure which one is correct (if any). </p>
<p>Can someone tell me if I am doing this right or not?</p>
<p>Thank you,
I appreciate your help</p>
| 0non-cybersec
| Stackexchange | 286 | 830 |
To the r/fitness people doing starting strength: Post your work set weights, progress and general experience with the program!. 3 workouts into starting strength, here are my work set weights from my most recent lifts.
* Squat: 175x5x3 - planning on 10 lb increases
* Bench 185x5x3 - planning on 5 lb increases
* Deadlift 195x5 - 225 lbs next, after that maybe 15 lb increases
* press 85x5x3 - planning on 2.5 lb increases.
* power cleans (still learning)
I was surprised my press started off so weak, I started at 90 and dropped back to 85 after stalling the first workout. I just seem to have horrible endurance for the press... I just seem to run out of gas easily on this one, esp after squats. Resting more between work sets seems to help.
I've never squatted this frequently in my life, I'm hoping for some steady and consistent gains there.
Deads still feel a little easy, but I don't want to be too aggressive with my weight increases. I'd rather have moderate, sustainable increases than aggressive increases and early stalls.
Power cleans are a difficult movement for me. The racking position isn't as impossible as I thought it would be but I'm still working on the full body coordination to get this one right.
I know my bench is high relative to my other lifts, but my squat and dead numbers should overtake this soon. This is the only lift I consider myself already conditioned on.
| 0non-cybersec
| Reddit | 331 | 1,408 |
Whats the best way to implement and design walls in an isometric tile game?. <p>The game I am thinking about where this solution would be applied, is a game where tiles can be changed, sort of an editor. You are going to need to make graphics for 2 types of walls: west facing and east facing or north/west.</p>
<p>There seems to be 2 approaches to having walls in an isometric tile game:</p>
<ul>
<li>Draw them slightly outside the tile (The Sims 1, Theme Hospital, Jagged Alliance 2, Project Zomboid)</li>
<li>Make them 1x1(tile) large and have them be drawn on their own tile (Ultima 8, every rougelike)</li>
</ul>
<p>Example drawing</p>
<p><img src="https://i.stack.imgur.com/9YBqP.jpg" alt=""></p>
<p>The second method seems to be the easiest way to do it. Since the wall takes up the entire tile, you need not to worry about overlap into the floortile and having to design patterns around that. You do get another problem though if you want to make patterns in a different size than the grid. Like if you want to have rather slim walls. Your grid will then also need to be larger. On the plus side only 1 wall piece is needed.</p>
<p>The first aproach requires some code to detect the variation off wall to draw and might look a little odd unless the floor tiles are designed around it. It also requires at least 4 pieces.</p>
<p>Which method is the prefered way to go about this and why?</p>
| 0non-cybersec
| Stackexchange | 381 | 1,406 |
MEGA Esports vs. Lowkey Esports / 2019 World Championship Play-In - Group C / Post-Match Discussion. ###WORLDS 2019 PLAY-IN
[Official page](https://eu.lolesports.com/en/league/worlds) | [Leaguepedia](https://lol.gamepedia.com/2019_Season_World_Championship/Play-In) | [Liquipedia](https://liquipedia.net/leagueoflegends/World_Championship/2019/Play-In) | [Live Discussion](https://www.reddit.com/r/leagueoflegends/comments/dcnqtb/2019_world_championship_playin_group_stage_day_2/) | [Eventvods.com](https://eventvods.com/featured/lol?utm_source=reddit&utm_medium=subreddit&utm_campaign=post_match_threads) | [New to LoL](http://lol.gamepedia.com/New_To_League/Welcome)
---
###MEGA Esports 0-0 Lowkey Esports
**MG** | [Leaguepedia](https://lol.gamepedia.com/MEGA) | [Website](http://www.megaesports.gg) | [Twitter](https://twitter.com/MEGAEsportsSEA) | [Facebook](https://www.facebook.com/MEGALoLSEA) | [YouTube](https://www.youtube.com/c/megaesports)
**LK** | [Leaguepedia](https://lol.gamepedia.com/Lowkey_Esports.Vietnam)
---
###MATCH 1: MG vs. LK
[**Winner: tbd** in 29m](https://imgur.com/mo1wDpV)
Player of the Game: tbd
||Bans 1|Bans 2|[G](#mt-gold)|[K](#mt-kills)|[T](#mt-towers)|D/B|
|:--|:--:|:--:|:--:|:--:|:--:|:--:|
|**MG**|[gragas](#c-gragas) [morgana](#c-morgana) [qiyana](#c-qiyana)|[xayah](#c-xayah) [reksai](#c-reksai)|75.8k|21|8|[H](#mt-herald)^2 [O](#mt-ocean)^3 [O](#mt-ocean)^4 [C](#mt-cloud)^5 [B](#mt-barons)^6 |
|**LK**|[renekton](#c-renekton) [yuumi](#c-yuumi) [jayce](#c-jayce)|[olaf](#c-olaf) [elise](#c-elise)|73.8k|19|5|[O](#mt-ocean)^1 |
|**MG**|21-19-39|[vs](#mt-kills)|19-21-39|**LK**|
|--:|--:|:--:|:--|:--|
|Rockky [camille](#c-camille) ^3|6-2-7|TOP|2-4-6|^4 [gangplank](#c-gangplank) Hani |
|Lloyd [taliyah](#c-taliyah) ^3|3-4-5|JNG|4-5-11|^1 [akali](#c-akali) DNK|
|G4 [pantheon](#c-pantheon) ^1|5-7-10|MID|6-3-6|^3 [lee sin](#c-leesin) Artifact|
|DeuL [kaisa](#c-kaisa) ^2|6-3-6|BOT|6-5-3|^1 [syndra](#c-syndra) Celebrity|
|PoP [nautilus](#c-nautilus) ^2|1-3-11|SUP|1-4-13|^2 [thresh](#c-thresh) Venus|
---
[This thread was created by the Post-Match Team](https://postmatch.team). | 0non-cybersec
| Reddit | 990 | 2,269 |
Opening up port 8080 in CentOS. <p>I'm new to opening up ports in CentOS. I need to open up tcp port 8080 and have installed/ran nmap to find it is not open already. I've been reading about the iptables command, I have v1.3.5 installed but I really don't know where to start with it regarding opening up this port. </p>
<p>I'd appreciate a code sample or at least a link to a guide to opening this port using iptables (or any other good method.)</p>
<p>Thank you.</p>
| 0non-cybersec
| Stackexchange | 138 | 470 |
Are there any FOSS operating systems available that conform to NASA's JPL coding standards?. <p>I, <a href="https://softwareengineering.stackexchange.com/questions/159637/what-is-the-mars-curiosity-rovers-software-built-in">like many others</a>, have been completely enamored with the recent successful landing of Mar's Curiosity rover. After reading a couple of articles, and following a few links, I've found a couple C based coding standards that NASA JPL uses to formalize their code and protect it from error. (See <a href="http://lars-lab.jpl.nasa.gov/JPL_Coding_Standard_C.pdf" rel="nofollow noreferrer">here</a> and <a href="http://spinroot.com/gerard/pdf/P10.pdf" rel="nofollow noreferrer">here</a>.)</p>
<p>This has me curious. Are there any open-source operating systems available that adhere to these coding standards that are available for common architecture, such as x86, x64 or possibly ARM?</p>
| 0non-cybersec
| Stackexchange | 271 | 919 |
Move data from array of not aligned structs to array of aligned in c++. <p>What is the best way to move data from array of CameraSpacePoint to array of PointXYZ?</p>
<pre><code>struct CameraSpacePoint
{
float X;
float Y;
float Z;
};
__declspec(align(16))
struct PointXYZ
{
float x;
float y;
float z;
};
constexpr int BIG_VAL = 1920 * 1080;
CameraSpacePoint camera_space_points[BIG_VAL];
PointXYZ points_xyz[BIG_VAL];
</code></pre>
<p>My solution:</p>
<pre><code>CameraSpacePoint* camera_space_points_ptr = &camera_space_points[0];
PointXYZ* points_xyz_ptr = &points_xyz[0];
for (int i = 0; i < BIG_VAL; ++i)
{
memcpy(points_xyz_ptr++, camera_space_points_ptr++, sizeof(CameraSpacePoint));
}
</code></pre>
<p>Is this the most efficient way?</p>
| 0non-cybersec
| Stackexchange | 288 | 831 |
Has anyone used any custom decoders with OSSEC?. <p>I have the OSSEC HIDS software version 2.8.3 running on a RHEL 6 server. We have been testing this in the lab with a DNS server to track queries that come into our RPZ and Malware zones. The DNS server has the OSSEC agent installed. In order for this to work we had to use a custom written decoder. Has anyone else had any experience with OSSEC and custom decoders besides those that are installed "out of the box". I am mainly looking to get creative ideas on what other system administrators are doing with OSSEC that could also be useful in our production environment.</p>
<p>For instance, has anyone had success in writing/using a custom decoder to detect USB storage for Linux?</p>
<p>UPDATE: I have been working on a custom decoder and rule for detection of when a USB device is inserted into a server. Here is what the line of the log looks like that I want to match on:</p>
<pre><code>Feb 3 10:23:08 testsys kernel: usb 1-1.2: New USB device found, idVendor=0781, idProduct=5575
</code></pre>
<p>My decoder rules in OSSCE:</p>
<pre><code><decoder name="usb-storage">
<program_name>kernel</program_name>
</decoder>
<decoder name="usb-storage-attached">
<parent>usb-storage</parent>
<regex offset="after_parent">^USB \S+: New</regex>
<order>extra_data</order>
</decoder>
</code></pre>
<p>My rules in OSSEC:</p>
<pre><code><group name="syslog,">
<!-- USB Storage Detection Log Types -->
<!-- level=0 for not generating alerts by default -->
<rule id="310201" level="0">
<decoded_as>usb-storage</decoded_as>
<description>Looking for unknown USB attached storage</description>
</rule>
<!-- USB Storage Detection Event Chains -->
<!-- Fire an alert (level=8) if the log line contains "New USB device found" -->
<rule id="310202" level="8">
<if_sid>310201</if_sid>
<match>^New USB device found</match>
<description>Attached USB Storage</description>
</rule>
</group>
</code></pre>
| 0non-cybersec
| Stackexchange | 708 | 2,138 |
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 |
type annotation for parameter with default value. <p>In the following function definition:</p>
<pre><code> function foo(a: number = 42): number {return a+1;}
</code></pre>
<p>… what are the semantics of the <code>a: number</code> annotation?</p>
<p>Is it saying that variable <i>a</i> will always have a value inside
the body of the function or is it saying that client programmers should always supply a value when they make the call?</p>
<p>I've noticed that both the below code snippets type-check with no errors (with flow-bin 0.57.3):</p>
<p><h2>snippet 1</h2></p>
<pre><code>function foo(a: number = 42): number {return a+1;}
type FooT= (a: number)=> number
(foo: FooT)
foo();
</code></pre>
<p>(try it <a href="https://flow.org/try/#0PQKgBAAgZgNg9gdzCYAoKBXAdgYwC4CWcWYUccAFAIYBcYWGAtgEYCmATmALxgAsATAEo6DFhzABvdqzwZ2JKgGoAjAG4AvqjwBPAA6swAMXIAVHtRFM27QVwB89Kx1SoKZOHWNwTgl+4qCqkA" rel="nofollow noreferrer">here</a>)</p>
<p><h2>snippet 2</h2></p>
<pre><code>function foo(a: ?number = 42): number {return a+1;}
type FooT = (a: ?number)=> number
(foo: FooT)
foo();
</code></pre>
<p>(try it <a href="https://flow.org/try/#0PQKgBAAgZgNg9gdzCYAoKBXAdgYwC4CWcWYUccAFAIYBcYA-FhgLYBGApgE5gC8YALACYAlHSZsuYAN6d2eDJxJUA1AEYA3AF9UeAJ4AHdmABi5ACq8w1OoxYdOwngD4w4+6lQUycOqbhnhD28KYXUgA" rel="nofollow noreferrer">here</a>)</p>
<p>What is the suggested way to annotate in such a case?</p>
<p>My preference is with way #2 as the client programmer only has to look at the definition of the <code>FooT</code> type to realize that the parameter is optional. This allows me to tell users of my
library: "simply look at the type of the function (<code>FooT</code>)".</p>
<p>Whereas with way #1 I have to tell them "the type of the function (<code>FooT</code>) seems to suggest that an argument is required, but in fact it isn't because, see, if you look at the implementation, a default value is supplied".</p>
<p>So, which snippet is more idiomatic?</p>
<p>Note that there is an <a href="https://stackoverflow.com/a/33097444/274677">answer</a> to a related question that seems to suggest that it is possible to annotate the type as mandatory in the implementation of a function and as optional in the declaration. But this doesn't seem to work in this case. E.g. the following doesn't type-check:</p>
<pre><code>function foo(a: number = 42): number {return a+1;}
type FooT = (a: ?number)=> number
(foo: FooT)
foo();
</code></pre>
<p>(try it <a href="https://flow.org/try/#0PQKgBAAgZgNg9gdzCYAoKBXAdgYwC4CWcWYUccAFAIYBcYWGAtgEYCmATmALxgAsATAEo6DFhzABvdqzwZ2JKgGoAjAG4AvqjwBPAA6swAMXIAVbmGp0A-KLbtBXAHz0md1Kgpk4dY3BOD3LwpBVSA" rel="nofollow noreferrer">here</a>)</p>
| 0non-cybersec
| Stackexchange | 1,086 | 2,693 |
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 |
Register performance counter without lodctr. <p>I am looking for an approach to register to XML-based performance counters without using <code>lodctr</code> executable. </p>
<p>While <a href="https://stackoverflow.com/questions/17880592/performance-counters-in-c-without-lodctr">this question</a> and <a href="https://stackoverflow.com/questions/7532767/programmatically-registering-a-performance-counter-in-the-registry">this question</a> has given some insight to the problem, none gives a proper resolution. </p>
<p>The function <strong><a href="https://msdn.microsoft.com/en-us/library/aa372187(v=VS.85).aspx" rel="noreferrer"><code>LoadPerfCounterTextStrings</code></a></strong> seems to do the trick, but doesn't seem to take XML as input (i.e. <code>/M</code> argument for <code>lodctr</code> command). The function would anyway call the <code>lodctr</code> command but will save the programmer from calling <code>lodctr.exe</code> programmatically.</p>
<p>Is there an approach to call this function (or any other) that would behave as if:</p>
<pre><code>lodctr.exe /M:xmlfile.xml
</code></pre>
<p>?</p>
<p>Just an additional information that <code>LoadPerfCounterTextStrings</code> is available in Windows XP, however, the new API (perflib <strong>2</strong>) is available only after Vista. I am using V2.</p>
| 0non-cybersec
| Stackexchange | 403 | 1,324 |
when is the region bounded by a Jordan curve "skinny"?. <p>How can I formalize and prove the following intuition?:</p>
<p>Picture a very skinny rectangle, one with base length 1 and sides length $\epsilon$. Or imagine a very flattened ellipse. The interiors of these objects are "skinny" (or we might say $\epsilon$-skinny) in the sense that each point in the interior is very close (or within $\epsilon$) to a point on the boundary. This notion seems easy to formalize.</p>
<p>Now think of the sides of the rectangle, or the boundary of the ellipse, as the image of a Jordan curve $f : S^1 \rightarrow \mathbb{R}^2$ . It's intuitively "obvious" (though not at all obvious) that what makes the bounded region skinny (in the sense of the above paragraph) is the fact that: For every $\theta \in S^1$ there exists $\theta ' \in S^1$ such that $f (\theta )$ is close to $f (\theta ' )$ but $\theta$ is not very close to $\theta '$. </p>
<p>I have been thinking about the right way to formalize these ideas and I'm a bit stuck. I'd like to formulate them in the $C^0$ setting, that is to say without assuming tangent vectors or any calculus-related things. Do you have any thoughts? Thanks!</p>
<p>Also: This is motivated by the completely well-defined question here:<a href="https://math.stackexchange.com/questions/401975/why-is-an-annulus-close-to-its-boundary-when-its-boundary-curves-are-close">why is an annulus close to it's boundary when it's boundary curves are close?</a> </p>
| 0non-cybersec
| Stackexchange | 432 | 1,515 |
Small perturbation of $f$ doesn't affect the topology of $f^{-1}(0)$. <p>This question arise from the proof of the degree-genus formula which asserts that a non-singular complex algebraic curve <span class="math-container">$C=\{x\in \mathbb{CP}^2| p(x) = 0\}$</span> is a (real) surface of genus <span class="math-container">$\frac 1 2(d-1)(d-2)$</span> where <span class="math-container">$d$</span> is the degree of the homogeneous polynomial <span class="math-container">$p$</span>.</p>
<p>In the proof, it is mentioned that if we perturb the coefficients of <span class="math-container">$p$</span> slightly then the topology of <span class="math-container">$p^{-1}(0)$</span> remains the same.</p>
<p>This suggests the following question:</p>
<blockquote>
<p>Given <span class="math-container">$f:M\to \mathbb{R}$</span> such that <span class="math-container">$M$</span> is a smooth closed n-manifold and <span class="math-container">$0$</span> is a regular value for <span class="math-container">$f$</span>, there is a neighborhood of <span class="math-container">$f$</span> (for example in the weak topology) such that for the generic <span class="math-container">$g:M\to \mathbb{R}$</span> in this neighborhood <span class="math-container">$g^{-1}(0)$</span> is diffeomorphic to <span class="math-container">$f^{-1}(0)$</span> ?
i.e. if we perturb slightly <span class="math-container">$f$</span> can we get a <span class="math-container">$g$</span> such that <span class="math-container">$g^{-1}(0) \simeq f^{-1}(0)$</span></p>
</blockquote>
<p>I know that the set of map transversal to <span class="math-container">$0$</span> is dense and we can also prove that exists <span class="math-container">$g$</span> homotopic to <span class="math-container">$f$</span> so that <span class="math-container">$f^{-1}(0)$</span> and <span class="math-container">$g^{-1}(0)$</span> are cobordant. But this doesn't imply that they are diffeomorphic.</p>
| 0non-cybersec
| Stackexchange | 620 | 1,962 |
unable to run 'pdflatex' on 'myFirstAlignment.tex' in rStudio. <p>Getting this Error Message:</p>
<pre><code>Error in texi2dvi(texfile, quiet = !verbose, pdf = identical(output, "pdf"), :
unable to run 'pdflatex' on 'myFirstAlignment.tex'
In addition: Warning message:
running command '"pdflatex" -interaction=nonstopmode "myFirstAlignment.tex"' had status 1
</code></pre>
<p>When running this series of commands in rStudio:</p>
<pre><code>library(msa)
mySequenceFile <- system.file("examples", "exampleAA.fasta", package="msa")
mySequences <- readAAStringSet(mySequenceFile)
mySequences
myFirstAlignment <- msa(mySequences)
msaPrettyPrint(myFirstAlignment)
</code></pre>
<p>This was after a fresh install of the msa package in rStudio and MikTex.</p>
<p>Any suggestions?</p>
| 0non-cybersec
| Stackexchange | 281 | 812 |
About the absolute value and the place on a number field. <p>Let $K$ be a number field. The place $\nu$ is an equivalence class of non-trivial absolute values. Moreover, the absolute value $| \quad | : K \to \mathbb{R}$ is called non-archimedean if $$|x+ y| \leq \max(|x|, |y|), \forall \ x, y \in K.$$ Then, one has</p>
<p>"there is only one archimedean place $\infty$ on $\mathbb{Q}$ given by the ordinary absolute value $| \quad |$." </p>
<p>I am reading this proposition, but I can't prove its. Can you help me to send a proof for that? Thank you so much.</p>
| 0non-cybersec
| Stackexchange | 180 | 568 |
Animate scrollTop not working in firefox. <p>This function works fine. It scrolls the body to a desired container's offset</p>
<pre><code>function scrolear(destino){
var stop = $(destino).offset().top;
var delay = 1000;
$('body').animate({scrollTop: stop}, delay);
return false;
}
</code></pre>
<p>But not in Firefox. Why?</p>
<p>-EDIT-</p>
<p>To handle de double trigger in the accepted answer, I suggest stoping the element before the animation:</p>
<pre><code>$('body,html').stop(true,true).animate({scrollTop: stop}, delay);
</code></pre>
| 0non-cybersec
| Stackexchange | 182 | 564 |
Enforce custom ordering on Sympy print. <p><code>SymPy</code> does a wonderful work keeping track of all the operations I do to my symbolic expressions. But a the moment of printing the result for latex output I would like to enforce a certain ordering of the term. This is just for convention, and unfortunately that convention is not alphabetical on the symbol name(as reasonably <code>sympy</code> does)</p>
<pre><code>import sympy as sp
sp.init_printing()
U,tp, z, d = sp.symbols('U t_\perp z d')
# do many operations with those symbols
# the final expression is:
z+tp**2+U+U/(z-3*tp)+d
</code></pre>
<p>My problem is that <code>SymPy</code> presents the expression ordered as </p>
<pre><code>U + U/(-3*t_\perp + z) + d + t_\perp**2 + z
</code></pre>
<p>But this ordering is not the convention in my field. For us <code>z</code> has to be the leftmost expression, then <code>tp</code>, then <code>U</code> even if it is capitalized, <code>d</code> is the most irrelevant and is put at the right. All this variables hold a particular meaning and that is the reason we write them in such order, and the reason in the code variables are named in such way.</p>
<p>I don't want to rename <code>z</code> to <code>a</code> and as suggested in <a href="https://stackoverflow.com/questions/14624511/prevent-sympy-from-rearranging-the-equation">Prevent Sympy from rearranging the equation</a> and then at the moment of printing transform that <code>a</code> into <code>z</code>. In <a href="https://stackoverflow.com/questions/36314035/python-sympy-force-sympy-to-keep-order?noredirect=1&lq=1">Force SymPy to keep the order of terms</a> there is a hint I can write a sorting function but I could not find documentation about it. </p>
| 0non-cybersec
| Stackexchange | 523 | 1,738 |
How to install picasa on ubuntu using winetricks?. <p>I have installed wintricks & also followed the guidelines of this question's => <strong><a href="https://askubuntu.com/questions/86452/how-would-i-install-picasa-3-9">Answer</a></strong>.
But I'm getting this problem => (Check the print screen I have shared below)</p>
<p><a href="https://i.stack.imgur.com/6gO5X.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6gO5X.png" alt="picasa_ubuntu printscreen"></a></p>
| 0non-cybersec
| Stackexchange | 166 | 492 |
How can I install Cinnamon on Ubuntu 12.04 and eliminate the following errors:. <pre><code>$ sudo apt-get install cinnamon cinnamon-session cinnamon-settings
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'cinnamon' instead of 'cinnamon-session'
Note, selecting 'cinnamon' instead of 'cinnamon-settings'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help resolve the situation:
The following packages have unmet dependencies:
cinnamon : Depends: gir1.2-muffin-3.0 but it is not going to be installed
Depends: libcogl5 (>= 1.7.4) but it is not installable
Depends: libmuffin0 (>= 1.0.0-0ubuntu1~precise) but it is not going to be installed
Recommends: gnome-themes-standard but it is not going to be installed
Recommends: gnome-session-fallback but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
</code></pre>
<p>I added this PPA: </p>
<p><code>sudo add-apt-repository ppa:merlwiz79/cinnamon-ppa</code></p>
<p>Then ran the following command: </p>
<p><code>sudo apt-get update && sudo apt-get install cinnamon cinnamon-session cinnamon-settings</code></p>
<p>How can I install the latest Cinnamon desktop? How can I fix this error?</p>
| 0non-cybersec
| Stackexchange | 415 | 1,530 |
Can it be argued that this question only has 1 answer ultimately?. <p>I came across this quiz question in a forum today. I would like to ask for your opinion of this notorious mathematics question, and also, to share. </p>
<p><img src="https://i.stack.imgur.com/axkWO.png" alt="PSLE 2005 Question"></p>
<p>This question came out in Singapore's PSLE examination 2005. Basically, PSLE is one of the most important exams of one's life in Singapore. It literally determines your future, to a huge degree. How did such a question slip past the examiners, we would never know. </p>
<blockquote>
<blockquote>
<p>As for my real question, is that, is there a valid answer to this question ultimately? I mean, there can be more then one answer, but can it be argued in such a way, that one answer can ultimately be proven to be true? </p>
</blockquote>
</blockquote>
| 0non-cybersec
| Stackexchange | 233 | 868 |
embedding jquery.prettyPhoto causes script to show on page. <p>When I move:</p>
<pre><code><script src="js/jquery.prettyPhoto.js"></script>
</code></pre>
<p>To:</p>
<pre><code><script type="text/javascript">
...
</script>
</code></pre>
<p>Then the script starts showing on the page from the <strong>bold</strong> part onwards:</p>
<p>style="border:none; overflow:hidden; width:500px; height:23px;" allowTransparency="true"><strong>'},s);var o=this,u=false,a,f,l,c,h,p,d=e(window).height(),v=e...</strong></p>
<p>The script is attributed with this information:</p>
<pre><code>Class: prettyPhoto
Use: Lightbox clone for jQuery
Author: Stephane Caron (http://www.no-margin-for-errors.com)
Version: 3.1.5
</code></pre>
<p>How can I move the script from a <code>.js</code> file to the page <a href="https://jsfiddle.net/rL9h958e/">correctly</a>?</p>
| 0non-cybersec
| Stackexchange | 328 | 880 |
Memory size of a Java 32-bit system int[] array. <p>In Java, memory used for occupying the <code>int[]</code> array of size <code>n</code> equals to <code>(4 + n) * 4</code> bytes.</p>
<p>Practically can be proven by the code below:</p>
<pre><code>public class test {
public static void main(String[] args) {
long size = memoryUsed();
int[] array = new int[2000];
size = memoryUsed() - size;
if (size == 0)
throw new AssertionError("You need to run this with -XX:-UseTLAB for accurate accounting");
System.out.printf("int[2000] used %,d bytes%n", size);
}
public static long memoryUsed() {
return Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
}
}
</code></pre>
<p>so interesting is number <code>4</code> in parentheses. First portion of <code>4</code> bytes takes array reference, second - array length, then what takes 8 bytes left?</p>
| 0non-cybersec
| Stackexchange | 280 | 948 |
How to keep CRUD user stories from being trite and simplistic?. <p>I'm having trouble keeping my user stories for basic operations from sounding ... basic. For example, suppose I'm building a CRM to keep track of clients:</p>
<ul>
<li>C: As a user, I want to create a client, so I can ... keep track of my clients?</li>
<li>R: As a user, I want to view my clients and their properties, so I can ... know what's going on?</li>
<li>U: As a user, I want to change my clients' information, so I can ... not use outdated information?</li>
<li>D: As a user, I want to delete a client, so I can ... not have old clients lying around?</li>
</ul>
<p>It seems like there are lots of reasons to want to perform CRUD operations on your objects, the primary reason being a kind of obvious "just because" reason. I suppose I could just pick one reason. For example:</p>
<ul>
<li>As a user, I want view my clients and their properties, so I can sound knowledgeable when they call.</li>
</ul>
<p>But there are many, many more reasons why I want to view my clients. It would be tedious to enumerate out every reason why I would want to look up a client, and even if I tried, I probably still wouldn't be able to think of every reason.</p>
<p>How do you write user stories for basic operations?</p>
| 0non-cybersec
| Stackexchange | 356 | 1,286 |
Finding circle of a sphere through two points. <p>We have two points $P_1, P_2$ on a sphere $S$ of radius $R$. Suppose for $r \ll R$, the distance between $P_1$ and $P_2$ is less than $2r$. </p>
<p>Then, $P_1$ and $P_2$ both lie on exactly two radius-$r$ circles of the sphere. This is clear: of the set of planes that contain $P_1$ and $P_2$, there are two of those planes that intersect $S$ to form a circle with radius $r$. </p>
<p>Given $P_1$, $P_2$, $R$ and $r$, how can I calculate the centers of these two circles?</p>
<p>I would prefer to do as little messy spherical geometry as possible :).</p>
| 0non-cybersec
| Stackexchange | 208 | 609 |
Tricky differentials problem involving continuous functions. <p>Suppose $f$ is a continuous function on $[0, \infty )$, differentials on $(0, \infty)$, such that $f(0)=1$ and $f'(x)> \frac{1}{2\surd (x+1)} \forall x>0$. Show that $f(x)> \surd (x+1)$. </p>
<p>Rolle's theorem and the mean value theorem are my only leads . </p>
<p>Can an expert provide Hints, tips, suggestions, to a solution? </p>
| 0non-cybersec
| Stackexchange | 145 | 409 |
Does an ideal in $k[x_1, \dots, x_n]$, $k$ a field, contain only finitely many irreducible elements?. <p>Let $k$ be a field and consider a nonunital ideal $I$ in $k[x_1, \dots, x_n]$. Since $k$ is Noetherian, we may write $I = (f_1, \dots, f_k)$ where each $f_i$ is nonconstant irreducible. </p>
<p>Is it true that $I$ can contain only finitely many irreducible elements? If so, is there an elementary proof (not using too much commutative algebra)? What if $I$ is assumed to be a maximal ideal? </p>
<p>I don't know how to answer when a prime polynomial can be a linear combination of other primes.</p>
| 0non-cybersec
| Stackexchange | 195 | 611 |
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 |
Recommended contract & document creation/management suite which support digital signatures?. Anyone have any ideas of products which can make contract creation easy (maybe even automated)?
I have a client whom is looking for something - they have ~5-10 different contracts each quarter, all are word documents. The legal may change every few weeks. The list of product/services on it might change too.
We're hoping for something that can be pre-populated from sales and can be digitally signed by the customer (Docusign or echosign). These two digital signature vendors don't really support tracking documents and/or managing revisions in any easy fashion...
Something template-able, is on-premises, and is not a billion dollars would be awesome. We'd rather not custom design something...
Ideas? | 0non-cybersec
| Reddit | 171 | 800 |
When did you realise teenage girls were as horny as you were.. Here's my story: my first girlfriend was at 17 back in 1971. We went out for a few weeks which involved little more than kissing. One nightas we were kissing on the couch she took my hand and placed it on her boobs. Like a rabbit in the headlights I froze and pulled my hand away. a few weeks after this she gave me the elbow for another boy. A couple of months later i went out with another girl (a right hottie, a double for Olivier Newton John), she too placed my hand on her chest and once again i recoiled in shock only to finnish with a week later. It was only when i met my now wife who took me in hand, literally, that i realised girls in their late teens are as horny as boys of that age and the reason the first two girls dumped me was that i didn't give them what they wanted, which was a good shagging. Mind you, i more than made up for those lost chances with the girl that i later married | 0non-cybersec
| Reddit | 229 | 967 |
Why are projective morphisms closed?. <p>It is a well-known fact that if $X$ is a projective curve and $p \in X$ a smooth point, then any rational map $X \to Y$, $Y$ a projective variety, extends to a rational map $X \to Y$ regular at $p$. This is proposition I.6.8 in Hartshorne (in the case of $X$ an abstract non-singular curve), for example. However, the two proofs I have seen both assume that it suffices to consider the case $Y = \mathbb{P}^n$. As I understand it, this is because morphisms of projective varieties are proper, and in particular the image is closed. Where I can find a proof of this, in the case of varieties only? I found a proof <a href="http://amathew.wordpress.com/2010/10/23/a-projective-morphism-is-proper/" rel="noreferrer">here</a> by Akhil Mathew, but I got lost when he started talking about base change.</p>
| 0non-cybersec
| Stackexchange | 235 | 842 |
Union of the graphs of derivatives of a function.. <p>For a function $ f: \mathbb{R} \to \mathbb{R} $, write Graph($f$) $:= \{(x,f(x)):x\in \mathbb{R}\} $. </p>
<p>For $ f \in C^{\infty}(\mathbb{R}) $, define $ A(f) := \bigcup\limits_{n=0}^{\infty} \textrm{Graph}(f^{(n)}) $. </p>
<p>It is clear that $ g = f^{(n)} $ implies $ A(g) \subset A(f) $. The question is, is the converse also true? That is, does $ A(g) \subset A(f) $ imply $ g = f^{(n)} $ for some $ n \geq 0 $?</p>
| 0non-cybersec
| Stackexchange | 190 | 479 |
Numpy split array based on condition without for loop. <p>So lets say i have a numpy array that holds points in 2d space, like the following</p>
<pre><code>np.array([[3, 2], [4, 4], [5, 4], [4, 2], [4, 6], [9, 5]])
</code></pre>
<p>I also have a numpy array that labels each point to a number, this array is a 1d array with the length as the number of points in the point array.</p>
<pre><code>np.array([0, 1, 1, 0, 2, 1])
</code></pre>
<p>Now i want to take the mean value of each point that have an index from the labels array. So for all points that have label 0, take the mean value of those points.
My current way of solving this is the following way</p>
<pre><code>return np.array([points[labels==k].mean(axis=0) for k in range(k)])
</code></pre>
<p>where k is the largest number in the labels array, or as it's called the number of ways to label the points. </p>
<p>I would like a way to do this without using a for loop, maybe some numpy functionality i haven't discovered yet?</p>
| 0non-cybersec
| Stackexchange | 318 | 999 |
Subsets and Splits