text
stringlengths 36
35k
| label
class label 2
classes | source
stringclasses 3
values | tokens_length
int64 128
4.1k
| text_length
int64 36
35k
|
---|---|---|---|---|
There is no tracking information for the current branch. <p>I've been using github from a relatively short period, and I've always used the client to perform commits and pulls. I decided to try it from the git bash yesterday, and I successfully created a new repo and committed files.</p>
<p>Today I did changes to the repository from another computer, I've committed the changes and now I'm back home and performed a <code>git pull</code> to update my local version and I get this:</p>
<pre><code>There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream develop origin/<branch>
</code></pre>
<p>the only contributor to this repo is me and there are no branches (just a master). I'm on windows and I've performed the pull from git bash:</p>
<p><a href="https://i.stack.imgur.com/AeyH8.png" rel="noreferrer"><img src="https://i.stack.imgur.com/AeyH8.png" alt="enter image description here"></a></p>
<p>git status:</p>
<pre><code>$ git status
# On branch master
nothing to commit, working directory clean
</code></pre>
<p>git branch:</p>
<pre><code>$ git branch
* master
</code></pre>
<p>What am I doing wrong?</p>
| 0non-cybersec
| Stackexchange | 396 | 1,368 |
Compare graphs by using different slopes. <p>I have two equations</p>
<p>First one is $\beta q_1 x_1 + q_2 x_2 =I-\gamma$</p>
<p>Second one is $q_1x_1+q_2 x_2=I$</p>
<p>where $\beta q_1\lt q_1$ and $I-\gamma\lt I$ and all are positive. </p>
<p>The slope of the first model is =-$q_2\over\beta q_1$</p>
<p>And the slope of the second model is =-$q_2\over q_1$</p>
<p>I think the first slope is greater than the second slope. Right? I am not sure. Please check the comparison again.</p>
<p>Then, how are their graphs? I posted below. First figure or second figure represents the equations ? </p>
<p>Which graph is true?</p>
<p>The second one seems more correct to me. Am I right?</p>
<p><a href="https://i.stack.imgur.com/KG7r7.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KG7r7.jpg" alt="enter image description here"></a></p>
| 0non-cybersec
| Stackexchange | 328 | 858 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
Equivalent formulation of $\sum_{A \subseteq X} \sum_{x\neq y, x,y \in A} f(x)f(y)$?. <p>For any finite set $X$, for all $f: X \longrightarrow \mathbb R$,
$$ \sum_{A \subseteq X} \sum_{x \neq y x,y \in A} f(x)\cdot f(y) = \sum_{A \subseteq X} \sum_{x \in A, y \not \in A} f(x) \cdot f(y).$$</p>
<p>I can show this equality by taking a bit of a detour, as follows. </p>
<p>Let $N = |X|$. Fix an enumeration $\{A_i\}$ of all subsets of $X$ so that for each $i,j$, $|i - j| = 2^{N-1}$ iff $A_j = X \setminus A_i$. For each $i \leq 2^{N}$, let $i^*$ be the unique $j$ such that $|i - j| = 2^{N-1}$. For each $i \leq 2^N$ and each $y \in A_i$, let $i_y$ be the unique $j$ such that $A_j = A_i \setminus \{y\}$.</p>
<p>Now, we can think of each term in the sum on the left hand side as an element of $${\cal A}:= \bigcup_i \{ ((x,i),(y,i)) : x \neq y, x,y \in A_i \}.$$
And we can think of each term in the sum on the right hand side as an element of $${\cal B}:= \bigcup_{i} \{ ((x,i),(y,i^*)) : x \in A_i, y \in A_{i^*} \}.$$</p>
<p>Note now that the following function is a bijection from $\cal A$ to $ \cal B$: $$\phi(((x,i),(y,i))) = ((x,i_y),(y,i_y^*)).$$</p>
<p>And this, I take it, establishes the desired result. But I'm hoping for a more straightforward proof. </p>
| 0non-cybersec
| Stackexchange | 509 | 1,276 |
Problem on finding approximation in C[0,1]. <p>Let $X=C[0,1]$ with the inner product $\langle x,y\rangle=\int_0^1 x(t)\overline y(t)\,dt$ $\forall$ $x(t),y(t)\in C[0,1]$ </p>
<p>$X_0 =\{x(t) \in X :\int_0^1 t^2x(t)\,dt=0\}$and $X_0^\bot$ be the orthogonal complement of $X_0$.</p>
<p>let $y(t)=t^3$, $t\in [0,1]$ and $x_0\in X_0^\bot$ be the approximate of $y$. Then $x_0(t)$,t$\in$[0,1] is </p>
<p>(1)$\frac{4t^2}{5}$</p>
<p>(2)$\frac{5t^2}{6}$</p>
<p>(3)$\frac{6t^2}{7}$</p>
<p>(4)$\frac{7t^2}{8}$</p>
<p>answer i am obtaining is (5/6)$t^2$ but given ans is (4/5)$t^2$</p>
<p>i have done it as:</p>
<p>$X_0 =[span(t^2)]^\bot$ </p>
<p>$X_0^\bot =[span(t^2)]^{\bot\bot}$ = span($t^2$)</p>
<p>now using othogonality,</p>
<p><$t^3-at^2,t^2$>=0 which gives a=5/6</p>
<p>& therefore,$x_0(t)$=(5/6)$t^2$</p>
<p>is this correct or am i wrong somewhere</p>
<p>thanks in advance...</p>
| 0non-cybersec
| Stackexchange | 482 | 904 |
Why does adding two decimals in Javascript produce a wrong result?. <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/588004/is-javascripts-math-broken">Is JavaScript’s Math broken?</a> </p>
</blockquote>
<p>Why does JS screw up this simple math?</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-js lang-js prettyprint-override"><code>console.log(.1 + .2) // 0.3000000000000004
console.log(.3 + .6) // 0.8999999999999999</code></pre>
</div>
</div>
</p>
<p>The first example is greater than the correct result, while the second is less. ???!! How do you fix this? Do you have to always convert decimals into integers before performing operations? Do I only have to worry about adding (* and / don't appear to have the same problem in my tests)?</p>
<p>I've looked in a lot of places for answers. Some tutorials (like shopping cart forms) pretend the problem doesn't exist and just add values together. Gurus provide complex routines for various math functions or mention JS "does a poor job" in passing, but I have yet to see an explanation.</p>
| 0non-cybersec
| Stackexchange | 363 | 1,226 |
Keep Mocha tests alongside source files. <p>I currently have my NodeJS source files in <code>src</code> and test suites in <code>test</code>, e.g.:</p>
<pre><code>/src/bar/baz/foo.js
/test/bar/baz/foo.spec.js
</code></pre>
<p>This leads to awkward require statements like <code>var foo = require('../../../src/bar/baz/foo')</code>. And it's hard to see at a glance which source files are missing tests. I would like to instead keep my test suites in the same directory as the relevant source files:</p>
<pre><code>/src/bar/baz/foo.js
/src/bar/baz/foo.spec.js
</code></pre>
<p>But now running <code>mocha --recursive src</code> causes errors as Mocha tries to run my source files as tests.</p>
<p>I've seen suggestions of using <code>find</code> or <code>gulp</code> to filter the file list but I find it surprising that this can't be done with plain Mocha. What's the recommended way of organising files this way?</p>
| 0non-cybersec
| Stackexchange | 287 | 923 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
How to force STARTTLS in Exim?. <p>I am learning to set up a mailserver. I got it working with postfix, now trying the same configuration with Exim. How can I force a client to take up only STARTTLS connection for SMTP outgoing connection? I followed the instructions in this question.</p>
<p><a href="https://serverfault.com/questions/476097/require-starttls-for-sending-email-in-exim">Require STARTTLS for sending email in exim</a></p>
<p>My config looks now as following </p>
<pre><code>MAIN_TLS_ENABLE = yes
MAIN_TLS_CERTIFICATE = /etc/ssl/certs/ssl-cert-snakeoil.pem
MAIN_TLS_PRIVATEKEY = /etc/ssl/private/ssl-cert-snakeoil.key
.ifdef MAIN_TLS_ENABLE
# Defines what hosts to 'advertise' STARTTLS functionality to. The
# default, *, will advertise to all hosts that connect with EHLO.
.ifndef MAIN_TLS_ADVERTISE_HOSTS
MAIN_TLS_ADVERTISE_HOSTS = *
.endif
tls_advertise_hosts = MAIN_TLS_ADVERTISE_HOSTS
auth_advertise_hosts = ${if eq{$tls_in_cipher}{}{}{*}}
</code></pre>
<p>Restarted Exim, no errors.
Then I ran some tests in <a href="http://checktls.com/" rel="nofollow noreferrer">http://checktls.com/</a></p>
<p>The TestSender passed, I could send email under secure communication. But TestSenderAssureTLS failed, the website could negotiate an unencrypted communication. </p>
<p>What am I missing?</p>
<p>When I create an account with Thunderbird, it autodetects an unsecure SMTP channel, not one with STARTTLS. Setting up the account and sending email succeeds. However, when I make an SMTP conversation from the shell of a computer in the network, no authentication is advertised. It looks as follows:</p>
<pre><code>EHLO <subdomain>.<domain>
250-betelgeuse Hello <subdomain>.<domain> [10.0.14.34]
250-SIZE 52428800
250-8BITMIME
250-PIPELINING
250-STARTTLS
250 HELP
AUTH LOGIN
503 AUTH command used when not advertised
</code></pre>
<p>Could somebody point me to what I am missing, how I can make better tests?
On a related topic, how I can advertise the configuration I wish to the clients doing autdetect?
Thank you.</p>
| 0non-cybersec
| Stackexchange | 672 | 2,067 |
Is this worth 450 euro?. O/S : Windows 7 Professional 64-bit SP1
CPU : AMD Phenom II X4 B93
RAM : 8.00GB DDR3
Motherboard : MICRO-STAR LTD 770-C45
Graphics : NVIDIA GeForce GTX 460 1GB DDR5 (MSI)
Storage : Seagate 1TB (SATA)
Optical Drives : ATAPI iHAS124 DVD+/-RW DL SATA
Audio :Realtek High Definition Audio
PSU : Alpine 750W Blue
Fan Controller | 0non-cybersec
| Reddit | 132 | 356 |
How to get apps using significant energy programatically like battery icon from MacBook. <p>I am trying to get a significant energy consuming app list like it shows in battery icon in MacBook programmatically.</p>
<p><img src="https://i.stack.imgur.com/bapoI.png" alt="enter image description here"></p>
<p>Like Below...
Any Help would be appreciated.</p>
<p>I tried used following top command in a code but it's not working.</p>
<p>top -stats -l 1 -O pid,command,cpu,idlew,power -o power -d</p>
| 0non-cybersec
| Stackexchange | 151 | 501 |
Layers - Logical seperation vs physical. <p>Some programmers recommend logical seperation of layers over physical. For example, given a DL, this means we create a DL namespace not a DL assembly. </p>
<p>Benefits include:</p>
<ol>
<li>faster compilation time</li>
<li>simpler deployment</li>
<li>Faster startup time for your program</li>
<li>Less assemblies to reference</li>
</ol>
<p>Im on a small team of 5 devs. We have over 50 assemblies to maintain. IMO this ratio is far from ideal. I prefer an extreme programming approach. Where if 100 assemblies are easier to maintain than 10,000...then 1 assembly must be easier than 100. Given technical limits, we should strive for < 5 assemblies. New assemblies are created out of technical need not layer requirements.</p>
<p>Developers are worried for a few reasons. </p>
<p>A. People like to work in their own environment so they dont step on eachothers toes. </p>
<p>B. Microsoft tends to create new assemblies. E.G. Asp.net has its own DLL, so does winforms. Etc. </p>
<p>C. Devs view this drive for a common assembly as a threat. Some team members Have a tendency to change the common layer without regard for how it will impact dependencies.</p>
<p>My personal view:</p>
<p>I view <strong>A.</strong> as silos, aka cowboy programming and suggest we implement branching to create isolation. <strong>C.</strong> First, that is a human problem and we shouldnt create technical work arounds for human behavior. Second, my goal is not to put everything in common. Rather, I want partitions to be made in namespaces not assemblies. Having a shared assembly doesnt make everything common. </p>
<p>I want the community to chime in and tell me if Ive gone off my rocker. Is a drive for a single assembly or my viewpoint illogical or otherwise a bad idea? </p>
| 0non-cybersec
| Stackexchange | 502 | 1,838 |
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 |
Function keys since upgrading to Yosemite. <p><kbd>Option</kbd> + <kbd>F1</kbd> takes me to Display preferences, instead of using the current app binding, as it did in Mavericks. Is there any way to override this behavior?</p>
<p>I can't find the binding in Preferences -> Keyboard -> Shortcuts.</p>
<p>I see the binding on the Apple <a href="http://support.apple.com/kb/ht1343" rel="nofollow">shortcut page</a>, and I think it's always been there, but previously applications could overrule the setting.</p>
<p>If it's relevant, the app in question is <a href="https://www.jetbrains.com/idea/" rel="nofollow">IntelliJ Idea</a>.</p>
| 0non-cybersec
| Stackexchange | 201 | 636 |
listplot and postscript. <p>Is there a possibility with listplot to make lines from a point which is defined?</p>
<p>Example...</p>
<p>Fileinput:</p>
<pre><code>-0.013,0.471
0.044,-0.294
-0.069,0.446
0.025,-0.385
0.038,-0.448
0.073,-0.365
0.375,0.045
....
</code></pre>
<p>I want to find code wich does the following....</p>
<pre><code>\psline(1,1)(-0.013,0.471)
\psline(1,1)(0.044,-0.294)
......
</code></pre>
<p>Is there a way to do this easyly?</p>
<p>Update Code:</p>
<pre><code>\documentclass{scrreprt}
\usepackage{scrpage2}
\usepackage[ansinew]{inputenc}
%\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[full]{textcomp} % Euro-Zeichen etc...
\usepackage{datatool}
\usepackage{graphicx}
\usepackage{rotating}
\usepackage{array}
\usepackage{ragged2e}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\usepackage{pstricks}
\usepackage{pst-plot} %27.07.2012 testweise
\usepackage{etoolbox}
\makeatletter
\def\ifinstr#1#2{%
\def\@ifinstr##1#2##2\@nil{%
\ifstrempty{##2}{\@secondoftwo}{\@firstoftwo}}%
\@ifinstr#1\@@nil#2\@nil
}
\def\popleft#1#2{%
\edef\@tmpa{#1}%
\expandafter\@popleft\expandafter{\@tmpa}{#1}{#2}}
\def\@popleft#1#2#3{%
\ifinstr{#1}{|}
{\@@popleft{#2}{#3}\q@nil#1\q@stop}
{\@@popleft{#2}{#3}\q@nil#1|\q@stop}}
\def\@@popleft#1#2\q@nil#3|#4\q@stop{\edef#1{#4}\edef#2{#3}}
\newcommand*\assignvalues[2]{\@assignvalues{#1}{#2}}
\def\@assignvalues#1#2{%
\edef\@tmpb{#1}\edef\@tmpc{#2}%
\popleft\@tmpb\currentvalueA
\popleft\@tmpc\currentvalueB
\csedef{\currentvalueA}{\currentvalueB}%
\ifdefempty\@tmpb{}{\assignvalues\@tmpb\@tmpc}%
}
\makeatother
\FPset\tsize{0.75} % Schriftgröße
\FPset\schriftgr{0.75}
\FPset\schriftgrad{0.4} % Anderson Darling Schriftgröße
\FPset\digitz{5}
\begin{document}
\assignvalues{xstart|xend|ystart|yend|yistart|nhlines|nvlines|nvunit|hilfsgitternetzlinien|alternativskalierung|inputf|altscale|rgg}{0|9|-0.8|4.6|0|14|10|2|5|0.35|Messdaten/statistik/rohstoffextruder.dat|1|0}
\assignvalues{dart}{loading}
\assignvalues{mbstartx|mbstepx|mbstarty|mbstepy}{1|1|1|1}
\assignvalues{bottomdesc|leftdesc|topdesc|rightdesc|lab|bcaption}{Unten|Links|Oben|Rechts|label|Bezeichnung}
\assignvalues{nvlines|nhlines|lab|mbstartx|mbstepx|hilfsgitterlinien|mbstarty|mbstepy|bcaption|bottomdesc|leftdesc}{5|4|fig:LoadingPlot|-0.1|0.1|15|-0.50|0.25|Loading Plot Rohstoff Extruder|Erste Komponente|Zweite Komponente}
\assignvalues{scalex|scaley|scaler}{1|1|1}
\assignvalues{dummyj|dummyba|dummyh|xendn|dummyq|altscale|miny|dummyu|dummybb|dummyr|dummyl|dummym|dummyb|minstarty|dummyu|dummyt|schriftgrad|gesamthl|messb|dummyd|nhlinesn|minstart|dummyr|dummybb|distmove}
{-0.600000000000000000|-0.069|-0.1|9|0.5|1|-0.448|-0.50|4.6|1.15000|1.80000|0.12000|1.8|0.25|-0.50|0|0.4|75|1|6|5|0.1|1.15000|4.6|1.000000000000000000}
\readdata{\dataA}{Messdaten/statistik/rohstoffextruder.dat}
\ifthenelse{\equal{\messb}{1}}{\message{^^JLade Datenquelle(n) für Diagramm \bcaption\space^^J}}{}
\DTLsetseparator{,}
\DTLifdbexists{table4441}{\DTLdeletedb{table4441}}{ }
\DTLloaddb[noheader,keys={wertx,werty}]{table4441}{\inputf}
\readdata{\dataA}{\inputf}
\ifthenelse{\equal{\messb}{1}}{\message{^^JEinige FP rechnungen, die durch Assignvalues ersetz worden sind..... \bcaption\space^^J}}{}
\begin{figure}[htbp]
%\begin{center}
\centering
\psset{xunit=\scalex cm,yunit=\scaley cm, runit=\scaler cm}
\pstScalePoints(1,1){\dummyba\space \dummyh\space neg \dummyba\space sub add add \xendn\space mul \dummyq\space\altscale\space mul \space div}{\miny\space neg \dummyu\space neg \miny\space neg sub add add \dummybb\space mul}
%
\ifthenelse{\equal{\messb}{1}}{\message{^^JZeichne Bildbereich}}{}
%
\begin{pspicture}(\xstart,\ystart)(\xend,\yend)
%
\ifthenelse{\equal{\messb}{1}}{\message{Zeichne die Gitternetzlinien für Diagramm \bcaption\space ^^J}}{}
%
\multiput(\xstart,\dummyr)(\xstart,\dummyr){\nhlines}{\psline[linecolor=black,linestyle=dashed,linewidth=0.4pt](\xstart,\yistart)(\xend,\yistart)}
\multiput(\xstart,\dummyr)(\xstart,\dummyr){\nhlines}{\psline[linecolor=black,linewidth=0.8pt](-0.1,0)(0,0.0)}
%
\multiput(\dummyl,\yistart)(\dummyl,\yistart){\nvlines}{\psline[linecolor=black,linestyle=dashed,linewidth=0.4pt](\xstart,\yistart)(\xstart,\yend)}
\multiput(\dummym,\yistart)(\dummym,\yistart){\gesamthl}{\psline[linecolor=black,linestyle=dotted,linewidth=0.4pt](\xstart,\yistart)(\xstart,\yend)}
\multiput(\dummyl,\yistart)(\dummyl,\yistart){\nvlines}{\psline[linecolor=black,linewidth=0.8pt](0,-0.1)(0,0.0)}
%
\ifthenelse{\equal{\messb}{1}}{\message{Die Gitternetzlinien für Diagramm \bcaption\space wurden fertiggestellt^^J}}{}
\ifthenelse{\equal{\messb}{1}}{\message{Beginne die Beschriftung für Diagramm \bcaption\space ^^J}}{}
%
\multido{\na=\dummyh+\minstart,\nb=0+\dummyb}{\dummyd}{\rput{0}(\nb,-0.3){\FPclip\na\na \scalebox{\schriftgrad}{\na}}}
\multido{\na=\dummyt+\dummyr,\nb=\dummyu+\minstarty}{\nhlinesn}{\rput{0}(-0.5,\na){\FPclip\nb\nb
\scalebox{\schriftgrad}{\nb}}}
\uput[0](\dummyj,-0.7){%
\scalebox{\scalex}{
\begin{tabular}{C{\xend cm}}
\scalebox{\tsize}{\bottomdesc} \\
\end{tabular}
}}
%
\uput[90](-1.3,-0.7){\rotateleft {%
\scalebox{\scaley}{
\begin{tabular}{C{\yend cm}}
\scalebox{\tsize}{\leftdesc} \\
\end{tabular}
}}} % Achsenbeschriftung y
\ifthenelse{\equal{\messb}{1}}{\message{Die Beschriftung für Diagramm \bcaption\space wurde fertig gestellt^^J}}{}
\ifthenelse{\equal{\messb}{1}}{\message{^^JZeichne die Daten von \bcaption\space ^^J}}{}
% Alter Code....
%\ifthenelse{\equal{\dart}{loading}}{
% \DTLforeach{table4441}{%
% \wertx=wertx,\werty=werty}{
% \FPupn{X}{\wertx}
% \FPupn{X}{X \dummyba\space \dummyh\space neg \dummyba\space sub add add \xendn\space mul \dummyq\space\altscale\space mul \space div}
% \FPround\X\X\digitz
% \FPupn{Y}{\werty}
% \FPupn{Y}{Y \miny\space neg \dummyu\space neg \miny\space neg sub add add \dummybb\space mul}
% \FPupn{Xs}{\minstart\space \distmove\space mul \xendn\space mul \dummyq\space\altscale\space mul \space div}
% \FPupn{Ys}{\dummyu\space neg \dummybb\space mul} \psline[linecolor=blued,linestyle=dashed,linewidth=0.4pt](\Xs,\Ys)(\X,\Y)
% }
%}{}
%
% ersetzt durch Herberts neuen Code
\FPupn{Xs}{\minstart\space \distmove\space mul \xendn\space mul \dummyq\space\altscale\space mul \space div}
\FPupn{Ys}{\dummyu\space neg \dummybb\space mul}
\makeatletter
\pslistplot[linecolor=red!50]{
/startpoint { \Xs\space \Ys\space \tx@ScreenCoor\space moveto } def
mark \dataA \space counttomark 2 div cvi /nData exch def
nData {
startpoint \tx@ScreenCoor\space lineto
} repeat
}
\pslistplot[plotstyle=dots]{\dataA}
% Herberts neuer Code
\ifthenelse{\equal{\dart}{screen}}{
\listplot[plotstyle=line, linewidth=1.73pt, linecolor=black,showpoints=false,dotstyle=*,dotsize=4pt]{\dataA} % Punkte Blau 200 Grad
\listplot[plotstyle=dots, linewidth=1.73pt, linecolor=white,showpoints=true,dotstyle=*,dotsize=6pt]{\dataA} % Punkte Blau 200 Grad
\listplot[plotstyle=dots, linewidth=1.73pt, linecolor=black,showpoints=true,dotstyle=*,dotsize=4pt]{\dataA} % Punkte Blau 200 Grad
}{}
\ifthenelse{\equal{\dart}{loading}}{
\listplot[plotstyle=dots, linewidth=1.73pt, linecolor=black,showpoints=true,dotstyle=*,dotsize=6pt]{\dataA} % Punkte Blau 200 Grad
\listplot[plotstyle=dots, linewidth=1.73pt, linecolor=black,showpoints=true,dotstyle=*,dotsize=4pt]{\dataA} % Punkte Blau 200 Grad
}{}
\psline(\xstart,\yistart)(\xend,\yistart)
\psline(\xstart,\yistart)(\xstart,\yend)
\psline(\xend,\yistart)(\xend,\yend)
\psline(\xstart,\yend)(\xend,\yend)
\end{pspicture}
\caption[\bcaption]{\bcaption}
\label{\lab}
\end{figure}
\end{document}
</code></pre>
<p>Code, nearly reached the goal....</p>
<pre><code>\assignvalues{xstart|xend|ystart|yend|yistart|nhlines|nvlines|nvunit|hilfsgitternetzlinien|alternativskalierung|inputf|altscale|rgg}{0|9|-0.8|4.6|0|14|10|2|5|0.35|Messdaten/statistik/rohstoffextruder.dat|1|0}
\assignvalues{dart}{loading}
\assignvalues{mbstartx|mbstepx|mbstarty|mbstepy}{1|1|1|1}
\assignvalues{bottomdesc|leftdesc|topdesc|rightdesc|lab|bcaption}{Unten|Links|Oben|Rechts|label|Bezeichnung}
\assignvalues{nvlines|nhlines|lab|mbstartx|mbstepx|hilfsgitterlinien|mbstarty|mbstepy|bcaption|bottomdesc|leftdesc}{5|4|fig:LoadingPlot|-0.1|0.1|15|-0.50|0.25|Loading Plot Rohstoff Extruder|Erste Komponente|Zweite Komponente}
\assignvalues{scalex|scaley|scaler}{1|1|1}
\assignvalues{dummyj|dummyba|dummyh|xendn|dummyq|altscale|miny|dummyu|dummybb|dummyr|dummyl|dummym|dummyb|minstarty|dummyu|dummyt|schriftgrad|gesamthl|messb|dummyd|nhlinesn|minstart|dummyr|dummybb|distmove}{-0.600000000000000000|-0.069|-0.1|9|0.5|1|-0.448|-0.50|4.6|1.15000|1.80000|0.12000|1.8|0.25|-0.50|0|0.4|75|1|6|5|0.1|1.15000|4.6|1.000000000000000000}
\FPupn{Xs}{\minstart\space \distmove\space mul \xendn\space mul \dummyq\space\altscale\space mul \space div}
\FPupn{Ys}{\dummyu\space neg \dummybb\space mul}
\makeatletter
\pslistplot[linecolor=red!50]{
/startpoint { \Xs\space \Ys\space \tx@ScreenCoor\space moveto } def
mark \dataA \space counttomark 2 div cvi /nData exch def
nData {
\tx@ScreenCoor\space \miny\space neg \dummyu\space neg \miny\space neg sub add add \dummybb\space mul
exch \tx@ScreenCoor\space \dummyba\space \dummyh\space neg \dummyba\space sub add add \xendn\space mul \dummyq\space\altscale\space mul \space div exch
startpoint \tx@ScreenCoor\space lineto
} repeat
}
%\makeatother
\pslistplot[plotstyle=dots]{\dataA}
</code></pre>
| 0non-cybersec
| Stackexchange | 4,033 | 9,509 |
How do I go about creating this SQL query?. <p>I'm attending the free DB course at Stanford Online, and frankly one of the exercises gave me some trouble. I have a feeling that this should be horribly simple, so for a DBA, I'm obviously not very good with SQL. </p>
<p>We're working with a simplified scenario for rating movies.</p>
<blockquote>
<p>For all cases where the same reviewer rated the same movie twice and gave it a higher rating the second time, return the reviewer's name and the title of the movie.</p>
</blockquote>
<p>Here's the schema:</p>
<pre><code>Movie ( mID, title, year, director )
Reviewer ( rID, name )
Rating ( rID, mID, stars, ratingDate )
</code></pre>
<p>How should I go about this?</p>
| 0non-cybersec
| Stackexchange | 217 | 728 |
Ideal is graded iff it is generated by homogeneous elements. <p>Consider the polynomial ring $\mathbb{F}[x_{1},...,x_{n}]$ in $n$ variables and let $I \subset \mathbb{F}[x_{1},...,x_{n}]$ be an ideal. We call $I$ <em>graded</em> if we can decompose it into it's homogeneous components, i.e.</p>
<p>$$
I = \bigoplus\limits_{i \geq 0}(I \cap R_{i}),
$$
where $R_{i} = \text{span}\{x^{a} : a \in \mathbb{N}^{n}, \sum_{j=1}^{n}a_{j} = i\}$, i.e. $R_{i}$ is the set of all homogeneous polynomials of degree $i$. </p>
<p>Now in a book it says that $I$ is graded if and only if $I$ is generated by homogeneous elements. There was no proof. Anyone can help? For the if part we can consider $\bigcup_{i\geq 0}(I\cap R_{i})$ as generating set of homogeneous elements for $I$. But now $\mathbb{F}[x_{1},...,x_{n}]$ is a noetherian ring so every ideal is finitely generated. How can I found a finite generating set of homogeneous elements?</p>
| 0non-cybersec
| Stackexchange | 306 | 934 |
Rewrite $ \int_{\mathcal{S}}dP_X=1 $ as conditions on boxes in $\mathbb{R}^d$. <p>Take <span class="math-container">$r\in \mathbb{N}$</span> and let <span class="math-container">$d\equiv r+\binom{r}{2}$</span>.</p>
<p>Consider a d-dimensional random vector <span class="math-container">$X\equiv (X_1,...,X_d)$</span>. Let <span class="math-container">$P_X$</span> be the probability distribution of <span class="math-container">$X$</span>. Assume that
<span class="math-container">$$
\int_{\mathcal{S}}dP_X=1
$$</span>
where
<span class="math-container">$$
\begin{aligned}
\mathcal{S}\equiv \{(b_1,b_2,..., b_d)\in \mathbb{R}^{d}: \text{ } & b_{r+1}=b_1-b_2, b_{r+2}=b_1-b_3, ...,b_{2r-1}=b_1-b_r, \\
&b_{2r}=b_2-b_3, ..., b_{3r-3}=b_2-b_r,\\
&...,\\
& b_d=b_{r-1}-b_r\}
\end{aligned}
$$</span>
For example, when <span class="math-container">$r=2$</span> (<span class="math-container">$d=3$</span>) we have the surface
<span class="math-container">$$
\begin{aligned}
\mathcal{S}\equiv \{(b_1,b_2,b_3)\in \mathbb{R}^{3}: \text{ } & b_3=b_1-b_2\}=\{(b_1,b_2,b_3)\in \mathbb{R}^{3}: \text{ } & b_1=b_2+b_3\}
\end{aligned}
$$</span>
When <span class="math-container">$r=3$</span> (<span class="math-container">$d=6$</span>) we have
<span class="math-container">$$
\begin{aligned}
\mathcal{S}\equiv \{(b_1,..., b_6)\in \mathbb{R}^{6}: \text{ } & b_4=b_1-b_2, b_5=b_1-b_3, b_6=b_2-b_3\}
\end{aligned}
$$</span></p>
<p><strong>My final goal:</strong> I'm interested in rewriting the condition <span class="math-container">$\int_{\mathcal{S}}dP_X=1$</span> as a collection of zero probability measure conditions on <strong>d-dimensional "boxes"</strong> in <span class="math-container">$\mathbb{R}^d$</span>. The idea is that any box in <span class="math-container">$\mathbb{R}^d$</span> not intersecting <span class="math-container">$\mathcal{S}$</span> should have probability measure equal to zero. Therefore, if we consider enough of these boxes, we should be able to equivalently rewrite <span class="math-container">$\int_{\mathcal{S}}dP_X=1$</span>. </p>
<hr>
<p>When <span class="math-container">$r=2$</span> (<span class="math-container">$d=3$</span>), my goal is achieved by the following claim</p>
<p><strong>Claim:</strong> For any two real numbers <span class="math-container">$(b,c)\in \mathbb{R}^2$</span>, define the boxes <span class="math-container">$$B(b,c)\equiv \{(x,y,z)\text{ s.t. } x> b+c, y\leq b, z\leq c\}$$</span> and <span class="math-container">$$Q(b,c)\equiv \{(x,y,z)\text{ s.t. } x\leq b+c, y>b, z>c\}$$</span></p>
<p>If <span class="math-container">$P_{X}(B(b,c))=0$</span> and <span class="math-container">$P_{X}(Q(b,c))=0$</span> <span class="math-container">$\forall(b,c)\in \mathbb{Q}^2$</span>, then <span class="math-container">$\int_{\mathcal{S}}dP_{X}=1$</span>.</p>
<p>The proof of the claim is provided <a href="https://math.stackexchange.com/questions/3075884/rewrite-int-a-b-c-in-mathbbr3-text-s-t-a-bc-dp-x-y-z-1-as">here</a></p>
<hr>
<p>I would like your help to <strong>generalise the claim (and possibly the proof)</strong> to any <span class="math-container">$r$</span>. <strong>What I find challenging is defining the relevant boxes for any <span class="math-container">$r>2$</span></strong>. I really can't see how to generalise the box definitions from <span class="math-container">$r=2$</span> to any <span class="math-container">$r$</span>.</p>
| 0non-cybersec
| Stackexchange | 1,355 | 3,446 |
Play 2.5 with Akka - could not find implicit value for parameter timeout: akka.util.Timeout. <p>I'm attempting to test out Akka with Play 2.5 and I'm running into a compile error I can't seem to get around.</p>
<p>I'm following this page from the Play docs:
<a href="https://playframework.com/documentation/2.5.x/ScalaAkka" rel="noreferrer">https://playframework.com/documentation/2.5.x/ScalaAkka</a></p>
<p>Here is the full code:</p>
<pre><code>package controllers
import javax.inject.{Inject, Singleton}
import akka.actor.ActorSystem
import controllers.HelloActor.SayHello
import play.api.mvc._
import play.api.libs.concurrent.Execution.Implicits.defaultContext
import scala.concurrent.duration._
import akka.pattern.ask
@Singleton
class Application @Inject()(system: ActorSystem) extends Controller {
implicit val timeout = 5.seconds
val helloActor = system.actorOf(HelloActor.props, "hello-actor")
def sayHello(name: String) = Action.async {
(helloActor ? SayHello(name)).mapTo[String].map { message =>
Ok(message)
}
}
}
import akka.actor._
object HelloActor {
def props = Props[HelloActor]
case class SayHello(name: String)
}
class HelloActor extends Actor {
import HelloActor._
def receive = {
case SayHello(name: String) =>
sender() ! "Hello, " + name
}
}
</code></pre>
<p>My route looks like:</p>
<pre><code>GET /:name controllers.Application.sayHello(name: String)
</code></pre>
<p>And, finally, my build.sbt:</p>
<pre><code>name := "AkkaTest"
version := "1.0"
lazy val `akkatest` = (project in file(".")).enablePlugins(PlayScala)
scalaVersion := "2.11.7"
libraryDependencies ++= Seq( jdbc , cache , ws , specs2 % Test )
unmanagedResourceDirectories in Test <+= baseDirectory ( _ /"target/web/public/test" )
resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases"
routesGenerator := InjectedRoutesGenerator
</code></pre>
<p>When I attempt to run this, I get the following compilation error:</p>
<pre><code>could not find implicit value for parameter timeout: akka.util.Timeout
</code></pre>
<p>I've tried moving around the timeout to no avail. Does anyone have an idea what might cause this compilation error?</p>
| 0non-cybersec
| Stackexchange | 728 | 2,251 |
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 |
Me [20F] with my mother [61 F], I think she has Münchausen by Proxy - with her cat.. Okay, so, I am currently in my junior year of university so I obviously don’t live with my Mom. She’s lonely since she and my Dad divorced in my freshman year. I visit a couple times a month but my time is very limited, especially as a chem. major. She got really crazy and needy, calling me up and crying, so I suggested that she get a pet so she wouldn’t be lonely. At my suggestion, she got a little orange cat, Apricot. I’m thinking it was in early April last year, so she has had Apricot for a little under a year.
In the first week of May (I remember because finals were just ramping up), she calls me up and says that Apricot jumped out a second story window and hurt herself. I was concerned but couldn’t come visit and see for myself. Mom said that Apricot broke her hind leg and needed a cast, and that the vet thought she might have internal bleeding? It didn’t turn out that she had internal bleeding but she did have to wear her sad little cast for two months.
No incidents until almost a month after the cast was off. Mom calls me in a panic, screaming that Apricot is throwing up and all wobbly. She immediately went to antifreeze, saying she was certain that the neighbor’s car was leaking antifreeze everywhere and Apricot must have drank it. She was adamant that it was antifreeze and not just the flu or whatever. I believed her and I told her to take Apricot to the vet. Sure enough, antifreeze poisoning. I don’t know what the treatment is for antifreeze poisoning in cats but I guess she was reached early enough and she was fine. At that point I was a bit suspicious that this dumb cat had gotten sick twice. I recommended to Mom that she keep Apricot inside to avoid these sorts of incidents.
I think my Mom was fine for a while because she took on a part time job at the library and started doing some classes (cooking, etc) at this learning center. But just recently, I got approved for study abroad over the summer in Germany. I was ecstatic but realized that would mean I wouldn’t be able to visit my Mom over the summer. So I called her up and told her. She was crying, of course, it was just the waterworks. She doesn’t want me to go, she wants her favorite daughter, etc, etc. She always does this ever since the divorce – she wants to feel like she’s getting all possible attention.
Friday morning, I get another panicky phone call. She says that Apricot has fallen down the stairs and broken 3 ribs. What??? I’ve never heard of a cat falling down stairs my whole life. She is upset, saying that she can’t take care of a cat, can’t take care of her pets, yada yada yada. I was furious but I didn’t accuse her of anything. There are no signs of abuse in Apricot besides the obvious. She’s friendly, openly loving, etc. But I’m seriously worried that my Mom might have Münchausen by Proxy. Am I overreacting? Are these just individual incidents that I’m linking up for no reason, or is there something to this? I can’t help feeling that this is all my fault for suggesting she get a pet in the first place.
tl;dr: I think my Mom might be hurting her new cat, Apricot, on purpose. Apricot has broken a leg, drunk antifreeze, and fell down the stairs all in the past year. Am I just being paranoid? | 0non-cybersec
| Reddit | 822 | 3,320 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
How to emit SocketIO event on the serverside. <p>I'm running a gevent-socketio Django application.</p>
<p>I have something similar to this class</p>
<pre><code>@namespace('/connect')
class ConnectNamespace(BaseNamespace):
def on_send(self, data):
# ...
</code></pre>
<p>However, if I receive the events from the javascript client, everything works and for instance <code>send</code> event is processed correctly</p>
<p>I'm a little bit lost if I want to <code>emit</code> some event on the server side. I can do it inside the class with <code>socket.send_packet</code></p>
<p>But now I want to link some event to <code>post_save</code> signal, so I'd like to <code>send_packet</code> from outside this namespace class, one way of doing this would be </p>
<pre><code>ConnectNamespaceInstance.on_third_event('someeventname')
</code></pre>
<p>I just can't figure out how can I get the instance of ConnectNamespaceInstance</p>
<p>To sum it up, I just want to send an event to javascript client after I receive <code>post_save</code> signal</p>
| 0non-cybersec
| Stackexchange | 316 | 1,061 |
Lagrange Multipliers where no solutions(s) satisfy the constraints. <p>$f(x) = x-y$ subject to constraint $x^2-y^2=2$<br>
Using the method of Lagrange Multipliers, we get: </p>
<p>$(1, -1) = \lambda(2x, -2y)$ which gives $x=y$ but this does not satisfy $x^2-y^2=2$</p>
<p>Is this because the Lagrange method is not applicable here? Or is it valid for the Lagrange method to not produce any solutions?</p>
| 0non-cybersec
| Stackexchange | 148 | 409 |
Using lambda expression as Compare for std::set, when it's inside a vector. <p>I want to use a lambda expression as custom Compare for a std::set of integers. There are many answers on this site explaining how to do this, for example <a href="https://stackoverflow.com/a/46128321/10774939">https://stackoverflow.com/a/46128321/10774939</a>. And indeed,</p>
<pre><code>#include <vector>
#include <set>
#include <iostream>
int main() {
auto different_cmp = [](int i, int j) -> bool {
return j < i;
};
std::set<int, decltype(different_cmp)> integers(different_cmp);
integers.insert(3);
integers.insert(4);
integers.insert(1);
for (int integer : integers) {
std::cout << integer << " ";
}
return 0;
}
</code></pre>
<p>compiles and outputs</p>
<blockquote>
<p>4 3 1</p>
</blockquote>
<p>as expected. However, when I try to put this set in a vector with</p>
<pre><code> std::vector<std::set<int, decltype(different_cmp)>> vec_of_integers;
vec_of_integers.push_back(integers);
</code></pre>
<p>the compiler complains. I'm using Visual Studio 2017 and I get different compiler errors depending on the surrounding code. In the above example, it's</p>
<pre><code>1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\utility(77): error C2664: 'void std::swap(std::exception_ptr &,std::exception_ptr &) noexcept': cannot convert argument 1 from '_Ty' to 'std::exception_ptr &'
1> with
1> [
1> _Ty=main::<lambda_48847b4f831139ed92f5310c6e06eea1>
1> ]
</code></pre>
<p>Most of the errors I've seen so far with this seem to have to do with copying the set.</p>
<p>So my question is: </p>
<blockquote>
<p>Why does the above code not work and how can I make it work, while still using a locally defined lambda?</p>
</blockquote>
| 0non-cybersec
| Stackexchange | 683 | 1,958 |
vServer Debian Linux virtual host issue. <p>I am having an issue with my virtual host setup for days. My server is a vserver with debain linux and I am trying to add two new domains which will be redirected to their own subfolders.</p>
<p>Domain1.com --> /var/www/domain1</p>
<p>Domain2.com --> /var/www/domain2</p>
<p>The setup is working fine, but the domains are not redirecting to the subfolders but the server root directory. So if I open "domain1.com" I get redirected to "domain1.com/mail" which is the roundcube installation.</p>
<p>Here is how I did the setup:</p>
<p><strong>/etc/apache2/sites-available/domain1</strong></p>
<pre><code><VirtualHost domain1.com>
ServerAdmin webmaster@localhost
ServerAlias domain1.com *.domain1.com
DocumentRoot /var/www/domain1
</VirtualHost>
</code></pre>
<p><strong>/etc/hosts</strong></p>
<pre><code>127.0.0.1 localhost.localdomain localhost domain1.com www.domain1.com
</code></pre>
<p>I just don't get it why it's not redirected to the subfolder... Can someone please tell me what I am doing wrong?</p>
| 0non-cybersec
| Stackexchange | 351 | 1,082 |
Axiomatizing a "bounded" companion to PA. <p><em>There's nothing special about PA here, I'm just focusing on it since it's strong enough to ignore lots of minor technical issues around foundations. If switching to some other theory would yield a better response, feel free to do so.</em></p>
<p>Let <span class="math-container">$$PA_{bd}=\{\varphi: PA\vdash\forall^\infty n([n]\models\varphi)\},$$</span> where <span class="math-container">$[n]=\{0,1,...,n\}$</span> <em>(with <span class="math-container">$+$</span> and <span class="math-container">$\times$</span> interpreted as <span class="math-container">$$a+^{[n]}b=\min\{a+b, n\},\quad a\times^{[n]}b=\min\{a\times b, n\}$$</span> so that this actually makes sense - we could also switch to the relational version of PA)</em>. Note that (for fixed <span class="math-container">$\varphi$</span>) the statement "<span class="math-container">$\forall^\infty n([n]\models\varphi)$</span>" can in fact be expressed in the language of arithmetic (Skolem functions over finite objects are themselves finite objects), so the definition of PA<span class="math-container">$_{bd}$</span> does actually make sense.</p>
<p>Clearly PA<span class="math-container">$_{bd}$</span> is recursively axiomatizable; however, this only gives an axiomatization which "goes through PA" in some sense. My question is:</p>
<blockquote>
<p>Is there a reasonably-simple axiomatization of PA<span class="math-container">$_{bd}$</span> which doesn't reference PA itself?</p>
</blockquote>
<hr>
<p>One natural guess would be [some basic algebra stuff] together with the full induction scheme. But in fact this is too <em>weak</em> - already this theory is contained in the analogous theory (I<span class="math-container">$\Sigma_1)_{bd}$</span> <em>(since saying that a finite structure satisfies a complicated formula is still a very simple formula!)</em>.</p>
<p>Further evidencing some structure here, it's easy to show (e.g. I<span class="math-container">$\Sigma_1$</span> can prove) that PA and PA<span class="math-container">$_{bd}$</span> are equiconsistent:</p>
<ul>
<li><p>If PA is inconsistent then PA proves everything, and in particular PA proves <span class="math-container">$\forall^\infty n([n]\models\perp)$</span> which gives <span class="math-container">$\perp\in$</span> PA<span class="math-container">$_{bd}$</span>.</p></li>
<li><p>If PA<span class="math-container">$_{bd}$</span> is inconsistent, that means that for some <span class="math-container">$\varphi$</span> we have PA<span class="math-container">$\vdash \forall^{\infty}n([n]\models\perp)$</span>. But PA can prove enough about the semantics of finite structures to prove that no <span class="math-container">$[n]$</span> satisfies <span class="math-container">$\perp$</span>, and so we get a contradiction in PA.</p></li>
</ul>
<p>(As an aside, the usual proof of Tennenbaum's theorem also shows that PA<span class="math-container">$_{bd}$</span> has no computable models either. Which isn't surprising, since any of its models are clearly proper end extensions of <span class="math-container">$\mathbb{N}$</span>.)</p>
| 0non-cybersec
| Stackexchange | 904 | 3,149 |
Expectation and Variance of Poisson Process. <blockquote>
<p>Suppose that in a store, customers arrive as a Poisson process with rate $1/\mathrm{min}$ between time $0$ and $10$ minutes. Suppose there are ten kinds of items in the store (each kind has infinite supply) and each customer independently chooses one item uniformly at random and buy it. Let $M$ be the number of distinct kinds of items that are purchased up to time $10$. What is the expectation and variance of $M$?</p>
</blockquote>
<p>n.b.: This is not homework; just review.</p>
<p>For the expectation, I let $N$ (which follows $\mathrm{Pois}(10)$) be the number of customers arriving in the first ten minutes, and I found that $\mathbb{E}(M|N=k)=10(1-(9/10)^k)$ so then $\mathbb{E}M=\sum_k \frac{e^{-10}10^k}{k!}(10(1-(9/10)^k)$. But I'm not sure that this yields the correct answer.</p>
<p>Any help would be appreciated. Thanks.</p>
| 0non-cybersec
| Stackexchange | 270 | 906 |
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 |
When does SQL Server determine to use a new index?. <p>I have been performing some maintenance on a server that runs some software the company bought, so I can't really change how the queries have been written. I have used some tools to determine some of the missing indexes on the server. Using my tools, though, I didn't see which queries were indicating these. I do, however, monitor how much the indexes are being written and read.</p>
<p>So, my question is, when adding new indexes that have been determined as missing, when does SQL Server notice the new indexes and determines whether they actually help the query? Is it immediately after the index is created and the query is ran again, or is it more complicated?</p>
| 0non-cybersec
| Stackexchange | 164 | 731 |
Cannibals capture three men. The men are told that they will be skinned and eaten and then their skin will be used to make canoes. Then they are each given a final request. The first man asks to be killed as quickly and painlessly as possible. His request is granted, and they poison him. The second man asks for paper and pen so that he can write a farewell letter to his family. This request is granted, and after he writes his letter, they kill him saving his skin for their canoes. Now it's the third man's turn. He asks for a fork. The cannibals are confused, but it is his final request, so they give him a fork. As soon as he has the fork he begins stabbing himself all over and shouts, "To hell with your canoes!" | 0non-cybersec
| Reddit | 172 | 721 |
Proof: Every irreducible diagonaldominant matrix is $A$ is invertible.. <blockquote>
<p><strong>Definition:</strong> A matrix <span class="math-container">$A\in\mathbb{K}^{N,N}$</span> is irreducible diagonaldominant if it is irreducible and row or column diagonaldominant, where at least in one row/ column strict inequality has to hold.</p>
<p>Let <span class="math-container">$A$</span> be irreducible diagonaldominant (row-diagonaldominant). Then there exists <span class="math-container">$m\in{1,...,N}$</span> for which</p>
<p><span class="math-container">$\hspace{4cm} |a_{mm}|>\sum\limits_{j\neq m}|a_mj|\hspace{1cm} (1)$</span></p>
<p>Assume that <span class="math-container">$A$</span> isn't invertible. Then <span class="math-container">$Ax=0$</span> has a solution <span class="math-container">$x\neq 0$</span>. Because of <span class="math-container">$(1)$</span> not all components of <span class="math-container">$x$</span> can have the same absolute value. Let</p>
<p><span class="math-container">$\hspace{4cm} I:=\{k\in\{1,...,N\}:|x_k|\geq x_j \forall j = 1,...,N\}$</span></p>
<p>Since not all indices <span class="math-container">$x_k$</span> have the same absolute value not all <span class="math-container">$N$</span> indices are a member of <span class="math-container">$I$</span>. Now let <span class="math-container">$k\in I$</span></p>
<p><span class="math-container">$\hspace{4cm} a_{kk}x_k = -\sum\limits_{j\neq k}a_{kj}x_j,$</span></p>
<p><span class="math-container">$\hspace{4cm} |a_{kk}|\leq\sum\limits_{j\neq k}|a_{kj}|\dfrac{|x_j|}{|x_k|}$</span></p>
<p>because of <span class="math-container">$\dfrac{|x_j|}{|x_k|}\leq 1$</span> (while for <span class="math-container">$j\notin I$</span> we have strict inequality) and the diagonaldominance of <span class="math-container">$A$</span> we get <span class="math-container">$a_{kj}=0\forall j\notin I$</span>. However this means that <span class="math-container">$A$</span> is reducible which is a contradiction to our prequisites.</p>
</blockquote>
<p>So I can follow this proof right up to the last paragraph of which I don't understand why we get <span class="math-container">$a_{kj}=0\forall j\notin I$</span> and furthermore why this would imply reducibility. </p>
<p>I'm aware of the fact that a matrix <span class="math-container">$A$</span> is irreducible iff its digraph is strongly connected, but I don't see how one could apply this theorem here.</p>
<p><strong>Edit</strong> the answer of @user1551 made things clearer for me but I think I can elaborate on two more steps in the proof that I didn't understand before. First of all why <span class="math-container">$\dfrac{|x_j|}{|x_k|}<1$</span> for <span class="math-container">$j\notin I$</span>.</p>
<blockquote>
<p>Let <span class="math-container">$j\notin I$</span> therefore there is <span class="math-container">$ m=1,...,N:x_m>|x_j|$</span>. Now we assume that <span class="math-container">$|x_j|=|x_k|$</span> this though implies <span class="math-container">$x_m>|x_k|$</span> which is a contradiction to the fact that <span class="math-container">$k\in I$</span> hence <span class="math-container">$|x_j|<|x_k|$</span>.</p>
</blockquote>
<p>In the end this leads to the conclusion that indeed <span class="math-container">$A$</span> is reducible because since <span class="math-container">$k$</span> was an arbitrary element from <span class="math-container">$I$</span> we have</p>
<blockquote>
<p><span class="math-container">$\forall k\in I:\forall j\notin I: a_{kj} = 0$</span>.</p>
</blockquote>
<p>One could've tought about taking a path that passes trough other nodes before but by remarking that <span class="math-container">$I\cup I^C=N$</span> we can see that this isn't possible because there are no connections between <span class="math-container">$I$</span> and <span class="math-container">$I^C$</span> at all.</p>
| 0non-cybersec
| Stackexchange | 1,310 | 3,952 |
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 |
Swift - Impossible to use "registerNib" on my tableView to add a custom cell. <p>I'm just figuring out how to add custom cells to a tableView in Swift. I watched a lot of tutorials and they all say at some point to use something like <code>tableView.registerNib</code> which is not working for me !</p>
<p>This is the code I'm using in my tableViewController class :</p>
<pre><code>var nib = UINib(nibName: "ViewExerciceCell", bundle: nil)
tableView.registerNib(nib, forCellReuseIdentifier: "ExerciceCell")
</code></pre>
<p>When I try to build, I have an error on the second line which says : </p>
<blockquote>
<p>Cannot invoke 'registerNib' with an argument list of type '(UINib,
forCellReuseIdentifier: String)'.</p>
</blockquote>
<p>What can I do ? All the tutorials and other answers about custom cells are using this code.</p>
<p>Thanks in advance </p>
| 0non-cybersec
| Stackexchange | 277 | 878 |
What is the best strategy to find 2 circles whose total area is maximum in a triangle?. <p>I am looking for the best strategy to find 2 circles whose total area are maximum in a triangle. I tried it on an example as seen Figures below. </p>
<p>Strategy $1$:</p>
<p>If I draw a big circle that touchs to 3 sides and then to draw 3 circles next to the big circle. Then select the biggest one in three of them. As seen in Figure 1 that I found Max Area of 2 circles: 14.18+4.56=18.74</p>
<p>Strategy $2$:</p>
<p>To drew 2 circles that each one touched to 2 sides of triangles and also touching each other as seen in Figure-2.
I tried to extend total area that what I got in Strategy 1 but I could not. </p>
<p>Of course I know my example is not proof that Strategy 1 is general solution of the problem. I just tried to show what I did till now to solve the optimum problem.</p>
<p>Could you please help me to find the best strategy and to proof it for that optimum problem? Note:If there is a general strategy proof for total max area for n circles in a triangle, It can be wonderful.
Thanks for your answers and your time.</p>
<p><img src="https://i.stack.imgur.com/hyq9b.png" alt="enter image description here">
<img src="https://i.stack.imgur.com/O5gvz.png" alt="enter image description here"></p>
| 0non-cybersec
| Stackexchange | 372 | 1,310 |
How do I permanently disable the APM (advanced power management) of my Hitachi hard drives?. <p>I'm using <a href="https://sites.google.com/site/quiethdd/" rel="nofollow noreferrer">quietHDD</a> and/or <a href="http://disablehddapm.blogspot.com/" rel="nofollow noreferrer">hdparm</a> to disable <a href="https://en.wikipedia.org/wiki/Advanced_Power_Management" rel="nofollow noreferrer">APM</a> on my very clicky Hitachi hard drives (to stop the disk heads from parking).</p>
<p>The program supposedly only needs to be run at boot time and after power cycles such as standby/sleep. However, in my case it seems to only work for short periods at a time before the clicking returns and I have to run quietHDD or hdparm again.</p>
<p>Is there a way to <em>permanently</em> edit the drives' settings so APM is completedly disabled for the life of the drive?</p>
| 0non-cybersec
| Stackexchange | 261 | 860 |
I'm [26/M] my Girlfriend [20/F] of a nearly 4 year relationship makes everything a personal attack even when its nothing to do with her. Forces me to apologize or she starts threating to kill her self.. Edit: She is 22! Not 20. Don't know how I botched that.
I've been with her for nearly 4 years now and this is a new thing. A year ago I would have said this wasn't the case.
I was talking about politics, and regardless of your politicking, I was arguing for a meritocracy. Showing/Demonstrating the differences between a real meritocracy and the society we live in.(In this case I'm citing actual studies and referencing books, and experts in their field. Its not something I have a degree in, but it is a subject of huge interest to me as is all of philosophy.)
Here is what she takes from the argument I made about greater society:
A. Free will doesn't exist.
B. God doesn't exist.
(These are common themes anytime we talk about anything. Shes religious and I'm not, it should be noted I'm not an atheist. Somehow she makes everything out to be about that.)
This last time I was blamed for the following things despite not having done them:
C. I have accused her of being lucky and not hard working. (You can be both you know.)
D. I have accused her family of being stupid or implied she thinks her family is stupid.
A few more facts:
E. She has had statistics and knows that they can't be correlated to individual cases.
F. She will, if insulted by something I think, make the argument personal. "What about me? What about my case? I'm no exception to the statistics but I beat them." (Something she actually said once.)
Universally she takes something I say as a personal attack that objectively isn't. This example being the following: "Good point, and your Father isn't a stupid man." Her screaming "***I DIDN'T FUCKING SAY HE WAS STUPID***" I looked her dead in the face and said "Did I say that?" "YES YOU FUCKING DID DON'T DENY IT!" I didn't. I didn't even imply it in context. (Context being that her Dad is a hard worker. Me saying "Yeah good point, and hes not stupid either.")
This time led to her being in tears and I really don't know what to say or do about it. About half way through any given argument if anything I say even mildly is something she disagrees with she will give this openly disgruntled look, and assume I'm insulting her. Its like she can't abstract that I can agree with her even if for differing reasons.
Letter C comes directly from the fact that Intelligence (and having intelligence) is purely luck based. And spoiler: It fucking is. Oh well. I have seen her melt down over this fact twice now. Going so far as to call me stupid and a piece of shit (in lightly veiled terms) to try and piss me off. When I take the bait she then lies about trying to insult me, and makes her self to be the victim "You said this and this and this about my dad, and me." Mostly putting words in my mouth.
By the end of it if I'm not saying that shes the victim and its totally my fault, and I did everything wrong under the sun she begins screaming about how she should just kill herself when I pointed out that everything she is claiming I said is very clearly not something I actually said, and at best something she took as implied from it.
"Well if I just mistook you I should just go fucking kill myself."
I looked at her stunned like "What? Over this?"
"I didn't do anything wrong and I should just end it because you hate me!"
Here is the kicker: I'm not even yelling during most of this. I only yell when she directly insults me.
The thing is a year ago she woudn't have acted like this. Slowly shes becoming someone I can't talk to, and when I say that she screams something like "NO ITS ME WHO CAN'T TALK TO YOU!"
Something that I think is of importance is her belief in god: Shes not a YEC, shes not ultra religious herself, but anything that could even be potentially 'questioning' of god (And these are all like traps I don't see coming considering she went to a religious school that basically lied to her about a lot of shit.) causes her to immediately break down and freak out over religion and starts an instant screaming match, mostly against her and science than myself. I don't honestly think she can be a scientist in her field (biology/health) and maintain her stances on religion as they are so counter to the field: Evolution doesn't exist, Free will is real, God heals people, ect.
Seriously prior to her getting through her medical program and having time to stop and think about these things has really fucked with her personality. She now goes on tangents about how people need to 'just accept god is real and evolution is false.' Despite knowing the evidence herself of evolutions existence. When I argue for it (As I know evolution exists) she freaks out on that too.
I love her but I just don't know what to fucking think. Its like in the last 6-8 months shes become a different person. | 0non-cybersec
| Reddit | 1,185 | 4,967 |
Is .NET 4.0 Compatible with Windows XP SP2 or below?. <p>I have read here <a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=5765d7a8-7722-4888-a970-ac39b33fd8ab" rel="noreferrer">http://www.microsoft.com/downloads/en/details.aspx?FamilyID=5765d7a8-7722-4888-a970-ac39b33fd8ab</a> that to instal .NET 4.0 CP (client profile) you must have WinXP SP3 or above. This is somewhat worrying to me as there are many people on SP2 or below.</p>
<p>Is there any way I can run a .NET 4.0 app on any version of Windows xp and above? (without worrying about which service packs they have)?</p>
<p>If not, what about .NET 3.5, 3.0 or 2.0?</p>
<p>My questions are the following:</p>
<ol>
<li><p>How low do I need to go in my .NET Framework version choice to ensure compatibility for WinXP SP2 or above?</p></li>
<li><p>How low do I need to go in my .NET Framework version choice to ensure compatibility for WinXP (no service packs) or above? </p></li>
</ol>
| 0non-cybersec
| Stackexchange | 337 | 968 |
how to prove $\left(\frac{n}{3}\right)^n\leq\frac{1}{3}n!$. <p>i am asked to prove this statement:</p>
<blockquote>
<p>$$\left(\frac{n}{3}\right)^n\leq\frac{1}{3}n!$$ </p>
</blockquote>
<p>Now after several attempts, i am lost not knowing where and how to start. if I use induction, i am stuck on the way. how can i solve this in an easy way? i have huge difficulties when i have to find something which is bigger than the latter term or so, because i lack some important source of maths in my brain. i am very likely to give up on the way if it becomes tough. for any guidance how to overcome this phase i will be very very thankful. i am trying for proficiency in math. Thanks</p>
| 0non-cybersec
| Stackexchange | 205 | 687 |
feeling unmotivated. F18, 5’3, SW:137.6, CW: 124.1, GW: 110
hiya, so I’ve been on my weight loss journey for 3 months now and for whatever reason this week I’ve been feeling super unmotivated to do well. Maybe it’s bc I’m not losing the weight as quickly as I thought? I’m not too sure
For the past few days I’ve just had the most intense urges to eat and snack on all the the food in my pantry. I used to consume 1000 calories everyday for about 2 months before I realized how little this actually was. I’m now slowly trying to eat up to 1400 calories, increasing my calories by 100 each week. Right now, I am eating 1300.
Not only do I have issues with the that urge, I also just feel super duper lazy. I’ve started going on walks and bike rides last week to add to my current routine of 1 hr on the stationary bike.
Everything just feels sooooo slow and that it’s never going to happen.
I could use some motivation right about now :/ | 0non-cybersec
| Reddit | 249 | 946 |
how to get orthogonal rank 1 approximations?. <p>The situation: I have $k$ matrices $A_i$, which are all real and of size $m\times n$. Now I would like to find the matrices $\tilde{A}_i$ of $A_i$ so that</p>
<p>1) $\tilde{A}_i$ is of rank 1 (thus a rank 1 approximation of $A_i$)</p>
<p>2) trace zero orthogonal to all matrices $\tilde{A}_j$ with $ i > j$, thus
$\operatorname{Tr} \bigl( \tilde{A}_i \tilde{A}_j^\top \bigr) = 0$</p>
<p>For $k=2$ this is not a problem, but does anybody have an idea how to proceed when e.g. $k=8$? Thanks in advance for each help.</p>
| 0non-cybersec
| Stackexchange | 207 | 574 |
Powershell Append text to object description in Active Directory. <p>How can I append or prepend the description in AD I want to leave the current description and put some text infront of it</p>
<p>for example a computer has the description as "Accounting Dept" (without quotes)</p>
<p>I tried this:</p>
<pre><code>set-QADComputer -Identity computername
-Description {Disabled 8/17/2012, Termrpt "$($_.description)"}
</code></pre>
<p>I get this for the description</p>
<blockquote>
<p>Disabled 8/17/2012, "$($_.description)"</p>
</blockquote>
<p>but I want the orginal description prepended by the text like the following</p>
<blockquote>
<p>Disabled 8/17/2012, Accounting dept</p>
</blockquote>
<p>any ideas?</p>
<p>I tried parentheses instead but then it just puts the prepended text and wipes out the original altogether. </p>
| 0non-cybersec
| Stackexchange | 265 | 848 |
kNN with big sparse matrices in Python. <p>I have two large sparse matrices:</p>
<pre><code>In [3]: trainX
Out[3]:
<6034195x755258 sparse matrix of type '<type 'numpy.float64'>'
with 286674296 stored elements in Compressed Sparse Row format>
In [4]: testX
Out[4]:
<2013337x755258 sparse matrix of type '<type 'numpy.float64'>'
with 95423596 stored elements in Compressed Sparse Row format>
</code></pre>
<p>About 5 GB RAM in total to load. Note these matrices are HIGHLY sparse (0.0062% occupied).</p>
<p>For each row in <code>testX</code>, I want to find <strong><em>the</em></strong> Nearest Neighbor in <code>trainX</code> and return its corresponding label, found in <code>trainY</code>. <code>trainY</code> is a list with the same length as <code>trainX</code> and has many many classes. (A class is made up of 1-5 separate labels, each label is one of 20,000, but the number of classes is not relevant to what I am trying to do right now.)</p>
<p>I am using <code>sklearn</code>'s KNN algorithm to do this:</p>
<pre><code>from sklearn import neighbors
clf = neighbors.KNeighborsClassifier(n_neighbors=1)
clf.fit(trainX, trainY)
clf.predict(testX[0])
</code></pre>
<p>Even predicting for 1 item of <code>testX</code> takes a while (i.e. something like 30-60 secs, but if you multiply by 2 million, it becomes pretty much impossible). My laptop with 16GB of RAM starts to swap a bit, but does manage to complete for 1 item in <code>testX</code>.</p>
<p>My questions is, how can I do this so it will finish in reasonable time? Say one night on a large EC2 instance? Would just having more RAM and preventing the swapping speed it up enough (my guess is no). Maybe I can somehow make use of the sparsity to speed up the calculation?</p>
<p>Thank you.</p>
| 0non-cybersec
| Stackexchange | 585 | 1,814 |
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 |
Modifying a non managed table partition. <p>I ran across a partition that was initially setup (sql 2012) beginning of 2014 to break by month but wasn't updated for 2015. The main issue is that the last partition was setup as Jan 2015 so Feb data is loading into it and I'd like to add future months to the partition and break out the Feb data out of the Jan 2015 partition. My first thought was to load the data to another table and truncate the existing table then drop and recreate the partition as necessary but the table has over a billion records so storage and time are a consideration. What other options would have I have separate the Feb data from the Jan 2015 partition as well as add future months with the least impact to the system?</p>
<p>Here's the existing partitioning function being used.</p>
<pre><code>CREATE PARTITION FUNCTION [YearMonthPartFunction](date)
AS RANGE RIGHT
FOR VALUES (N'2014-01-01T00:00:00.000',
N'2014-02-01T00:00:00.000',
N'2014-03-01T00:00:00.000',
N'2014-04-01T00:00:00.000',
N'2014-05-01T00:00:00.000',
N'2014-06-01T00:00:00.000',
N'2014-07-01T00:00:00.000',
N'2014-08-01T00:00:00.000',
N'2014-09-01T00:00:00.000',
N'2014-10-01T00:00:00.000',
N'2014-11-01T00:00:00.000',
N'2014-12-01T00:00:00.000',
N'2015-01-01T00:00:00.000')
</code></pre>
| 0non-cybersec
| Stackexchange | 446 | 1,502 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
How to search HTML documentation generated by javadoc?. <p>I'm a Java beginner and I see a lot of documentation for Java APIs in similar HTML format, e.g. <a href="http://docs.oracle.com/javase/8/docs/api/index.html" rel="noreferrer">Java™ Platform, Standard Edition 8 API Specification</a>. I don't see a search option in any of these documents, so when I need to find for example <code>random()</code>, I go to <strong>index</strong>, select <strong>R</strong> and use browser to search for <strong>random</strong>. Is there a faster way, e.g. global search?</p>
| 0non-cybersec
| Stackexchange | 158 | 565 |
[NSV] Ate Keto at Korean Restaurant without BBQ. **The Great Glucose Test:** Korean food for Lunch
My wife has Gestational Diabetes. She gets it every time she is pregnant. She is Pregnant with our #2 Child. Anyway, She was craving Korean food so we went for lunch. I tried to help guide her to something low carb, but she had cravings, so she got what she wanted. So we did a test 1 hour later with a glucometer to see how we did.
**Wife:** Cold noodle and Bulgogi
**Me:** Spicy Tofu soup with Ham, sausage, Cheese, and Eggs
**1 Hour Later Glucose test:**
* **Wife:** 220
* **Me:** 89
I was pretty shocked... Just wanted to share :) | 0non-cybersec
| Reddit | 187 | 642 |
Epidemic spacial diffusion problem.. how to draw a graph of differential system of second order with partial derivative. <p>I'm currently working on how to simulate the diffusion of an epidemic in a population. If we don't consider that the population is moving in space, then the differential system is the following: <a href="https://i.stack.imgur.com/nkMMV.png" rel="nofollow noreferrer">Differential System SIS without spacial diffusion</a>. You'll find the corresponding program below. If we consider that the population (the infected people to be more specific) have an anarchic mobility, the differential system will contain a second order partial derivative in respect to the spacial variable x (the problem is considered in one spacial dimension only) as shows the following picture: <a href="https://i.stack.imgur.com/ERFbB.png" rel="nofollow noreferrer">Differential System SIS with spacial diffusion included</a>. The problem I have is how to implement that second order partial derivative in the program, and how draw the graphs of such a differential system.. (even though there is a spacial variable, the axes remain the same: Population and Time) If you take off the partial derivative, it becomes a simple differential system and the corresponding program I made is the following:</p>
<pre><code>from scipy import arange
from scipy.integrate import odeint
import matplotlib.pyplot as plt
import numpy as np
N0 = 1000000 #Initial population number
I0 = 100 #Initial infected number
PopuIni = [N0,I0]
b=1/3000000 #infection rate β
g=1/20 #cure rate of Infected people ɣ
d=5/1000 #death rate, not related to the epidemic (common between infected and susceptible)
n=4/1000 #birth rate (vertical infection from parents to progeny is not
considered here)
def EpidEvol(N,t):
S,I=N
derS = n*(S+I) + g*I - d*S - b*S*I
derI = b*S*I - d*I - g*I
return [derS,derI]
tmax=157
t=arange(0,tmax,0.1)
N=odeint(EpidEvol,PopuIni,t)
</code></pre>
<p>Thank you for your attention.. I sincerely hope to receive help from you</p>
<p><strong>UPDATE 1:</strong>
I found this website which provides a method of solving partial differential equations, but I genuinely don't know how to implement this in my program..
<a href="http://hplgit.github.io/prog4comp/doc/pub/p4c-sphinx-Python/._pylight006.html" rel="nofollow noreferrer">http://hplgit.github.io/prog4comp/doc/pub/p4c-sphinx-Python/._pylight006.html</a></p>
| 0non-cybersec
| Stackexchange | 712 | 2,454 |
Characteristic function of standard normal distribution using this method.. <p>Lets have $f(t)$ be this characteristic function.
I am told that $f'(t)=-t \cdot f(t)$ and that this can be proven, I found using partial integration and the dominated convergence theorem. I am aware of these theorems. I unfortunately do not know how to do this. The attempts tried are not of value worth sharing.</p>
<p>$$X:N(0,1)$$
$$f(t)=\int_{-\infty}^{\infty}e^{itx}\frac{1}{2\pi}e^{-\frac{x^2}{2}}dx$$ </p>
| 0non-cybersec
| Stackexchange | 148 | 493 |
Your July NoSleep Contest Winner is.... [nwf0165](http://www.reddit.com/user/nwf0165) with their story [I've been watching my friends on Netflix](http://www.reddit.com/r/nosleep/comments/2aj1t2/ive_been_watching_my_friends_on_netflix/)! Congratulations!
As a reminder, the winner will receive:
* A [NoSleep t-shirt!](http://nosleep.spreadshirt.com)
* One month of reddit gold from the moderators
* User flair in /r/NoSleep signifying the month in which they won the contest
* Their story will be featured in an eBook that will be released approximately every three months. Thank you, /u/EtTuTortilla!
* The winning story will be featured in an episode of [The NoSleep Podcast](http://www.thenosleeppodcast.com/) (providing the story is suitable for an audio adaptation)... AND they will receive a season pass! Thank you, /u/MikeRowPhone!
In addition, the winner and second-place winner will each receive one of the following:
* A license to [SmartEdit](http://www.smart-edit.com/), a new, first-pass-editing tool for creative writers and novelists.
-or-
* A copy of [Scrivener](http://www.literatureandlatte.com/scrivener.php) provided by Literature and Latte.
The eBook will henceforth include the top four stories (winner and three runners up) from each monthly contest. Also included in the next volume of the eBook will be:
* [I shouldn't have connected to my new neighbor's WiFi....](http://www.reddit.com/r/nosleep/comments/2awr4u/i_shouldnt_have_connected_to_my_new_neighbors_wifi/) by [Crapple_Facts](http://www.reddit.com/user/Crapple_Facts)
* [Her Name was Emma](http://www.reddit.com/r/nosleep/comments/29z7j8/her_name_was_emma/) by [alackofcoasters](http://www.reddit.com/user/alackofcoasters)
* [21 day quarantine](http://www.reddit.com/r/nosleep/comments/29qusu/21_day_quarantine/) by [jdpatric](http://www.reddit.com/user/jdpatric)
Vote counts can be seen [here](http://i.imgur.com/HqXO4Sd.png).
If you would like to contribute an extra prize to the winners of the next contest, please don't hesitate to send a message to me or to modmail!
Remember, if you didn't win this month, don't be discouraged! We will be running the contest in the middle of every month for as long as we can!
***
Visit our facebook page: www.facebook.com/nosleepcommunity
If you're interested in the NoSleep t-shirt, you can find that at http://nosleep.spreadshirt.com! Sales of these shirts fund contest prizes.
| 0non-cybersec
| Reddit | 773 | 2,469 |
Time complexity of counting triangles in planar graphs. <p>Counting triangles in general graphs can be done trivially in $O(n^3)$ time and I think that doing much faster is hard (references welcome). What about planar graphs? The following straightforward procedure shows that it can be done in $O(n\log{n})$ time. My question is two-fold:</p>
<ul>
<li>What is a reference for this procedure?</li>
<li>Can the time be made linear?</li>
</ul>
<p>From the algorithmic proof of Lipton-Tarjan's planar separator theorem we can, in time linear in the size of the graph, find a partition of vertices of the graph into three sets $A,B,S$ such that there are no edges with one endpoint in $A$ and the other in $B$, $S$ has size bounded by $O(\sqrt{n})$ and both $A,B$ have sizes upper bounded by $\frac{2}{3}$ of the number of vertices. Notice that any triangle in the graph either lies entirely inside $A$ or entirely inside $B$ or uses at least one vertex of $S$ with the other two vertices from $A \cup S$ or both from $B \cup S$. Thus it suffices to count the number of triangles in the graph on $S$ and the neighbours of $S$ in $A$ (and similarly for $B$). Notice that $S$ and its $A$-neighbours induce a $k$-outer planar graph (the said graph is a subgraph of a planar graph of diameter $4$). Thus counting the number of triangles in such a graph can be done directly by dynamic programming or by an application of Courcelle's theorem (I know for sure that such a counting version exists in the Logspace world by Elberfeld et al and am guessing that it also exists in the linear time world) since forming an undirected triangle is an $\mathsf{MSO}_1$ property and since a bounded width tree decomposition is easy to obtain from an embedded $k$-outer planar graph.</p>
<p>Thus we have reduced the problem to a pair of problems which are each a constant fraction smaller at the expense of a linear time procedure. </p>
<p>Notice that the procedure can be extended to find the count of the number of instances of any fixed connected graph inside an input graph in $O(n\log{n})$ time.</p>
| 0non-cybersec
| Stackexchange | 537 | 2,087 |
Server over VPN?. <p>I don't know that much about VPN, so it could be that this is utterly impossible. Here's hoping, though.</p>
<p>I would like to forward a port from my router to a machine connected to the network via VPN. That way, I could run a simple server on my laptop, and it would continue to work at the same address no matter where I am. The trick is that I don't want people connecting to the server to have to join the VPN. It should be completely transparent to the end-user.</p>
<p>If it's not possible with VPN, is there some other technology that would make this possible? Basically just forwarding a port to a remote machine, one without a static IP.</p>
| 0non-cybersec
| Stackexchange | 166 | 676 |
trying to call a method in the where of a linq statment. <p>Below is the code I'm using but it replies with</p>
<blockquote>
<p>Method 'Boolean isUser(System.String)' has no supported translation to SQL.</p>
</blockquote>
<p>Any help? Btw I'm using <strong>linq to SQL</strong> data source</p>
<pre><code>public void dataBind()
{
using (var gp = new GreatPlainsDataContext())
{
var emp = from x in gp.Employees
let k = isUser(x.ID)
where x.ActivtyStatus == 0
&& isUser(x.ID) != false
orderby x.ID
select new
{
ID = x.ID,
Name = x.FirstName + " " + x.MiddleName
};
ListView1.DataSource = emp;
ListView1.DataBind();
}
}
public static bool isUser(string ID)
{
int temp;
bool x = int.TryParse(ID, out temp);
return x;
}
</code></pre>
<p>I found a solution to query the result of the first query as objects but is that good cause I will passing through my data twice.</p>
<hr>
<p>the updated code that worked in the end after using the like as advised by Anders Abel</p>
<pre><code>public void dataBind()
{
using (var gp = new GreatPlainsDataContext())
{
var emp = from x in gp.Employees
where x.ActivtyStatus == 0
&& SqlMethods.Like(x.ID, "[0-9]%")
orderby x.ID
select new
{
ID = x.ID,
Name = x.FirstName + " " + x.MiddleName
};
ListView1.DataSource = emp;
ListView1.DataBind();
}
}
</code></pre>
| 0non-cybersec
| Stackexchange | 502 | 1,789 |
Pictures after 7 years of working out. I've been lifting for almost 7 years now. I had accumulated more dedication and knowledge as the years passed by of course.
I'm 5'8" and started at about 150 lbs. I'm now just over 190 with the intent of cutting to lose fat and lean up. Never used steroids. I'm sure there are people who have achieved more than me in the same amount of time.
Main point of this is to illustrate the gains/time ratio. Many plateaus along the way
Bench - 225 x 15-20 reps. 275 x 8-9 reps
Squat - 455 lbs max
Deadlift - Not sure, rarely do them. It is lower than my squat though :(
[IMG]http://i.imgur.com/g601q5N.jpg[/IMG]
[IMG]http://i.imgur.com/wRDksVP.jpg[/IMG]
[IMG]http://i.imgur.com/bxLeZT6.jpg[/IMG]
[IMG]http://i.imgur.com/97YfxvI.jpg[/IMG]
| 0non-cybersec
| Reddit | 259 | 781 |
Coreinfo reports i7-3770 CPU doesn't support EPT (aka SLAT) and VMX. <p>Here is the output I get when I run coreinfo:</p>
<pre><code>Coreinfo v3.05 - Dump information on system CPU and memory topology
Copyright (C) 2008-2012 Mark Russinovich
Sysinternals - www.sysinternals.com
Note: Coreinfo must be executed on a system without a hypervisor running for
accurate results.
Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
HYPERVISOR * Hypervisor is present
VMX - Supports Intel hardware-assisted virtualization
EPT - Supports Intel extended page tables (SLAT)
</code></pre>
<p>According to Intel the CPU does have VMX and EPT support. Why is it not showing up in coreinfo?</p>
| 0non-cybersec
| Stackexchange | 236 | 775 |
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 |
Should an interpolation coincide the original function on the given data points?. <p>Suppose having a model $f(x)=y$ where $f$ is unkown. Moreover, suppose you have some data points for this model i.e. $(x_1,y_1), (x_2,y_2), \dots , (x_n,y_n)$.
If one can find an approximate of $f $ called $\tilde{f}$ using the given data points. </p>
<p>When such aproximation is called interpolation? should the approximation vanish on the given data points in order to be considered as an interpolation ( i.e. $\tilde{f}(x_i)=y_i$ for all $i$) ? Thank you in advance. </p>
| 0non-cybersec
| Stackexchange | 175 | 564 |
Derivative and limit question. <p>Suppose $f$ is differentiable on $[0,\infty)$.
One may write
$$
\frac{f(t)-f(0)}{t-0} = f'(\epsilon)
$$
for $t\in (0,1),\epsilon \in (0,t)$ by the Mean Value Theorem.
I would like to then take the limit as $t\to 0$ (so $\epsilon \to 0$ as well) and say that this equals $f'(0)$.
But I think this would require continuity of the derivative, because we don't know how $\epsilon$ changes.</p>
<p>However, if we just apply the definition of $f$ being differentiable we get
$$
\lim_{t\to 0}\frac{f(t)-f(0)}{t-0} = f'(0)
$$
by definition.</p>
<p>This doesn't feel right to me. I wouldn't think that applying the Mean Value Theorem would lose so much information that I cannot justify the limit anymore.</p>
<p>I there a way to show the limit exists using the Mean Value Theorem like I tried? (Of course using the definition is better, but I just want to know if there is a way to do it with MVT).</p>
| 0non-cybersec
| Stackexchange | 304 | 948 |
Server-side rendering + responsive design + inline styles -> which breakpoint to use?. <p>I have a responsive web application built with ReactJS for which I want one day to support server-side rendering. </p>
<p>According to the viewport size, the application layout/behavior changes. But all these changes can not only be done with plain CSS mediaquery: the JS behavior, and the underlying HTML structure also has to be changed according to the width. </p>
<p>For example I could have:</p>
<p><strong>Under 800px width</strong>:</p>
<pre><code><div class="app">
<div class="menu-mobile">...</div>
<div class="content">...</div>
<div class="mobile-left-menu">...</div>
<div class="footer-mobile">...</div>
</div>
</code></pre>
<p><strong>Above 800px width</strong>:</p>
<pre><code><div class="app">
<div class="menu">...</div>
<div class="main">
<div class="left-menu">...</div>
<div class="content">...</div>
<div class="right-menu">...</div>
</div>
<div class="footer">...</div>
</div>
</code></pre>
<p>Now, I want to use server-side rendering for that application. But on the server I don't have the width, so I don't know which HTML structure to return to the client.</p>
<p>Note that I'm not looking for a solution that use a static default server-side breakpoint, and that on the client correct the app. I am looking for a solution that would return to the client the proper html structure according to its device. So it should work fine if he disables javascript on his browser.</p>
<hr>
<p>One could argue that I could render the html needed for both, and hide/show the required parts with plain CSS mediaqueries and <code>display: none</code>, but it would complicates the app and make it render a lot of unused html elements because generally it's unlikely that the user move above/under the breakpoint (I mean if he has a mobile device, the html elements for desktop will never be used)</p>
<p>Also, if I want to use inline-style, it becomes complicated because I have to render these inline styles for the correct width on the server.</p>
<p>I've <a href="https://github.com/reactjs/react-future/issues/8#issuecomment-53353098" rel="noreferrer">seen</a> some people are thinking about sniffing the browser UA to make an estimated guess of their viewport size. But even with some unsecure screen dimension detection, I'm not sure we can know the device screen orientation on the server-side.</p>
<p>Can I do anything to solve this problem?</p>
| 0non-cybersec
| Stackexchange | 808 | 2,643 |
Declaring strings public static readonly versus public const versus public static const. <p>In each project we have there is a file used to store the various SQL statements used in that project. There are a handful of variations on how the class is declared and how the strings are declared.</p>
<p>Example class declartions:</p>
<pre><code>internal sealed class ClassName
internal static class ClassName
public sealed class ClassName
public static class ClassName
internal class ClassName
</code></pre>
<p>Example string declarations:</p>
<pre><code>internal const string stringName
internal static string stringName
public static readonly string stringName
public static string stringName
public const string stringName
</code></pre>
<p>I don't understand what the performance implications are between the different declarations. Is there a best practice for this situation/scenario? </p>
| 0non-cybersec
| Stackexchange | 204 | 896 |
Does brand/hardware limit the distributions that are safe to run?. <p>I recently tried running Fedora 16 on my laptop and had problems with the fan. In particular, the fan would start, run at full power, and never turn off. I spent a few hours online looking for solutions but didn't find any. I then reverted back to Ubuntu and had the problem disappear (after some minor configuration). </p>
<p>I would really like to try different distributions, but I'm afraid that the hardware on my laptop would not be supported. Is there always a fix to these kinds of problems or should I just stick to what works? </p>
<p>I have a Toshiba Satellite L305-S5945. </p>
| 0non-cybersec
| Stackexchange | 166 | 660 |
I (20) am planning on investing into stocks for retirement. Is this a good idea?. I currently make a dollar above minimum wage in Oklahoma (minimum is $7.25/hr , I'm currently making $8/hr.) It isnt mich, but I want to put small amounts of what I can into stocks via Robinhood, and when my career builds up I am able to invest more. Is this a good idea? I'm only 20 but want to get started on the retirement thingy. Ive heard of w240's if thats what they are called. I don't even think my job offers them because I'm a work-study at the university I go to. What is your advice?
edit: holy cow! didn't expect all these comments! I extremely appreciate the help everyone! Please keep it coming! The more advice the better! | 0non-cybersec
| Reddit | 180 | 721 |
MacBook Pro 2012 HD locks on boot. <p>Today my laptop has started to lock the HD. When booted it either stays black with the fans going nuts or it loads up a dialog to reset pw. In this window I can choose startup disk from the top left menu. The dialog that opens allows me to unlock the HD but the system needs to reboot to use my HD as startup disk. And then it starts all over again...</p>
<p>I've also tried both pram reset, Smc reset and verifying/repairing the HD in disk utility. It still keeps locking the HD when booting up.</p>
<p>Any other suggestions?</p>
| 0non-cybersec
| Stackexchange | 151 | 571 |
Solving PDE with Feynman-Kac Formula. <p>I have the following PDE:</p>
<p>$$\begin{cases}
\left (-\partial_t + \mu x \partial_x + \dfrac{1}{2} \sigma^2 x^2 \partial_x^2 \right )u = -f(t, x)\\
u(0, x) = 0
\end{cases}$$</p>
<p>where $f(t, x) = x^2 \left ( (\mu + \sigma^2 ) e^{\mu t} - \left (\mu + \frac{1}{2}\sigma^2\right )\right )$.</p>
<p>Since $\mu x \partial_x + \dfrac{1}{2} \sigma^2 x^2 \partial_x^2$ is the infinitesimal generator of a Geometric Brownian Motion with drift $\mu$ and volatility $\sigma$, by Feynman-Kac the solution should be given by:</p>
<p>$$u(t, x) = \mathbb{E}^x \left (\int_0^t f(s, X_s)dx\right )$$</p>
<p>where $X$ has dynamics</p>
<p>$$dX_t = \mu X_t dt + \sigma X_t dW_t.$$</p>
<p>I know that the exact solution should be $u(t, x) = \frac{1}{2} x^2 \left ( e^{(2\mu + \sigma^2) t} - 2e^{\mu t} + 1\right )$. However, when I try to compute the solution using Feynman-Kac, I get:</p>
<p>$$u(t, x) = \int_0^t \mathbb{E}^x (f(s, X_s))ds = \int_0^t x^2 e^{(2\mu + \sigma^2) s}\left ( (\mu + \sigma^2 ) e^{\mu s} - \left (\mu + \frac{1}{2}\sigma^2\right )\right ) ds$$ which doesn't agree with the above solution.</p>
<p>What am I doing wrong?</p>
| 0non-cybersec
| Stackexchange | 521 | 1,185 |
Stop Postfix sending email to [email protected]. <p>I configured a Postfix server in Ubuntu as satellite system to forward emails to an Exchange server.</p>
<p>When I try to do <code>sudo -i</code> with a user that is not part of the <code>sudoers</code> group the incident is reporting sending an email. (I think using Postfix)</p>
<p>On Exchange queue viewer I saw undelivered messages to an address <code>[email protected]</code> with the security incident report. That email does not exists. I changed <code>/etc/mailname</code> to use <code>domain.com</code> but then in Postfix's logs <code>/var/log/mail.log</code> I saw an email going to <code>[email protected]</code>.</p>
<p>After the setup, I ran the </p>
<pre><code>newaliases
service postfix restart
</code></pre>
<p>My goal is to setup that postfix send the incident report to <code>[email protected]</code> instead of <code>[email protected]</code> or <code>[email protected]</code> </p>
<p><strong>Note:</strong> I am currently sending email in multiple PHP scripts going to <code>[email protected]</code> and everything works fine.</p>
<pre><code>hostname -f
ns.domain.local
cat /etc/hosts
127.0.0.1 ns.domain.local ns localhost
192.168.1.3 ns.domain.local ns
cat /etc/hostname
ns
cat /root/.forward
[email protected]
cat /etc/aliases
postmaster: root
root: [email protected]
cat /etc/mailname
domain.local
cat /etc/postfix/main.cf
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
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_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = ns.domain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = ns.domain.local, localhost.domain.local, localhost,
relayhost = 192.168.1.2 #(EXCHANGE_IP_ADDRESS)
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
inet_protocols = ipv4
</code></pre>
<p>Thank you for any help.</p>
| 0non-cybersec
| Stackexchange | 833 | 2,395 |
Conencting local machine to remote Domain. <p>I'm currently trying to connect my local machine remotely to my server in the office. The objective is to set this machine up as a domain oppose to workstation so it acts the same as if it was in the office.</p>
<p>I've established a successful VPN to the Server with no problems. I tried connecting to the domain using xyz.local however it couldn't find it.</p>
<p>I've then amended the ipv4 settings for the VPN for which the primary and secondary DNS are pointing to what the server gives out. Still no luck. </p>
<p>I've also noticed using <strong>ipconfig /all</strong> the default gateway is 0.0.0.0 ? </p>
<p>I tried disabling the WIFI adapter but that disconnects everything.</p>
<p>Any suggestions?</p>
| 0non-cybersec
| Stackexchange | 208 | 763 |
Good resources for example process definitions of software development methodologies?. <p>Is there any website specifically for sharing and accessing actual software development processes implemented in software organizations? </p>
<p>There are lots of resources that give advices and descriptions for implementing these processes. They are very useful. But I think having actual example process definitions would be very useful as well. Specifically, I am now looking for an example process definition in CMMI. I overviewed several books but none of them presents any specific example implementation. </p>
<p>I think the authors are probably concerned that the readers might just copy these process definitions without understanding specific customization decisions in them. They are very rightful in this concern. But anyway, I think this is an important need for general software community. Understanding and interpreting an example document properly should be the responsibility of the reader. </p>
<p>If you don't know any good resource that shares specific implementations of the processes, what do you think about this need? Don't you think that we, software engineers and developers, should share our process definitions as we share our code?</p>
| 0non-cybersec
| Stackexchange | 239 | 1,258 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
NETSH - How to import WIFI profile when WIFI NIC is not present. <p>I'm currently in process of creating standardised Winndows 10 image for kisok PC.</p>
<p>Now the problem I'm facing is that during install, when I try to preload WIFI profile using <code>netsh wlan add profile file=C:\wifi.xml user=all</code>, I get the error stating that <code>There is no wireless interface on the system</code>. Now the error itself makes sense, since USB WIFI adapter is physically not yet connected to the PC (we connect adapters to the PCs when they are mounted into kisok stand, OS install is done way beforehand).</p>
<p>I've already tried adding <em>fake</em> WIFI adapter using "Add legacy hardware" option in device manager, but unfortunately that didn't fool netsh into thinking that WIFI is present. </p>
<p>Is there any way other way I can preload WIFI profile into my image when there is no WIFI adpater connected or trick that would convince netsh that WIFI card is present when actually it is not? Maybe using WISM or some other tool?</p>
| 0non-cybersec
| Stackexchange | 284 | 1,044 |
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 |
Animate scroll to ID on page load. <p>Im tring to animate the scroll to a particular ID on page load. I have done lots of research and came across this:</p>
<pre><code>$("html, body").animate({ scrollTop: $('#title1').height() }, 1000);
</code></pre>
<p>but this seems to start from the ID and animate to the top of the page?</p>
<p>The HTML (which is half way down the page) is simply:</p>
<pre><code><h2 id="title1">Title here</h2>
</code></pre>
| 0non-cybersec
| Stackexchange | 156 | 464 |
WPF: How to reference other controls within trigger Property property?. <p>I have a WPF page. Page has some content, but the last child component of page's root layout is a user control that I have created. It looks like this: </p>
<pre><code><UserControl DataContext=UserControlViewModel>
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="visibilityConverter" />
</UserControl.Resources>
<Grid
Name="grid"
Visibility="{Binding IsOn, Converter={StaticResource visibilityConverter}}">
<!-- Border to dim everything behind my user control -->
<Border Background="#000000" Opacity="0.4" />
<!-- The following border is red and holds the content -->
<Border
Width="{Binding ElementName=txt, Path=ActualWidth}"
Height="{Binding ElementName=txt, Path=ActualHeight}"
Margin="{Binding ElementName=txt, Path=Margin}"
HorizontalAlignment="{Binding ElementName=txt, Path=HorizontalAlignment}"
VerticalAlignment="{Binding ElementName=txt, Path=VerticalAlignment}"
Background="Red">
<TextBlock
Name="txt"
Width="200"
Height="100"
Margin="20"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="This is my super awesome message!" />
</Border>
</Grid>
</UserControl>
</code></pre>
<p>By default, the <code>IsOn</code> property of the <code>UserControlViewModel</code> object is set to <code>false</code>, i.e. the user control is not visible. I have implemented some logic that changes this property to <code>true</code> and then the user control is displayed in front of all other components which are dimmed. This works well. </p>
<p>Now, I want to create a fade effect animation which would dim the components that are behind the user control once it becomes visible. Next, I want to make my red border that holds the content to fade in from the left hand side, so moving + fade. </p>
<p>Let's start with the fade effect first. I wrote this style to the <code>Border</code> that is supposed to do the dimming of background components: </p>
<pre><code><UserControl DataContext=UserControlViewModel>
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="visibilityConverter" />
</UserControl.Resources>
<Grid
Name="grid"
Visibility="{Binding IsOn, Converter={StaticResource visibilityConverter}}">
<!-- Border to dim everything behind my user control -->
<Border Background="#000000" Opacity="0.4">
<!-- The following style is new code -->
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="{Binding ElementName=grid, Visibility}" Value="Visible">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetProperty="Opacity"
From="0.0"
To="0.4"
Duration="0:0:1" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
</Border>
...
</code></pre>
<p>But there's the problem: I cannot set the binding on the trigger <code>Property</code>, because it is not a dependency property. I need a way to tell my trigger to fire once the <code>grid</code> has got the <code>Visibility</code> property set to <code>Visible</code>. Please help and thank you!</p>
<p>Second problem is, I don't know how to do the moving of the red border, so I need help around some scale transformations as well, I guess... Thanks once again!</p>
| 0non-cybersec
| Stackexchange | 1,109 | 3,991 |
I really don't want to become an alcoholic.. Guess I'll just get to the point: I want to be the drunk me. Always. In any sort of social situation, drunk me is objectively a better person. Confident, an extrovert, quick witted with jokes, can't dance too well but *has the fucking confidence to just go and do it anyways.*
I'm also a broke university student for the most part. Sometimes I find web design gigs to do. Mostly I live on a shitty diet, though, to save cash. Lately I've been spending nearly all of my income on vodka. I buy vodka specifically because I only want to become drunk and nothing else is really important to me. I need to be drunk to feel like I'm worth anything. The only situation in which not being drunk is worth it is when I'm doing maths or programming, I just can't do those activities productively when drunk. Other than that, sober me is an awkward, useless mess who will say no to everything.
Don't really know what to do once my balance hits 0. Binge drinking gets expensive. Hiding not being sober can get pretty difficult. I usually need to drive somewhere at least twice a day.
At least I don't really have people who depend on me; just vice versa. If something were to happen then I don't think it'd be all that dramatically bad. But yeah. I want to be constantly and permanently drunk because it makes me an objectively better person, but it's expensive and I can't afford this lifestyle for too much longer. Shit sucks. | 0non-cybersec
| Reddit | 340 | 1,463 |
Why doesn't my if statement work?. <p>I'm debugging on android, and I have the following code. The <code>istrue</code> variable has the value <code>true</code>, but it seems that the <code>if</code> condition doesn't work.</p>
<pre><code>String ok = objRestMan.getMensaje();
boolean istrue = ok.equals("ok");
if(istrue){
return antenaInformation;
}else{
return null;
}
</code></pre>
<p>As you can see in the next image, the <code>istrue</code> variable is <code>true</code>, but the if condition always takes the route else and returns <code>null</code>.</p>
<p><a href="https://i.stack.imgur.com/EfdgG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EfdgG.png" alt="enter image description here"></a></p>
| 0non-cybersec
| Stackexchange | 248 | 740 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
Will getting a cat make my dog more "tolerant" of cats?. I have a mixed [Rhodesian Ridgeback](http://i.imgur.com/0tyUV.jpg), and I love her.
It's just that she has a really strong hunt drive which makes her go mental at the sight of cats. I have been training her and she is very obedient but cats are still an obstacle.
I can handle her, but I'm afraid other house members might have a harder time or that one day she will make a wrong identificatio (cat vs small child, almost happened once).
I don't like cats all that much (nil to none), but I have herd of a breed, [Pixie-Bob](http://en.wikipedia.org/wiki/Pixie-bob) that should have very convenient (dog like) characteristics and I don't mind getting one if it will ease her up.
TL;DL: Will getting a cat ease my dog up when seeing other cats?
Edit: For people who want the answer but skip the reading:
1. High prey drive doesn't go away, the dog was born with that instinct and getting a cat would (if they get along) probably only make the dog tolerant of that specific cat
2. Forcing a relationship between the dog and the cat (if they don't get a long or when trying to get them to get along) might might end up badly (usually for the dog's eye).
3. More specific for people who don't fancy cats: a cat is a long term commitment, getting one to serve a purpose rather then actually wanting one would be a bad idea (abandonment, which is bad mmkay).
Thank you all for sharing! | 0non-cybersec
| Reddit | 382 | 1,461 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
Redbean O/RM store "date" as varchar(255)?. <p>From this code:</p>
<pre><code>$toolbox = RedBean_Setup::kickstartDev("mysql:*****************");
$r = $toolbox->getRedBean();
$test = $r->dispense("test");
$test->nom = 'Test #1';
$test->date = '2010-07-08';
$test->date_deux = '08/07/2010';
$test->num = 5;
$id = $r->store( $test );
</code></pre>
<p>I get this SQL:</p>
<pre><code>CREATE TABLE IF NOT EXISTS `test` (
`id` int(11) unsigned NOT NULL auto_increment,
`nom` varchar(255) collate utf8_unicode_ci default NULL,
`date` varchar(255) collate utf8_unicode_ci default NULL,
`num` tinyint(3) unsigned default NULL,
`date_deux` varchar(255) collate utf8_unicode_ci default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=6 ;
--
-- Dumping data for table `test`
--
INSERT INTO `test` (`id`, `nom`, `date`, `num`, `date_deux`) VALUES
(1, 'Test #1', '2010-07-08', NULL, NULL),
(2, 'Test #1', '2010-07-08', 5, NULL),
(3, 'Test #1', '2010-07-08', 5, '08/07/2010'),
(4, 'Test #1', '2010-07-08', 5, '08/07/2010'),
(5, 'Test #1', '2010-07-08', 5, '08/07/2010');
</code></pre>
<p>is there a special way to use <code>date</code> with RedBean?</p>
| 0non-cybersec
| Stackexchange | 524 | 1,246 |
Utility method - Pass a File or String?. <p>Here's an example of a utility method:</p>
<pre><code>public static Long getFileSize(String fileString) {
File file = new File(fileString);
if (file == null || !file.isFile())
return null;
return file.length();
}
</code></pre>
<p>Is it a good practise to pass a String rather than a File to a method like this? In general what reasoning should be applied when making utility methods of this style?</p>
| 0non-cybersec
| Stackexchange | 134 | 471 |
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 |
Unable to use proxy with puppeteer. Error: ERR_NO_SUPPORTED_PROXIES gets thrown. <p>How to set up a proxy with puppeteer? I tried the following:</p>
<pre><code>(async () => {
const browser = await puppeteer.launch({
headless: false,
args: [
'--proxy-server=http://username:[email protected]:22225'
]
});
const page = await browser.newPage();
await page.goto('https://www.whatismyip.com/');
await page.screenshot({ path: 'example.png' });
//await browser.close();
})();
</code></pre>
<p>But it does not work and I get the message:</p>
<pre><code>Error: net::ERR_NO_SUPPORTED_PROXIES at https://www.whatismyip.com/
</code></pre>
<p>on the console. How to use the proxy correctly? </p>
<p>I also tried the following:</p>
<pre><code>const browser = await puppeteer.launch({
headless: false,
args: [
'--proxy-server=zproxy.luminati.io:22225'
]
});
const page = await browser.newPage();
page.authenticate({
username: 'username',
password: 'password'
})
await page.goto('https://www.whatismyip.com/');
</code></pre>
<p>but the same result.</p>
| 0non-cybersec
| Stackexchange | 396 | 1,181 |
Apple Push Notifications in Bulk. <p>I have an app that involves sending Apple Push Notifications to ~1M users periodically. The setup for doing so has been built and tested for small numbers of notifications. Since there is no way I can test sending at that scale, I am interested in knowing whether there are any gotchas in sending bulk push notifications. I have scripts written in Python that open a single connection to the push server and send all notifications over that connection. Apple recommends keeping it open for as long as possible. But I have also seen that the connection terminates and you need to reestablish it. </p>
<p>All in all, it is disconcerting that successful sends are not acknowledged, only erroneous ones are flagged. From a programmer's standpoint instead of simply checking one thing "if (success)" you now need to watch for numerous things that could go wrong.</p>
<p>My question is: What are the typical set of errors that you need to watch out for to make sure your messages don't silently disappear into oblivion? The connection closing is an easy one. Are there others?</p>
| 0non-cybersec
| Stackexchange | 245 | 1,114 |
Prove that A',B',C' are in a straight line.. <p><a href="https://i.stack.imgur.com/lLnJF.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lLnJF.jpg" alt="Question Image"></a></p>
<p>Be an ABC triangle and a point P of your plane. The perpendiculars to PA, PB and PC, traced by P, intersect the BC, CA and AB sides at three points, A ', B' and C '. Prove that these points are in a straight line.</p>
<p>Can someone explain me how to do this question?
I just found that
<span class="math-container">$\angle APB'=\angle A'PB\\
\angle B'PC=\angle BPC'$</span>
My first idea was to use Analytic Geometry, but I don't know what I have to do...
Thanks for antetion.
If someone has a solution by eucliidean geometry, I will love it!</p>
| 0non-cybersec
| Stackexchange | 257 | 763 |
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 |
getting this error " $.toJSON is not a function ". <p>I'm trying to use jQuery and Ajax and I use this method. but I get the error $.toJSON is not a function in my firebug . where is the problem? I use jquery 1.3.2 . thanks </p>
<pre><code> $(document).ready(function () {
$("#S1").click(function
() {
$("#t1").slideToggle("fast");
$("#S1").css("background-color", "yellow");
var ID = $("#HiddenField2").attr("Value");
var params = new Object();
params.Key = ID;
$.ajax({
type: "POST",
url: "viewMessages.aspx/readen",
data: $.toJSON(params),
contentType: "application/json",
dataType: "json",
success: function () {
}
});
});
});
</code></pre>
| 0non-cybersec
| Stackexchange | 238 | 887 |
Scientific soundness of computer science papers. <p>First of all, this question relates to an issue that affects several areas of science, but since StackExchange doesn't have a meta science section I'll make it specific to computer science, which is pertinent because the solution to the bigger problem may actually come from computer science.</p>
<p>In the context of the news that <a href="http://retractionwatch.com/2014/02/24/springer-ieee-withdrawing-more-than-120-nonsense-papers" rel="nofollow">Springer and IEEE published more than 120 nonsense papers</a> my question is as follows:</p>
<p>What rigourous set of methods can we apply to the process of publishing scientific papers so that we can quickly verify the reproducibility of the experiments?</p>
<p>We already have systems like <a href="http://turnitin.com/" rel="nofollow">Turnitin</a> that are highly efficient at detecting plagiarism, yet I don't know of any system that can score a piece of work on its <em>scientific soundness</em>.</p>
<p>Is there any ongoing work related to this? I found out about <a href="https://en.wikipedia.org/wiki/Semantic_publishing" rel="nofollow">Semantic Publishing</a> whilst composing this question, but I have no idea what other approaches, if any, are being actively worked on.</p>
| 0non-cybersec
| Stackexchange | 331 | 1,292 |
What's the file format of "application/x-executable". <p>No no no no. I can run the file. My favorite game is that file format and I can run it just fine. Same as other programs with it. My question is what the file format of it? You know. Things like <code>.sh</code>, or <code>.exe</code>, <code>.txt</code>, <code>.rar</code>, etc, etc. So, if you know just tell me.</p>
<p>So you know, the question isn’t about the game. It’s about the file format. The question has nothing to do about the game. And I already figured out about the file format. It’s <code>.86_64</code>. I didn’t notice the answer that was posted to this question so I had to figure it out myself. For anyone who is reading this now, I will close this question soon.</p>
| 0non-cybersec
| Stackexchange | 217 | 757 |
How do you call a cffunction in a cfc from another cfm page using cfscript?. <p>I have a <code>test.cfm</code> page and would like to call a cfc with a <code><cffunction></code> named <code>errorEmail</code> using <code><cfscript></code> from that page (test.cfm) instead of </p>
<pre><code><cfinvoke component = "#cfcPath#" method = "errorEmail" returnVariable = "myReturn"
description = "get list of projman">
</cfinvoke>
</code></pre>
<p>I have tried: </p>
<pre><code><cfscript>
errorEmail(cfcPath);
</cfscript>
</code></pre>
| 0non-cybersec
| Stackexchange | 214 | 578 |
My program's notifyicon get duplicated when using Form.Show() to call a preloader form. <p><strong>EDIT:</strong> Silly me. My preloader actually shows up all the time even with simple <code>Loading.Show();</code> but it just was below my web browser. I already posted a solution below. Please check it up if you interested.</p>
<p>My program has no form but shows as a notifyicon in the notification area (My main form is actually hidden to use as dummy form for notifyicon and other controls). It run by getting called from web browser using URI scheme (<code>tkh</code>). If my program is already running and user called it from browser, it will do things according to its argument. For example, if an user called it with <code>tkh:readCard</code>, my program will do stuff in <code>readCard</code> function.</p>
<p>Here's my code for reading argument from URI scheme</p>
<pre><code>public string CommandLine { get; set; }
public bool CheckForProtocolMessage(Uri uri)
{
if (uri.ToString().Length > 1)
{
string[] args = uri.ToString().Split(':');
CommandLine = args[1];
if (args[0].Trim().ToUpper() == "TKH" && args.Length > 1)
{
if (args[1].Length > 1)
{
switch (args[1].Trim().ToUpper())
{
case "READCARD":
if (hasCardReader == true)
{
var bw_readCard = new BackgroundWorker { WorkerReportsProgress = true };
bw_readCard.DoWork += delegate
{
preloaderShow();
readCard();
preloaderClose();
};
bw_readCard.ProgressChanged += delegate { };
bw_readCard.RunWorkerCompleted += delegate { };
bw_readCard.RunWorkerAsync();
bw_readCard.Dispose();
return true;
}
else
{
MessageBox.Show("Try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
case "READCARD_IDONLY":
if (hasCardReader == true)
{
var bw_readCard_IDOnly = new BackgroundWorker { WorkerReportsProgress = true };
bw_readCard_IDOnly.DoWork += delegate
{
preloaderShow();
readCard_IDonly();
preloaderClose();
};
bw_readCard_IDOnly.ProgressChanged += delegate { };
bw_readCard_IDOnly.RunWorkerCompleted += delegate { };
bw_readCard_IDOnly.RunWorkerAsync();
bw_readCard_IDOnly.Dispose();
return true;
}
else
{
MessageBox.Show("Try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
}
}
}
}
return false;
}
</code></pre>
<p><code>preloaderShow();</code> and <code>preloaderClose();</code> are for show and close a preloader form. (My preloader form named "Loading")</p>
<p>Here's the <code>preloaderShow();</code> function</p>
<pre><code>private void preloaderShow()
{
Loading Loading = new Loading();
Loading.Show();
}
</code></pre>
<p>and the <code>preloaderClose();</code> function</p>
<pre><code> private void preloaderClose()
{
Loading Loading = new Loading();
Application.OpenForms
.OfType<Form>()
.Where(form => String.Equals(form.Name, "Loading"))
.ToList()
.ForEach(form => form.Close());
}
</code></pre>
<p>My problem is if the program isn't running, the preloader shows up and do stuff normally. But if it already running, the preloader won't show up but stuff in <code>readCard();</code> and <code>readCard_IDOnly();</code> works normally.</p>
<p>If I change my preloaderShow(); like this,</p>
<pre><code>private void preloaderShow()
{
Loading Loading = new Loading();
Form1 Form1 = new Form1(); // Declared this even without put Form1 into .Show() also make the program's notifyicon duplicate.
Loading.Show(Form1);
}
</code></pre>
<p>the preloader will show up and the notifyicon get duplicated Like below </p>
<p><a href="https://i.stack.imgur.com/otuVK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/otuVK.png" alt="but notifyicon will duplicated and cannot be closed"></a></p>
<p>I will need to close down "main" notifyicon to make it all gone.</p>
<p>What do I need to do? Thanks.</p>
| 0non-cybersec
| Stackexchange | 1,326 | 5,779 |
Raising exception in a generator, handle it elsewhere and vice versa in python. <p>I'm thinking in a direction more advanced as well as difficult to find solutions this problem. Before coming to any decision, I thought of asking expert advice to address this problem. </p>
<p>The enhanced generators have new methods .send() and .throw() that allow the caller to pass messages or to raise exceptions <em>into</em> the generator (coroutine).</p>
<p>From python documentation: This can be very handy, especially the .throw() method that requests the generator to handle exceptions raised in the caller. </p>
<p><strong>Request #1: Any example code for the above statement. I didn't find any code snippets for this explanation.</strong></p>
<p>However, I'm considering the inverse problem as well: can a generator raise an exception, pass it to the caller, let the caller "repair" it, and continue the generator's own execution? That is what I would like to call a "reverse throw".</p>
<p><strong>Request #2: Any example code for the above statement. I didn't find any code snippets for this explanation.</strong></p>
<p>Simply raising exceptions in the generator is not OK. I tried "raise SomeException" in the generator, and that didn't work, because after a "raise" the generator can no longer be executed --- it simply stops, and further attempts to run the generator cause the StopIteration exception. In other words, "raise" is much more deadly than "yield": one can resume itself after yielding to the caller but a "raise" sends itself to the dead end.</p>
<p>I wonder if there are simple ways to do the "reverse throw" in Python? That will enable us to write coroutines that cooperate by throwing exceptions at each other. But why use exceptions? Well, I dunno... it all began as some rough idea.</p>
<p>CASE STUDY CODE:</p>
<pre><code>class MyException(Exception):pass
def handleError(func):
''' handle an error'''
errors =[]
def wrapper(arg1):
result = func(arg1)
for err in findError(result):
errors.append(err)
print errors
return result
return wrapper
def findError(result):
'''
Find an error if any
'''
print result
for k, v in result.iteritems():
error_nr = v % 2
if error_nr ==0:
pass
elif error_nr > 0:
yield MyException
@handleError
def numGen(input):
''' This function take the input and generates 10 random numbers. 10 random numbers are saved in result dictionary with indices. Find error decorator is called based on the result dictionary'''
from random import randint
result= {}
errors = []
for i in range(9):
j = (randint(0,4))
result[i] = input + j
return result
if __name__ == '__main__':
numGen(4)
</code></pre>
<p>Could anyone explain please both the ideas based on case study example(Raising exception in a generator and handle it elsewhere vice versa)? I do expect pro's and con's of both methods.</p>
<p>Thanks in advance.</p>
<p>Looking for an answer drawing from credible and/or official sources.</p>
| 0non-cybersec
| Stackexchange | 804 | 3,108 |
CLAMAV on Centos Mail Server: Can't connect to UNIX socket clamd.sock. <p>In my Centos 6.4 server, I am using Postfix and Dovecot with Amavis/ClamAV filter. Lately I have been trying to solve my spam problem(only occurs in Gmail and Hotmail) so I've been tailing logs. </p>
<p>Though I can send and receive e-mails, I have realized that Clamav causes error in /var/log/maillog so I think perhaps it can help my spam problem if I can solve this error. </p>
<p>That's the main error, I think the rest of the process goes allright.</p>
<pre><code>(!)connect to /var/run/clamav/clamd.sock failed, attempt #1: Can't connect to UNIX socket /var/run/clamav/clamd.sock: No such file or directory
</code></pre>
<p>Test information:</p>
<pre><code>XX.XX.XX.XX: Sender Client IP (This time Thunderbird)
YY.YY.YY.YY: My mail server IP
[email protected]: Sender address
[email protected]: Receiver address (This time Gmail)
</code></pre>
<p>When I send an e-mail from a mail account in my server, Here's how /var/log/maillog looks: </p>
<pre><code>postfix[3422]: warning: XX.XX.XX.XX: hostname XX.XX.XX.XX.static.ttnet.com.tr verification failed: Name or service not known
postfix[3422]: connect from unknown[XX.XX.XX.XX]
postfix[3422]: setting up TLS connection from unknown[XX.XX.XX.XX]
postfix[3422]: Anonymous TLS connection established from unknown[XX.XX.XX.XX]: TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)
postfix[3422]: D894AC1E61: client=unknown[XX.XX.XX.XX], sasl_method=PLAIN, [email protected]
postfix/cleanup[3429]: D894AC1E61: message-id=<[email protected]>
postfix/qmgr[1310]: D894AC1E61: from=<[email protected]>, size=862, nrcpt=1 (queue active)
amavis[3326]: (03326-01) ESMTP::10024 /var/amavis/tmp/amavis-20131030T102202-03326-IY7b8Pdi: <[email protected]> -> <[email protected]> SIZE=862 Received: from host.mydomain.com ([127.0.0.1]) by localhost (mydomain.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP for <[email protected]>; Wed, 30 Oct 2013 10:22:02 +0000 (UTC)
amavis[3326]: (03326-01) Checking: MemHkAhbAuqt [XX.XX.XX.XX] <[email protected]> -> <[email protected]>
amavis[3326]: (03326-01) Open relay? Nonlocal recips but not originating: [email protected]
amavis[3326]: (03326-01) (!)connect to /var/run/clamav/clamd.sock failed, attempt #1: Can't connect to UNIX socket /var/run/clamav/clamd.sock: 2
amavis[3326]: (03326-01) ClamAV-clamd: All attempts (1) failed connecting to /var/run/clamav/clamd.sock, retrying (1)
postfix[3422]: disconnect from unknown[XX.XX.XX.XX]
amavis[3326]: (03326-01) (!)connect to /var/run/clamav/clamd.sock failed, attempt #1: Can't connect to UNIX socket /var/run/clamav/clamd.sock: No such file or directory
amavis[3326]: (03326-01) (!)ClamAV-clamd: All attempts (1) failed connecting to /var/run/clamav/clamd.sock, retrying (2)
amavis[3326]: (03326-01) (!)connect to /var/run/clamav/clamd.sock failed, attempt #1: Can't connect to UNIX socket /var/run/clamav/clamd.sock: No such file or directory
amavis[3326]: (03326-01) (!)ClamAV-clamd av-scanner FAILED: run_av error: Too many retries to talk to /var/run/clamav/clamd.sock (All attempts (1) failed connecting to /var/run/clamav/clamd.sock) at (eval 113) line 600.\n
amavis[3326]: (03326-01) (!)WARN: all primary virus scanners failed, considering backups
postfix[3433]: connect from unknown[127.0.0.1]
postfix[3433]: E52C1C1E71: client=unknown[127.0.0.1]
postfix/cleanup[3429]: E52C1C1E71: message-id=<[email protected]>
postfix/qmgr[1310]: E52C1C1E71: from=<[email protected]>, size=1279, nrcpt=1 (queue active)
amavis[3326]: (03326-01) FWD from <[email protected]> -> <[email protected]>,BODY=7BIT 250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as E52C1C1E71
amavis[3326]: (03326-01) Passed CLEAN {RelayedOpenRelay}, [XX.XX.XX.XX]:33926 [XX.XX.XX.XX] <[email protected]> -> <[email protected]>, Message-ID: <[email protected]>, mail_id: MemHkAhbAuqt, Hits: 0.106, size: 862, queued_as: E52C1C1E71, 14736 ms
postfix/smtp[3430]: D894AC1E61: to=<[email protected]>, relay=127.0.0.1[127.0.0.1]:10024, delay=15, delays=0.53/0.01/0.01/15, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as E52C1C1E71)
postfix/qmgr[1310]: D894AC1E61: removed
amavis[3326]: (03326-01) extra modules loaded: unicore/lib/gc_sc/Digit.pl, unicore/lib/gc_sc/SpacePer.pl
postfix/smtp[3436]: E52C1C1E71: to=<[email protected]>, relay=gmail-smtp-in.l.google.com[74.125.142.27]:25, delay=1.2, delays=0.01/0.02/0.68/0.5, dsn=2.0.0, status=sent (250 2.0.0 OK 1383128540 x12si3704513igx.15 - gsmtp)
postfix/qmgr[1310]: E52C1C1E71: removed
dovecot: imap-login: Login: user=<[email protected]>, method=PLAIN, rip=::1, lip=::1, mpid=3439, secured
dovecot: imap([email protected]): Disconnected: Logged out bytes=90/777
</code></pre>
<p>And here's the source code of received mail in Gmail:</p>
<pre><code>Delivered-To: [email protected]
Received: by 10.68.54.102 with SMTP id i6csp217498pbp;
Wed, 30 Oct 2013 03:22:20 -0700 (PDT)
X-Received: by 10.50.6.99 with SMTP id z3mr1702938igz.27.1383128540254;
Wed, 30 Oct 2013 03:22:20 -0700 (PDT)
Return-Path: <[email protected]>
Received: from host.mydomain.com (mydomain.com. [YY.YY.YY.YY])
by mx.google.com with ESMTPS id x12si3704513igx.15.2013.10.30.03.22.19
for <[email protected]>
(version=TLSv1 cipher=RC4-SHA bits=128/128);
Wed, 30 Oct 2013 03:22:20 -0700 (PDT)
Received-SPF: pass (google.com: domain of [email protected] designates YY.YY.YY.YY as permitted sender) client-ip=YY.YY.YY.YY;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of [email protected] designates YY.YY.YY.YY as permitted sender) [email protected]
Received: from localhost (unknown [127.0.0.1])
by host.mydomain.com (Postfix) with ESMTP id E52C1C1E71
for <[email protected]>; Wed, 30 Oct 2013 10:22:16 +0000 (UTC)
X-Virus-Scanned: amavisd-new at mydomain.com
Received: from host.mydomain.com ([127.0.0.1])
by localhost (mydomain.com [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id MemHkAhbAuqt for <[email protected]>;
Wed, 30 Oct 2013 10:22:02 +0000 (UTC)
Received: from [192.168.2.15] (unknown [XX.XX.XX.XX])
(using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits))
(No client certificate requested)
by host.mydomain.com (Postfix) with ESMTPSA id D894AC1E61
for <[email protected]>; Wed, 30 Oct 2013 10:22:01 +0000 (UTC)
Message-ID: <[email protected]>
Date: Wed, 30 Oct 2013 12:21:47 +0200
From: mydomain Development Base <[email protected]>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0
MIME-Version: 1.0
To: [email protected]
Subject: That's the mail
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<font face="Helvetica, Arial, sans-serif">What's up?</font>
</body>
</html>
</code></pre>
<p>Though it all seems fine and have scanned by amavisd-new, it goes to spam. I don't necessarily ask why but if it's related to not being scanned correctly, I need to fix this issue. </p>
<p>And here's how I use CLAMAV in /etc/amavisd.conf file:</p>
<pre><code>['ClamAV-clamd',
\&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd.sock"],
qr/\bOK$/m, qr/\bFOUND$/m,
qr/^.*?: (?!Infected Archive)(.*) FOUND$/m ],
</code></pre>
<p>The file clamd.sock is not exist under /var/run/clamav/ dir, and this dir is chowned by clamav user and group (the service doesn't start when it's not). I don't know if it's a dynamic file that is being created and deleted on runtime but I don't think there's any issue with permissions, perhaps some process or service is missing to create the file. </p>
<p>Any ideas? Thanks in advance.</p>
| 0non-cybersec
| Stackexchange | 3,268 | 8,205 |
How to create custom section titles with a "<title> <number>" format in ConTeXt?. <p>I am making a book, with chapters titled "Week 1", "Week 2", "Week 3", etc., and sections titled "Activity 1", "Activity 2", "Activity 3", etc., and other sections titled "Presentation 1", "Presentation 2", "Presentation 3", etc.</p>
<ul>
<li>The preceding numbers, e.g. "1.1 Activity 1", are not used.</li>
<li>No other text, e.g. "Week 1 Topic" appears in the text.</li>
<li>The numbers for sections never reset.</li>
</ul>
<p>Here is a sample table of contents, showing how I hope it will appear:</p>
<pre><code> ______________________
| |
| Contents |
| |
| Week 1 |
| Activity 1 |
| Activity 2 |
| Presentation 1 |
| Week 2 |
| Activity 3 |
| Activity 4 |
| Presentation 2 |
|______________________|
</code></pre>
<p>The document occassionally has other orginary chapter and section titles as well. These should get the same font formatting, but otherwise, not be modified, and appear without any number, e.g., using chapter titles "Forward", "Conclusion", and a section title called "Notes":</p>
<pre><code> ______________________
| |
| Contents |
| |
| Forward |
| Week 1 |
| Activity 1 |
| Activity 2 |
| Presentation 1 |
| Week 2 |
| Activity 3 |
| Notes |
| Conclusion |
|______________________|
</code></pre>
<p>I have tried my own solution, by removing the preceding numbers using <code>\setuphead[chapter][number=no]</code>, creating counters, e.g. <code>\definenumber[weekcount]</code>, then defining custom macros which call for chapter titles to use these counters, however, my solution does not work:</p>
<pre><code>\definenumber[weekcount]
\definenumber[activitycount]
\definenumber[presentationcount]
\setnumber[weekcount]{1}
\setnumber[activitycount]{1}
\setnumber[presentationcount]{1}
\define\week{\chapter{Week~\getnumber[weekcount]}\incrementnumber[weekcount]}
\define\activity{\section{Activity~\getnumber[activitycount]}\incrementnumber[activitycount]}
\define\presentation{\section{Presentation~\getnumber[presentationcount]}\incrementnumber[presentationcount]}
\setuphead[chapter][number=no]
\setuphead[section][number=no]
\starttext
\week
\activity
This is some text.
\activity
This is some text.
\presentation
This is some text.
\week
\activity
This is some more text.
\activity
This is some more text.
\presentation
This is some more text.
\stoptext
</code></pre>
<p>This results in this:</p>
<pre><code> ______________________
| |
| Contents |
| |
| Week |
| Activity |
| Activity 1 |
| Presentation |
| Week |
| Activity |
| Activity 1 |
| Presentation |
|______________________|
</code></pre>
<p>If you remove <code>\setuphead[chapter][number=no]</code>, results are also unusual:</p>
<pre><code> ______________________
| |
| Contents |
| |
| 1. Week 1. |
| 1.1 Activity 1. |
| 1.2 Activity 1.1 |
| 1.2 Presentation 1. |
| 2. Week 2. |
| 2.1 Activity 2 |
| 2.2 Activity 2.1 |
| 2.3 Presentation 2. |
|______________________|
</code></pre>
<ul>
<li>Why is the numbering of the counters appear in this manner, when used inside section titles?</li>
<li>How can I create custom chapter titles using a "Week " format, and similarly formatted section titles?</li>
</ul>
| 0non-cybersec
| Stackexchange | 1,081 | 3,880 |
Continuity of an extended rate of variation?. <p>Let $f:\mathbb R\to \mathbb R$ be a $C^1$ function. </p>
<blockquote>
<p>Then Prove or disprove that $g:\mathbb R^2\to \mathbb R$ define by
$$g(x,y) = \begin{cases}\frac{f(x)-f(y)}{x-y}&\text{if $x\neq y$}\\
f'(x)&\text{if $x= y$}\end{cases}$$
is a continuous function.</p>
</blockquote>
<p>Note that $C^1$ Continuity must be crucial since a blatant counter example given by the function
$$f(x) = \begin{cases}x^2\sin \frac{1}{x}&\text{if $x\neq 0$}\\
0&\text{if $x= 0$}\end{cases}$$
which differentiable on $\mathbb R$ but not $C^1$ because the derivative is not continuous at $x=0.$</p>
| 0non-cybersec
| Stackexchange | 262 | 667 |
pandas dataframe create new columns and fill with calculated values from same df. <p>Here is a simplified example of my df:</p>
<pre><code>ds = pd.DataFrame(np.abs(randn(3, 4)), index=[1,2,3], columns=['A','B','C','D'])
ds
A B C D
1 1.099679 0.042043 0.083903 0.410128
2 0.268205 0.718933 1.459374 0.758887
3 0.680566 0.538655 0.038236 1.169403
</code></pre>
<p>I would like to sum the data in the columns row wise:</p>
<pre><code>ds['sum']=ds.sum(axis=1)
ds
A B C D sum
1 0.095389 0.556978 1.646888 1.959295 4.258550
2 1.076190 2.668270 0.825116 1.477040 6.046616
3 0.245034 1.066285 0.967124 0.791606 3.070049
</code></pre>
<p>Now, here comes my question! I would like to create 4 new columns and calculate the percentage value from the total (sum) in every row. So first value in the first new column should be (0.095389/4.258550), first value in the second new column (0.556978/4.258550)...and so on...
Help please </p>
| 0non-cybersec
| Stackexchange | 401 | 1,021 |
What's the framework mechanism behind dependency properties?. <p>I have been reading about dependency properties in several books but all have one thing in common, they just tell us how they are implemented( using <code>static readonly DependencyProperty</code> etc.) but does not tell the exact way they work from inside. </p>
<p>I mean they are implemented as static but still applies to all objects.<br>
Second point of confusion is attached properties. </p>
<p>Is there any tutorial available that can explain all these concepts in an easy way?</p>
| 0non-cybersec
| Stackexchange | 133 | 561 |
Subsets and Splits