text
stringlengths
36
35k
label
class label
2 classes
source
stringclasses
3 values
tokens_length
int64
128
4.1k
text_length
int64
36
35k
compute $P(XY\leq 3)$, $P(X+Y&gt;2)$ and $P(X/Y&gt;1)$. <blockquote> <p>The joint probability mass function of <span class="math-container">$X$</span> and <span class="math-container">$Y$</span> is given by</p> <p><span class="math-container">$p(1,1)=\frac{1}{8}$</span> <span class="math-container">$p(2,1)=\frac{1}{8}$</span></p> <p><span class="math-container">$p(1,2)=\frac{1}{4}$</span> <span class="math-container">$p(2,2)=\frac{1}{2}$</span></p> <p>compute <span class="math-container">$P(XY\leq 3)$</span>, <span class="math-container">$P(X+Y&gt;2)$</span> and <span class="math-container">$P(X/Y&gt;1)$</span></p> </blockquote> <p>My attempt:</p> <p><span class="math-container">$P(XY\leq 3)=P(1,1)+P(1,2)+P(2,1)=\frac{1}{2}$</span></p> <p><span class="math-container">$P(X+Y&gt;2)=P(1,2)=P(2,1)+P(2,2)=\frac{7}{8}$</span></p> <p>But what about <span class="math-container">$P(X/Y&gt;1)$</span>? Is it <span class="math-container">$\frac{P(X=i,Y=2)}{P(y&gt;1)}$</span> ? where <span class="math-container">$u=1,2$</span></p>
0non-cybersec
Stackexchange
463
1,040
Deployments over Holidays. My current company seems to love scheduling major project deployments during holidays. To me this always seems like a bad idea, due to people wanting to be away from work or on vacation. I understand the desire on the management side to not interrupt normal business workflow, and holidays are essentially a free day in their calculus. What are your thoughts r/sysadmin? Are there good arguments to convince management to leave holidays alone without sounding like I'm "not a team player"? Are there strategies you use for deployments to reduce downtime or eliminate outages all together?
0non-cybersec
Reddit
133
632
Database Connection vs Raw TCP Connection. <p>I have some fundamental questions about how database clients &amp; database interact</p> <ol> <li>Do databases support multiple transactions simultaneously on a single database connection from client? If not, why not? (as multiplexing would save on resource overhead per connection &amp; connection pools are a source of contention when thousands of simultaneous queries needs to be executed simultaneously, which multiplexing for sure avoids)</li> <li>Whats the relationship between database client's level Connection vs physical raw TCP connection. Is it many-to-one[multuplexing] (or) one-to-one? If not multiplexed why not?</li> <li>If multiplexed, does the database server maintain a single logical connection from its end (or) multiple logical connections</li> </ol> <p>PS: I understand some of these details will vary from database to database, buit want to know in general how popular implementations such as Postgres, Mysql, Oracle, SQL server &amp; DB2 implement these</p>
0non-cybersec
Stackexchange
237
1,031
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
Proof: $f(z)=Ce^{az}$. <p>Let $f$ be a holomorphic function with: $|f(z)|\leq Me^{aRe(z)},$ with $M,a$ positive real constants. It's obvious that $f$ is the complex exponential function , but to prove it, I assume: $$f(z)=Ce^{az}, \quad C\in \mathbb{C} $$ Then: $$\big|Ce^{az}\big| \leq Me^{aRe(z)} \iff \big|C\big|e^{aRe(z)} \leq Me^{aRe(z)} $$ So: $\big|C\big| \leq M.$</p> <p>Is this proved if I choose an arbitrary $C$ with its modulus less than M, or is it a bad way to handle this proof? Should I use <a href="https://en.wikipedia.org/wiki/Liouville%27s_theorem_(complex_analysis)" rel="nofollow noreferrer">Liouville's theorem</a>?</p>
0non-cybersec
Stackexchange
242
644
Namedtuple like class. <p>I find myself writing this class often in my python code when I need a quick single use class.</p> <pre><code>class Struct(object): def __init__( self, **kwargs ): for k in kwargs: setattr(self,k,kwargs[k]) </code></pre> <p>The basic idea is so I can do quick things like this:</p> <pre><code>foo = Struct( bar='one', baz=1 ) print foo.bar foo.baz += 1 foo.novo = 42 # I don't do this as often. </code></pre> <p>Of course this doesn't scale well and adding methods is just insane, but even so I have enough data-only throw-away classes that I keep using it.</p> <p>This is what I thought <a href="http://docs.python.org/library/collections.html#collections.namedtuple" rel="noreferrer">namedtuple</a> was going to be. But the namedtuple's syntax is large and unwieldy.</p> <p>Is there something in the standard library I haven't found yet that does this as well or better?</p> <p>Is this bad bad style? or does it have some hidden flaw?</p> <h3>update</h3> <p>Two concrete example to show why I don't just use a dict. Both of these examples <em>could</em> be done with a dict but it obviously non-idiomatic.</p> <pre><code>#I know an order preserving dict would be better but they don't exist in 2.6. closure = Struct(count=0) def mk_Foo( name, path ): closure.count += 1 return (name, Foo( name, path, closure.count )) d = dict([ mk_Foo( 'a', 'abc' ), mk_Foo( 'b', 'def' ), # 20 or so more ] ) @contextmanager def deleter( path ): control = Struct(delete=True,path=path) try: yield control finally: if control.delete: shutil.rmtree(path) with deleter( tempfile.mkdtemp() ) as tmp: # do stuff with tmp.path # most contexts don't modify the delete member # but occasionally it's needed if keep_tmp_dir: tmp.delete = False </code></pre>
0non-cybersec
Stackexchange
598
1,863
How to check internet connection in alamofire?. <p>I am using below code for making HTTP request in server.Now I want to know whether it is connected to internet or not. Below is my code </p> <pre><code> let request = Alamofire.request(completeURL(domainName: path), method: method, parameters: parameters, encoding: encoding.value, headers: headers) .responseJSON { let resstr = NSString(data: $0.data!, encoding: String.Encoding.utf8.rawValue) print("error is \(resstr)") if $0.result.isFailure { self.failure("Network") print("API FAILED 4") return } guard let result = $0.result.value else { self.unKnownError() self.failure("") print("API FAILED 3") return } self.handleSuccess(JSON(result)) } </code></pre>
0non-cybersec
Stackexchange
236
856
Extension of a linear operator. <p>Let $T$ be a linear operator defined on the space of the algebraic polinomials in $[0,1]$ (polinomials with rational coefficients) such that for each $k \in \mathbb{N}, T[x^k]=0$. Is it possibile to extend the operator to the space of continuous functions in $[0,1]$? In that case, how would it value $T[sin(x)]$?</p> <p>I was thinking about using Hahn-Banach theorem. Actually, since the subspace is dense in $C([0,1])$ it is possible to have a unique extension (I read this through my notes...even if I don't have any proofs of it; if someone can send me a link about it, this would be really appreciated...is this just extending the operator to the closure of the domain where is defined?). </p> <p>After that, one corollary of Hahn-Banach theorem says: </p> <p>if $Y \subset X$ is a closed subspace and $x \notin Y$ then it exists $\Lambda \in X^*$ such that $\Lambda x=1$ but $\Lambda y=0$ for all $y \in Y$ (in this case I know the proof). </p> <p>This fact let me think that $T[sin(x)]=1$...am I right?</p>
0non-cybersec
Stackexchange
321
1,053
How does AppSync subscriptions handle resolver exceptions?. <p>I've noticed that throwing an exception in my subscription response mapping template results in the subscription not reaching the client. </p> <p>I am building a chat feature and need to ensure new messages are delivered to client devices consistently. What happens if there is throttling exception (as a result of not provisioning enough RCU for example)? The client will be unaware that a new message unsuccessfully attempted to reach them.</p> <p>Is there a way to retry the subscription, or at least inform the client so that they can pull new messages after a backoff period?</p>
0non-cybersec
Stackexchange
142
650
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
Why older CPUs perform better?. <p>By "perform" I mean have better scores on websites like cpuboss.com or userbenchmark.com. Is that a bad metric, perhaps?</p> <p>An example: my old laptop has <a href="http://ark.intel.com/products/71670/Intel-Core-i7-3632QM-Processor-6M-Cache-up-to-3_20-GHz-BGA" rel="nofollow noreferrer">i7 3632QM</a>. New similarly priced laptops have [i7 6500U](i7 6500U). Here are the comparison: <a href="http://cpuboss.com/cpus/Intel-Core-i7-6500U-vs-Intel-Core-i7-3632QM" rel="nofollow noreferrer">cpuboss.com comparison for Intel Core i7 6500U vs. Intel Core i7 3632QM</a></p> <p>Note the advantage in the single core test.</p> <p>Then I compared it to a modern quad core (<a href="http://ark.intel.com/products/88967/Intel-Core-i7-6700HQ-Processor-6M-Cache-up-to-3_50-GHz" rel="nofollow noreferrer">i7 6700HQ</a>): <a href="http://cpuboss.com/cpus/Intel-Core-i7-6700HQ-vs-Intel-Core-i7-3632QM" rel="nofollow noreferrer">cpuboss comparison of Intel Core i7 6700HQ vs. Intel Core i7 3632QM</a></p> <p>Now the score is closer, but the new processor consumes even more energy, 14 nm notwithstanding.</p> <p>I'm quite confused, it makes it seem like there was no progress in 5 years.</p>
0non-cybersec
Stackexchange
460
1,216
How do you list all subgroups of D6 (which is of order 6)?. <p><span class="math-container">$G$</span> is the dihedral group <span class="math-container">$D_6$</span> of order 6. I need to find all subgroups of order 2 and order 3. I have found the cyclic group <span class="math-container">$\left&lt;b\right&gt; = \{e, b\}$</span>, but that's as far as I have come.</p> <p>How do you list all subgroups of eg. <span class="math-container">$D_6$</span>? and how would you present all subgroups of eg. order 2? </p>
0non-cybersec
Stackexchange
168
517
Replace space (&quot; &quot;) with no space (&quot;&quot;) in one column. <p>I have a table like this:</p> <pre> ID | Propinsi | Kota | _________________________ 1 | Aceh | Denpasar 2 | Aceh | Banda Aceh 3 | Sumatera | Asahan </pre> <p>This table has many rows. The problem is I want to replace the space before the text in column <code>Kota</code> for all rows like this:</p> <pre> ID | Propinsi | Kota | _________________________ 1 | Aceh |Denpasar 2 | Aceh |Banda Aceh 3 | Sumatera |Asahan </pre> <p>I searched Google, the function <code>replace</code> in MySQL only affects one row:</p> <pre><code>SELECT REPLACE(string_column, 'search', 'replace') as Kota </code></pre> <p>Can someone fix my problem?</p>
0non-cybersec
Stackexchange
254
738
Importing json from file into mongodb using mongoimport. <p>I have my json_file.json like this:</p> <pre><code>[ { "project": "project_1", "coord1": 2, "coord2": 10, "status": "yes", "priority": 7 }, { "project": "project_2", "coord1": 2, "coord2": 10, "status": "yes", "priority": 7 }, { "project": "project_3", "coord1": 2, "coord2": 10, "status": "yes", "priority": 7 } ] </code></pre> <p>When I run the following command to import this into mongodb:</p> <pre><code>mongoimport --db my_db --collection my_collection --file json_file.json </code></pre> <p>I get the following error:</p> <pre><code>Failed: error unmarshaling bytes on document #0: JSON decoder out of sync - data changing underfoot? </code></pre> <p>If I add the --jsonArray flag to the command I import like this:</p> <pre><code>imported 3 documents </code></pre> <p>instead of one document with the json format as shown in the original file. </p> <p>How can I import json into mongodb with the original format in the file shown above?</p>
0non-cybersec
Stackexchange
371
1,079
$\mathbb Q(\sqrt{5})$ contains infinitely many elements with a uniform bound on their partial quotients. <blockquote> <p>Show that <span class="math-container">$\mathbb Q(\sqrt{5})$</span> contains infinitely many elements with a uniform bound on their partial quotients, by checking that the numbers <span class="math-container">$\overline{[1^{r+1},4,2,1^r,3]}$</span> for <span class="math-container">$r\ge 0$</span> all lie in <span class="math-container">$\mathbb Q(\sqrt 5)$</span> (here <span class="math-container">$1^r$</span> denotes the string <span class="math-container">$1,1,...,1$</span> of length <span class="math-container">$r$</span>). Can you find a similar pattern in any real quadratic field <span class="math-container">$\mathbb Q(\sqrt d)$</span>?</p> </blockquote> <hr> <p>Since <span class="math-container">$u$</span> is a strictly periodic continued fraction, we know that <span class="math-container">$$ u=\frac{up_k+p_{k-1}}{uq_k+q_{k-1}}\quad\text{for}\quad u=\overline{[a_0;a_1,...,a_k]} $$</span> where <span class="math-container">$\frac{p_k}{q_k}=[a_0;a_1,...,a_k]$</span> and we have <span class="math-container">$$ u^2q_k+u(q_{k-1}-p_k)-p_{k-1}=0 .$$</span> <span class="math-container">$u$</span> has discriminant <span class="math-container">$\Delta=(q_{k-1}+p_k)^2-4(-1)^k$</span>. So it suffices to check whether <span class="math-container">$\Delta=5l^2$</span>, <span class="math-container">$l\in\mathbb Z$</span>.</p> <p>But how to show that for every <span class="math-container">$r$</span> this is true. I cannot come up with an induction.</p>
0non-cybersec
Stackexchange
550
1,594
how to inline comment with eslint-prettier/prettier?. <p>i want to turn off the rule in prettier where it newlines an inline comment. my ESLint rule <code>no-inline-comments</code> is set to off or warn, so that is taken care of and works. turns out Prettier still wants to newline and inline comment:</p> <p><a href="https://i.stack.imgur.com/TReDN.png" rel="noreferrer"><img src="https://i.stack.imgur.com/TReDN.png" alt="enter image description here"></a></p> <p>i have a setup in my VSCode where ESLint is handling prettier for JS and the Prettier extension is handling all the other languages. im also using the <code>airbnb-base</code>. here are my relevant configs:</p> <p><code>.eslintrc.json</code>:</p> <pre><code>{ "extends": ["airbnb-base", "plugin:prettier/recommended"], "rules": { "no-console": 0, "no-plusplus": 0, "no-inline-comments": "off", "no-undef": "warn", "no-use-before-define": "warn", "no-restricted-syntax": [ "warn", { "selector": "ForOfStatement", "message": "frowned upon using For...Of" } ] // "line-comment-position": ["warn", { "position": "above" }] }, "env": { "browser": true, "webextensions": true } } </code></pre> <p>VSCode <code>settings.json</code>:</p> <pre><code> // all auto-save configs "editor.formatOnSave": true, // turn off for native beautifyjs "[javascript]": { "editor.formatOnSave": false }, "eslint.autoFixOnSave": true, "eslint.alwaysShowStatus": true, "prettier.disableLanguages": ["js"], "prettier.trailingComma": "es5" } </code></pre> <p>i know you can do <code>// eslint-disable-next-line prettier/prettier</code> above what you want ignored but i obviously wouldnt want to set that every time. you can see it commented out in my picture above.</p> <blockquote> <p>Generally, you get the best results when placing comments on their own lines, instead of at the end of lines. Prefer <code>// eslint-disable-next-line</code> over <code>// eslint-disable-line</code>.</p> </blockquote> <p><a href="https://prettier.io/docs/en/rationale.html#comments" rel="noreferrer">https://prettier.io/docs/en/rationale.html#comments</a></p> <p>im not sure if this is useful in this situation?:</p> <blockquote> <p>Note: While it is possible to pass options to Prettier via your ESLint configuration file, it is not recommended because editor extensions such as <code>prettier-atom</code> and <code>prettier-vscode</code> will read <code>.prettierrc</code>, but won't read settings from ESLint, which can lead to an inconsistent experience.</p> </blockquote> <p><a href="https://github.com/prettier/eslint-plugin-prettier#options" rel="noreferrer">https://github.com/prettier/eslint-plugin-prettier#options</a></p> <p>ive talked to a few people and it might not even possible? though, it is a rule somewhere and that should be able to be overridden. if there is any other information i can provide i will.</p>
0non-cybersec
Stackexchange
973
2,975
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 properly apply open/closed principle on large code base for apparently unrelated features. <p>Let's say I have a class hierarchy like this:</p> <p><a href="https://i.stack.imgur.com/dhTmc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dhTmc.png" alt="enter image description here" /></a></p> <p>Now let's suppose I add later a new interface <code>Mechanic</code>, responsible for repairing a vehicle. Of course someone capable of repairing a car won't fix your broken bus. So you would have the BusMechanic and CarMechanic as implementations. My question would be, how do you create the right kind of mech ?</p> <p>I see either :</p> <h3>The Vehicle interface could instantiate the right mech</h3> <p>I could add a method to the vehicle interface <code>Mechanic createMechanic()</code> which would create a new Mechanic instance with the right class and parameters</p> <blockquote> <p>I find that it breaks SRP since that means that a vh has to handle its mech which is kinda nonsense.</p> <p>Also it clutters the interface.</p> </blockquote> <h3>The Vehicle interface could provide the factory</h3> <p>Another possibility would be to add a method <code>MechanicFactory getMechFactory()</code>. This would fix the SRP issue, but I still don't really like it.</p> <blockquote> <p>The Vehicle interface would still get cluttered</p> <p>The chain of calls could get really long and not really readable, like <code>customer.getVehicleFleet().getVehicleRegistry().getVehiculeForPlate(xxx).getMechanicFactory().createMechanic().getToolManager().getToolFactory().getRequiredTools()</code></p> <p>The vehicle providing the factory for the mechs is still a non-sense</p> </blockquote> <h2>Using a map/enum</h2> <p>I could also map the classes implementing Vehicle with the right mechanic implementation like :</p> <pre><code>Map.of(Car.class, CarMechanic.class, Bus.class, BusMechanic.class) </code></pre> <blockquote> <p>That would mean that someone subclassing a vehicle would also have to find all the relevant locations to map its class to the correct implementations</p> </blockquote> <p>So far, the 2nd approach seems the better one, albeit far from ideal</p>
0non-cybersec
Stackexchange
632
2,192
[No Regrets] My brother and I(f) masturbated next to each other in his bed Saturday night. I feel dirty, but I want to do it again..... ***Posted this to /r/sex last night, but it got removed.. Hopefully the mods here are a little more open-minded.*** Some context: I'm 32, he's 29. We live together. I was in his bed because he has a massive 55" TV on the wall at the foot of his bed so he can watch movies and TV shows while laying in bed. A while back I started joining him, then going to my room to sleep. Later staying his bed to sleep, and cuddle. Nothing sexual had ever happened; but we've always been super-close, so cuddling in bed is no big deal to us. We don't tell our friends about that part, though... Anyway, Saturday night I stayed in his bed. I awoke with a jolt from a nightmare in the early hours. It woke him up too and he got up to get me a glass of water. After settling back down, neither of us could sleep. After a while I could hear the fabric down there moving slightly. Then I started to feel movement. He was touching himself with the hand that wasn't around me..! He wasn't going at it hard, probably just rubbing the tip. Having a guy masturbate next to me was nothing new, but for some reason the thought of my little brother touching himself while I was cuddled up to him turned *me* on. I reached down and put my hand in my panties.... My movement made him stop and I think I heard him gasp quietly, then hold his breath. It couldn't have taken him long to figure out what I was doing; I was going real slow and gentle like he was. He resumed what he was doing and matched my speed. This made me quicken, which he in turn matched. We kept matching each other's speed until we were both flat on our backs with underwear off and legs spread (still completely under the covers), furiously fapping/schlicking.. Heaving breathing, moaning, grunting, wet slappy sounds... the works. I got off first, and he came just after. He cleaned himself up and we just lay there silently for ages before I snuggled back up to him and we went to sleep. The next day nothing was unusual. We talked, but not about what we did. In the silences during our conversations we would give each other cheeky smiles, but we couldn't bring ourselves to discuss it. Last night I slept in my own bed. We haven't talked yet today (it's currently midday Monday here in Australia); he went out early and I'm going out shortly. We won't see each other to dinner-time. The orgasm I had that night was the best I have ever given myself. Overall it was the most intimate experience I have ever shared with another human being. While I have no regrets, I feel dirty and naughty; but I very much want to do it again and I think he does too. ARGH! I can't stop thinking about it! I know we need to talk about it, but not sure how to bring it up. I also know it's something we *"shouldn't"* do, but we're adults and it's consensual, so I can't see any harm...
0non-cybersec
Reddit
727
2,956
What is the “Safety Tips” component present on chrome://components?. <p>I'm worried about a component I've seen on my <a href="http://chrome://components" rel="nofollow noreferrer">chrome://components</a> list. It's name is <strong>Safety Tips</strong> (see the <a href="https://i.stack.imgur.com/t6EZl.png" rel="nofollow noreferrer">Image description here</a>).</p> <p>Is it malware or a virus of any kind? How do I uninstall it?</p> <p>My operating System is Ubuntu Mate 18.04</p>
1cybersec
Stackexchange
159
485
Modal math font commands in modern LaTeX? (i.e. modal version of \mathrm etc.). <p>Is there a modern <em>modal</em> version of the math font commands?</p> <p>In modern LaTeX, the use of old font-commands like <code>\rm</code> is quite strongly discouraged, with the commands being removed from the Kernel, and therefore unavailable in modern versions of some document classes (the KOMA-script classes in particular).</p> <p>However, I always found them quite useful to make editing easier, as I find reading and writing</p> <pre><code>\int_{\rm BZ} \chi^{\rm(2D)} </code></pre> <p>much easier than</p> <pre><code>\int_{\mathrm{BZ}} \chi^{\mathrm{(2D)}} </code></pre> <p>primarily due to the smaller level of brace-nesting.</p> <p>In text-mode, there are modal commands like <code>\bfseries</code>¹, but these commands are forbidden in math-mode.</p> <p>It is easy enough to reenable the font commands if needed (e.g. for compiling an old document) with <code>\DeclareOldFontCommand</code>, but is there some modern replacement?</p> <p><strong>Note:</strong> I am primarily looking for comands that are supported without custom definitions or special packages, as </p> <ul> <li>Journals may require that submitted documents use no packages beyond the template, and don't include user-defined macros. </li> <li>Custom commands make copy/paste of text and equations across documents difficult. </li> </ul> <hr> <p>¹ Leaving other issues with using the modal commands asigde, in text-mode unlike math-mode, the word meant to be emphasized is rarely <em>already</em> in braces, so <code>Hello {\bfseries World}</code> provides no real advantage over <code>Hello \textbf{World}</code>, in the manner <code>a^{\rm stuff}</code> does compared to <code>a^{\rm stuff}</code> in math-mode.</p>
0non-cybersec
Stackexchange
518
1,796
Dropped my D7200 on the beach. Advice?. A few nights ago I dropped my D7200 in the sand. It landed mostly on the screen side, getting sand in buttons and around the screen borders. I cleaned as much sand as I could using a hand blower but still have some concerns and issues. There's some sand stuck under the on/off switch, it feels gritty when I use the switch. I also can't remove the sand around the screen borders and around the speaker border. I tried using compressed air, but the sand is still there. Should I take this to a camera repair shop and have everything disassembled and cleaned? If so, is there anything I should try before taking it to a shop? Are there any other potential problems that I should worry about? Thanks for the advice!
0non-cybersec
Reddit
171
752
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 can I make my Mac accept a user password of less then 4 characters?. <p>I don't want secure password for my desktop. Instead I use just two letters for quick typing. I can change password in terminal by running:</p> <pre><code>passwd </code></pre> <p>But terminal gives me: <code>Failed global policy "com.apple.defaultpasswordpolicy" Password change failed because password does not meet minimum quality requirements</code></p> <p><a href="https://apple.stackexchange.com/questions/337468/how-to-set-short-user-password-macos-mojave">I believe if the password has less than 4 characters this is blocked.</a> The same limitation is when trying to set it by preference panel obviously.</p> <p>Until now in last versions of system, only solution I found was installing of Server application from Apple and basically modifying you osx by it to be a server, so you can access one setting for password characters policy and be able to set whatever password you like. So is there other option ?</p>
0non-cybersec
Stackexchange
258
1,007
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
Can we please skip the Battle For The Exodar scenario on alts?. We can completely and entirely skip the entire introduction plot to this expansion on any toon. But literally *everyone* has to sit through Prophet "Mopeypants" Velen bitch about the light dying. The scenario is dull, the Exodar is dull, listening to all the stupid RP between killing waves of demons is dull, and forcing every Tom Dick and Harry to sit through that diarrhea just to have him go " ¯\_(ツ)_/¯ sucks to suck I can't do anything with it!" is just super duper tedious. Please let us have a dialog option to skip this feces like we have to skip the broken shore invasion.
0non-cybersec
Reddit
157
649
End Java threads after a while statement has been run. <p>I am having an issue ending threads once my program my has finished. I run a threaded clock object and it works perfectly but I need to end all threads when the time ´==´ one hour that bit seems to work I just need to know how to end them. Here is an example of the code I have and this is the only thing that runs in the run method apart from one int defined above this code.</p> <pre><code> @Override public void run() { int mins = 5; while(clock.getHour() != 1) { EnterCarPark(); if(clock.getMin() &gt;= mins) { System.out.println("Time: " + clock.getTime() + " " + entryPoint.getRoadName() + ": " + spaces.availablePermits() + " Spaces"); mins += 5; } } } </code></pre> <p>But when you keep watching the threads that are running in the debug mode of netbeans they keep running after an hour has passed not sure how to fix this. I have tried the interrupt call but it seems to do nothing. </p> <p><img src="https://i.stack.imgur.com/jwiqx.png" alt="enter image description here"> </p>
0non-cybersec
Stackexchange
323
1,176
How to copy and paste selected text in nano on a Mac?. <p>I’m using <a href="https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/nano.1.html" rel="noreferrer"><code>nano</code></a> in <a href="https://www.iterm2.com" rel="noreferrer">iTerm2</a>, I can mark the text using <kbd>ctrl</kbd>+<kbd>^</kbd> but I'm not able to copy and paste the text. I know that <kbd>ctrl</kbd>+<kbd>k</kbd> can be used cut the entire line. What is the keyboard shortcut for copying only marked text in <code>nano</code>?</p>
0non-cybersec
Stackexchange
191
538
I'm getting more well known as a car photographer and I feel like my skills aren't up to par. Any advice?. I love cars and figured hey I have a DSLR might as well take some pictures of cars that would be fun! I've been taking my camera to car meets and sharing the photos but now people are adding me and saying that my work is really good and I even have an offer to be a car club's photographer. I'm obviously excited about it and didn't expect people to actually like them. The thing is I don't feel like my skills are all that great. Can anyone give me some feedback on how I can improve my shots and maybe just some other tips for a automotive beginner photographer? [Some of my favorite shots](http://imgur.com/a/Ffb7H) I'm shooting with a Canon T3 and have the kit lens as well as a 50mm 1.8
0non-cybersec
Reddit
195
802
Create a VirtualBox VM from an existing bare metal Windows installation. <p>I have Windows 8.1 installed on one computer. I want to use it as a VM under VirtualBox on another computer. Is this possible? If so then how?</p> <p>All I'm trying to do is save a ton of time going through the installation process of all the software I already have installed on the existing 8.1 machine. If there's another way to do a fresh 8.1 install on a VirtualBox VM and then clone all the software installations from the original machine to the new VM then that would also achieve my objectives.</p>
0non-cybersec
Stackexchange
138
585
Running RavenDB as an EmbeddableDocumentStore and accessing RavenDB Management Studio. <p>I'm playing with an embedded RavenDB => <code>RavenDB-Embedded.1.0.499</code> package installed via NuGet in Visual Studio 2010. It's being used in a current project that I started after reading this excellent MSDN article:</p> <p><a href="http://msdn.microsoft.com/pt-br/magazine/hh547101%28en-us%29.aspx" rel="nofollow noreferrer">Embedding RavenDB into an ASP.NET MVC 3 Application</a></p> <p>Now I'd like to access the <a href="http://ayende.com/blog/125953/peeking-behind-the-curtains-the-new-ravendb-management-studio" rel="nofollow noreferrer">RavenDB Management Studio</a> (Web UI).</p> <p>I followed the steps described here: <a href="https://stackoverflow.com/q/6947092/114029">Is it possible to connect to an embedded DB with Raven Management Studio</a> and here <a href="http://ravendb.net/faq/embedded-with-http" rel="nofollow noreferrer">Running RavenDB in embedded mode with HTTP enabled</a> but I didn't get the point.</p> <p>This is the code I'm using to initialize the <code>DocumentStore</code>:</p> <pre><code>_documentStore = new EmbeddableDocumentStore { ConnectionStringName = "RavenDB", UseEmbeddedHttpServer = true }; </code></pre> <p>and this is the <code>ConnectionString</code> present in <code>Web.config</code>:</p> <pre><code>&lt;add name="RavenDB" connectionString="DataDir = ~\App_Data\Database" /&gt; </code></pre> <p>I also read the steps described in <a href="http://www.gamlor.info/wordpress/2011/08/ravendb-embedded-mode/" rel="nofollow noreferrer">RavenDB: Embedded Mode</a>. I tried to start the server manually:</p> <pre><code>// Start the HTTP server manually var server = new RavenDbHttpServer(documentStore.Configuration, documentStore.DocumentDatabase); server.Start(); </code></pre> <p>but the above code seems outdated since I have no <code>RavenDbHttpServer</code>, <code>documentStore.Configuration</code> and <code>documentStore.DocumentDatabase</code>. I managed to find <code>Raven.Database.Server.HttpServer</code> but the other objects are missing in the <code>_documentStore</code>.</p> <p>So, the question is: </p> <p>How can I hit the Web UI to visualize my embedded database docs? What's the URL I should put in my browser address bar?</p> <p>Any advice is appreciated.</p> <p><strong>EDIT:</strong> I've found a way of getting it to work. As I described in my blog post it may not be the best approach but it does work:</p> <p><a href="http://www.leniel.net/2011/11/ravendb-embedded-management-studio-ui.html" rel="nofollow noreferrer">RavenDB Embedded with Management Studio UI</a></p> <p>Note: one downside of the above approach is that I'm not able to access the database in my app because once it has been opened by the server it gets locked. This way I have to stop the server and then reload my app in the browser.</p> <p>I hope RavenDB's gurus out there have a better/correct approach... just let us know.</p>
0non-cybersec
Stackexchange
930
3,040
Ant error after installing NetBeans 7.3 in Lubuntu. <p>I have NetBeans 7.01 from Debian repository - all works. I have problem with NetBeans 7.3 from official site (installed at the same machine) - I can't compile anything:</p> <blockquote> <p><strong>ERROR - Ant is misconfigured and cannot be run.</strong> java.lang.ClassNotFoundException: org.apache.tools.ant.module.bridge.impl.BridgeImpl at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at org.apache.tools.ant.module.bridge.AntBridge$MainClassLoader.findClass(AntBridge.java:647) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) at org.apache.tools.ant.module.bridge.AntBridge.createAntInstance(AntBridge.java:299) at org.apache.tools.ant.module.bridge.AntBridge.getAntInstance(AntBridge.java:279) at org.apache.tools.ant.module.bridge.AntBridge.getInterface(AntBridge.java:268) at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:541) at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)</p> </blockquote> <p>Lubuntu x32, all updates. Nimbus plugin.</p> <p>In <strong>Options -> Java -> Ant -> ant Home</strong> I can't choose valid folder. I tried <strong>usr/share/ant</strong>, but <strong>Ant not found: java.lang.ClassNotFoundException: org.apache.tools.ant.module.brigge.impl.Bridgelmpl</strong>, but I have <em>ant.jar</em> in this directory.</p>
0non-cybersec
Stackexchange
549
1,653
What do I make of unlinked tables in the same database?. <p>Just a basic question here but it's been bothering me for a while. Do all tables have to be related to another? I'm trying to design a database so far I have 15 tables, 13 of them have relationships with each other creating a regular snowflake pattern, but I have two other tables that only relate to each other, meaning they don't have any relationship to the any of the other 13 tables. Does this mean I should review my design or is this considered OK? </p> <p>Thank you for your help in advance.</p>
0non-cybersec
Stackexchange
137
566
How to upgrade Homebrew itself (not softwares/formulas installed by it) on macOS 10.12.3?. <p>I have homebrew installed long before the OS is upgraded a few times to 10.12.3. Now that </p> <pre><code>$ brew --version Homebrew 0.9.9 (git revision 080c; last commit 2016-08-11) Homebrew/homebrew-core (git revision b163b; last commit 2016-08-10) </code></pre> <p>How to properly upgrade to newer version, say <a href="https://brew.sh/blog/" rel="noreferrer">1.1</a>?</p> <pre><code>$ brew upgrade </code></pre> <p>didn't work.</p>
0non-cybersec
Stackexchange
190
534
I get logged out automatically after a few seconds of logging in (Desktop). <p>I get logged out (not locked out) of my desktop session after logging in on Ubuntu 16.04 LTS</p> <p>I see the following on <code>/var/log/lightdm/seat0-greeter.log</code></p> <blockquote> <pre><code>&gt; [+0.59s] DEBUG: User /org/freedesktop/Accounts/User108 added [+0.59s] &gt; DEBUG: Connected to Application Indicator Service. [+0.63s] DEBUG: &gt; menubar.vala:537: Adding indicator object 0xc05400 at position 0 &gt; [+0.66s] DEBUG: menubar.vala:537: Adding indicator object 0xc05560 at &gt; position 1 [+0.69s] DEBUG: menubar.vala:537: Adding indicator object &gt; 0xc05820 at position 2 [+0.70s] DEBUG: Request current apps [+0.71s] &gt; DEBUG: menubar.vala:537: Adding indicator object 0xc052a0 at position &gt; 3 [+0.77s] DEBUG: unity-greeter.vala:240: starting system-ready sound &gt; [+0.78s] DEBUG: background.vala:121: Render of background &gt; /usr/share/backgrounds/warty-final-ubuntu.png complete &gt; &gt; ** (unity-settings-daemon:7535): WARNING **: Unable to register client: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such &gt; method 'RegisterClient' &gt; &gt; (unity-settings-daemon:7535): color-plugin-WARNING **: failed to get &gt; edid: unable to get EDID for output &gt; &gt; (nm-applet:7490): GLib-GObject-WARNING **: invalid unclassed pointer &gt; in cast to 'GtkWidget' &gt; &gt; (nm-applet:7490): Gtk-CRITICAL **: gtk_widget_show: assertion &gt; 'GTK_IS_WIDGET (widget)' failed &gt; &gt; (unity-settings-daemon:7535): color-plugin-WARNING **: unable to get &gt; EDID for xrandr-Virtual1: unable to get EDID for output [+0.95s] &gt; DEBUG: Building new application entry: :1.18 with icon: &gt; nm-device-wired at position 0 [+0.96s] DEBUG: menubar.vala:537: Adding &gt; indicator object 0xb76a00 at position 4 </code></pre> </blockquote> <p><code>/var/lightdm/lightdm.log</code> shows the following right after I log in:</p> <pre><code>[+644.03s] DEBUG: Continue authentication [+644.04s] DEBUG: Session pid=7473: Authentication complete with return value 0: Success [+644.04s] DEBUG: Authenticate result for user user: Success [+644.04s] DEBUG: User user authorized [+644.04s] DEBUG: Greeter requests session ubuntu [+644.04s] DEBUG: Seat seat0: Stopping greeter; display server will be re-used for user session [+644.04s] DEBUG: Session pid=7425: Sending SIGTERM [+644.07s] DEBUG: Session pid=7425: Exited with return value 0 [+644.07s] DEBUG: Seat seat0: Session stopped [+644.07s] DEBUG: Seat seat0: Greeter stopped, running session [+644.07s] DEBUG: Registering session with bus path /org/freedesktop/DisplayManager/Session3 [+644.07s] DEBUG: Session pid=7473: Running command /usr/sbin/lightdm-session gnome-session --session=ubuntu [+644.07s] DEBUG: Creating shared data directory /var/lib/lightdm-data/user [+644.07s] DEBUG: Session pid=7473: Logging to .xsession-errors [+644.11s] DEBUG: Activating VT 7 [+644.11s] DEBUG: Activating login1 session c13 [+644.11s] DEBUG: Seat seat0 changes active session to c13 [+644.11s] DEBUG: Session c13 is already active </code></pre> <p>And then when it logs me out:</p> <pre><code>[+666.61s] DEBUG: Session pid=7473: Exited with return value 0 [+666.61s] DEBUG: Seat seat0: Session stopped [+666.61s] DEBUG: Seat seat0: Stopping display server, no sessions require it [+666.61s] DEBUG: Sending signal 15 to process 7420 [+666.61s] DEBUG: Seat seat0 changes active session to [+666.62s] CRITICAL: session_get_login1_session_id: assertion 'session != NULL' failed [+666.97s] DEBUG: Process 7420 exited with return value 0 [+666.97s] DEBUG: DisplayServer x-0: X server stopped [+666.97s] DEBUG: Releasing VT 7 [+666.97s] DEBUG: DisplayServer x-0: Removing X server authority /var/run/lightdm/root/:0 [+666.97s] DEBUG: Seat seat0: Display server stopped [+666.97s] DEBUG: Seat seat0: Active display server stopped, starting greeter [+666.97s] DEBUG: Seat seat0: Creating greeter session [+666.97s] DEBUG: Seat seat0: Creating display server of type x [+666.97s] DEBUG: Using VT 7 [+666.97s] DEBUG: Seat seat0: Starting local X display on VT 7 [+666.97s] DEBUG: DisplayServer x-0: Logging to /var/log/lightdm/x-0.log [+666.97s] DEBUG: DisplayServer x-0: Writing X server authority to /var/run/lightdm/root/:0 [+666.97s] DEBUG: DisplayServer x-0: Launching X Server [+666.97s] DEBUG: Launching process 8272: /usr/bin/X -core :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch [+666.97s] DEBUG: DisplayServer x-0: Waiting for ready signal from X server :0 [+667.12s] DEBUG: Got signal 10 from process 8272 [+667.12s] DEBUG: DisplayServer x-0: Got signal from X server :0 [+667.12s] DEBUG: DisplayServer x-0: Connecting to XServer :0 [+667.12s] DEBUG: Seat seat0: Display server ready, starting session authentication [+667.12s] DEBUG: Session pid=8277: Started with service 'lightdm-greeter', username 'lightdm' [+667.13s] DEBUG: Session pid=8277: Authentication complete with return value 0: Success [+667.13s] DEBUG: Seat seat0: Session authenticated, running command [+667.13s] DEBUG: Session pid=8277: Running command /usr/lib/lightdm/lightdm-greeter-session /usr/sbin/unity-greeter [+667.13s] DEBUG: Creating shared data directory /var/lib/lightdm-data/lightdm [+667.13s] DEBUG: Session pid=8277: Logging to /var/log/lightdm/seat0-greeter.log [+667.16s] DEBUG: Activating VT 7 [+667.16s] DEBUG: Activating login1 session c14 [+667.16s] DEBUG: Seat seat0 changes active session to c14 [+667.16s] DEBUG: Session c14 is already active [+667.26s] DEBUG: Greeter connected version=1.18.2 resettable=false [+667.32s] DEBUG: Greeter start authentication for user [+667.32s] DEBUG: Session pid=8325: Started with service 'lightdm', username 'user' [+667.32s] DEBUG: Session pid=8325: Got 1 message(s) from PAM [+667.32s] DEBUG: Prompt greeter with 1 message(s) [+667.38s] DEBUG: User /org/freedesktop/Accounts/User108 added </code></pre>
0non-cybersec
Stackexchange
2,096
5,935
Pipelines with asyncio coroutines. <p>I'm new with asyncio and I'm implemented some kind of pipeline using asyncio coroutines. The main idea is to have different pipelines with coroutines that are connected to aggregate information in a payload and after that save the payload in a database.</p> <pre><code>class ExamplePipeline(PipelineBaseClass): def __init__(self): PipelineBaseClass.__init__(self) self.stages = [get_some_info, build_message,n,..,save_to_db] self.wrapper = self.connect(self.stages) def connect(self, stages): def wrapper(*args, **kwargs): data_out = yield from stages[0](*args, **kwargs) for stage in stages[1:]: data_out = yield from stage(data_out) return data_out return wrapper def run(self, data_in): asyncio.get_event_loop().run_until_complete(self.wrapper(data_in)) </code></pre> <p>The functions for each stage are coroutines suppose something like</p> <pre><code>@asyncio.coroutine def get_some_info(payload): payload = call_an_endpoint return payload @asyncio.coroutine def build_message(payload): #do some logic return payload </code></pre> <p>I have a new requirement in which the build_message co routine in some cases needs to fork the rest of the pipeline, this is that the rest of the stages n..save_to_db must be executed x times with different payloads since build_message.</p> <pre><code>[get_some_info, build_message -&gt; payload 1 [n, .. , save_to_db] payload 2 [n, .. , save_to_db] payload x [n, .. , save_to_db] </code></pre> <p>So at finish I have x different messages on the db.</p> <p>How can I implement my new feature in this context?</p>
0non-cybersec
Stackexchange
525
1,800
Spectrum of compact operator between different Banach spaces. <p>Let $X, Y$ be two different Banach spaces, and let $T: X \to Y$ be a compact linear operator. Suppose the identity $I : X \to Y$ <strong>is well-defined</strong>. (For example, we could have $X = L^2([0,1])$ and $Y = L^1([0,1])$, both equipped with the Lebesgue measure). </p> <p>Do most/all elementary results in spectral theory hold in that setting? For example, is it true that the spectrum of $T$ is discrete and that the eigenvalues of $T$ only accumulate at $0$? Is there a simple way to see that without reproving the result? Practically all textbooks only deal with the case where $X = Y$...</p>
0non-cybersec
Stackexchange
191
670
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
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
Non Deterministic Results Using GPUs with Tensorflow and Tensorflow Serving . .. Why?. <p>We have an object detection model developed in Tensorflow (1.10 and 1.3) that uses a standard CNN and some extra layers. We host the model in Tensorflow Serving 1.13.0 using a saved model format, on Nvidia Tesla V100 GPUs with Cuda 10 and CUDNN 7.4.x. (We use the Google containers images and/or dockerfiles for Tensorflow serving.) </p> <p>We run unit tests to ensure that prediction results are what we expect. These all work great on CPU. But when we run them on the above GPU/CUDA/CUDNN configuration, we get differences in the prediction probabilities ranging from .001 to .0005.</p> <p>Our goals are to understand:</p> <ul> <li>why this happens?</li> <li>is there anything we can do to prevent it?</li> <li>If there is something we can do to prevent it, does that entail some sort of trade off, such as performance?</li> </ul> <p>We have tried the following experiments:</p> <ol> <li><p>Multiple runs of the same model on tensorflow GPU using checkpoint with batchsize of 1 </p> <ul> <li>results identical </li> </ul></li> <li><p>Multiple runs of the same model on GPU using checkpoint with various batchsizes</p> <ul> <li>results off by .001</li> </ul></li> <li><p>Multiple runs of the same model on CPU using checkpoint with various batchsizes</p> <ul> <li>results identical </li> </ul></li> <li><p>Multiple runs of the same model on tensorflow serviing GPU using checkpoint with batchsize of 1</p> <ul> <li>results identical </li> </ul></li> <li><p>Comparing runs with checkpoint to runs with saved model on GPU</p> <ul> <li>results off by .005</li> </ul></li> <li><p>Compare runs with checkpoint to runs with savedmodel on CPU</p> <ul> <li>results identical</li> </ul></li> <li><p>Experimented with changing the batch_size and setting <code>TF_CUDNN_USE_AUTOTUNE=0</code> on GPU</p> <ul> <li>reduces max difference from .001 to .0005</li> </ul></li> <li><p>Experimented with adding <code>intra_op_parallelism_threads=1</code>, <code>inter_op_parallelism_threads=1</code> didn’t make any difference when used with <code>TF_CUDNN_USE_AUTOTUNE=0</code></p> <ul> <li>results no different than the above</li> </ul></li> </ol> <p>IN SUMMARY: We have a few cases where the results of running inference on GPU are different:</p> <ol> <li>Using a checkpoint versus a saved model.</li> <li>Batchsize = 1 versus various batch sizes</li> <li>Setting <code>TF_CUDNN_USE_AUTOTUNE=0</code> reduces the difference when using various batch sizes</li> </ol> <p>This happens with TF 1.10 AND 1.13.1</p> <p>Again, our goals are to understand:</p> <ol> <li>Why this happens? </li> <li>Is there anything we can do to prevent it? </li> <li>If there is something we can do to prevent it, does that entail some sort of trade off, such as performance? </li> </ol>
0non-cybersec
Stackexchange
935
2,865
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
Divergence and Gradient integration. <p>Let $f$ a scalar function and $\vec{v}$ a vector function. We can write a product as:</p> <p>$f \vec{v} = \vec{F}$</p> <p>If we differentiate the LHS of above equation by the chain rule we can obtain</p> <p>\begin{align} \nabla \cdot (f \vec{v}) = f \, \nabla \cdot \vec{v} + \vec{v} \, \nabla f \end{align}</p> <p>Integrating we have:</p> <p>\begin{align} \int \nabla \cdot (f \vec{v}) = \int f \, \nabla \cdot \vec{v} + \int \vec{v} \, \nabla f \end{align}</p> <p>By inner product definition</p> <p>\begin{align} \int \mathbf{D} (f \vec{v}) = \langle f, \mathbf{D} \vec{v} \rangle + \langle \vec{v} , \mathbf{G} f \rangle \end{align}</p> <p>where $\mathbf{D}$ and $\mathbf{G}$ are the divergent and gradient operators. That lead us to</p> <p>\begin{align} \int \mathbf{D} \vec{F} = \langle f, \mathbf{D} \vec{v} \rangle + \langle \vec{v} , \mathbf{G} f \rangle \end{align}</p> <p>And by Fundamental Theorem of Calculus</p> <p>\begin{align} \left. \vec{F} \right|_{\partial\Omega} = \langle f, \mathbf{D} \vec{v} \rangle + \langle \vec{v} , \mathbf{G} f \rangle \end{align}</p> <p>where ${\partial\Omega}$ is the region boundary.</p> <p>Is that correct?</p>
0non-cybersec
Stackexchange
490
1,212
Does this pdf belong to any family of probability distributions?. <p>I had to calculate a posterior distribution given the prior is <span class="math-container">$\operatorname{Gamma}(\alpha, \beta)$</span>. At the end I got the posterior, as a function of <span class="math-container">$\theta$</span>, is proportional to <span class="math-container">$\theta^a b^\theta$</span>. All I know so far is that <span class="math-container">$a$</span> and <span class="math-container">$b$</span> are just some non-negative constants. Does this distribution belong to any sort of family? I guess this is analogous to some sort of gamma distribution. Also I guess we need to restrict on the value of <span class="math-container">$b$</span> for this posterior to be proper?</p>
0non-cybersec
Stackexchange
198
767
Unscented Kalman Filter for multiplicative noise models. <p>A little background: I've implemented a framework in <code>Python</code> for performing Bayesian joint parameter and state estimation in state space models using <a href="https://arxiv.org/abs/1308.1883" rel="nofollow noreferrer">Nested SMC</a>. That is, I couple two particle filters: one targeting the parameters, and for each parameter particle I use another particle filter targeting the states. So, if I have $N$ parameter particles, and $M$ state particles I get a complexity of $\mathcal{O}(NM)$.</p> <p>In an effort to reduce this complexity, I aimed at providing optionality for replacing the state particle filter with the <a href="https://www.seas.harvard.edu/courses/cs281/papers/unscented.pdf" rel="nofollow noreferrer">UKF</a>. However, as I did this I noticed that the UKF seems to collapse for models where the observational noise is multiplicative, e.g. for the <a href="http://sfb649.wiwi.hu-berlin.de/papers/pdf/SFB649DP2008-063.pdf" rel="nofollow noreferrer">Taylor stochastic volatility (p.3)</a> model. </p> <p>My question is therefore: Is there a filtering scheme similar to the UKF, in the sense that it does not use weighted samples, that works for models such as the one previously mentioned? Or is there a generalization of the UKF that works for such models?</p>
0non-cybersec
Stackexchange
365
1,354
What are $G$-foo sets really called?. <p>Here's a familiar concept:</p> <ul> <li>A $G$-acted set consists of a $X$ together with a homomorphism $G \rightarrow \mathrm{Aut}(X).$</li> </ul> <p>We can also dualize:</p> <ul> <li>A $G$-foo set consists of a set $X$ together with a homomorphism $\mathrm{Aut}(X) \rightarrow G$.</li> </ul> <p>For example, suppose we're given a finite set $X$. Then $X$ becomes a $(\mathbb{Z}/2\mathbb{Z})$-foo set in a canonical way, by letting the morphism $\mathrm{Aut}(X) \rightarrow \mathbb{Z}/2\mathbb{Z}$ denote the <a href="https://en.wikipedia.org/wiki/Parity_of_a_permutation" rel="nofollow">parity function</a>.</p> <blockquote> <p><strong>Question.</strong> What are $G$-foo sets really called?</p> </blockquote>
0non-cybersec
Stackexchange
268
759
Connecting Apple TV HD to a monitor over USB-C port. <p>Does Apple TV HD support connecting to a display via USB-C port? I use the same display with my newer MacBook Pro with USB-C port.</p> <p>I use a <a href="https://www.lg.com/in/monitors/lg-29UM69G" rel="nofollow noreferrer">display</a> with three input options, a DisplayPort, an HDMI port and a USB-C port. I am able to connect my MacBooks using any one of them i.e., Mini Display Port to Display Port and HDMI cable on a 2013 15" MacBook Pro and a USB-C to USB-C cable on a 2019 16" MacBook Pro.</p> <p>I have the HDMI port engaged with the MacBook and I wondered if I can connect the Apple TV HD to the display via USB-C, but turns out I can not get anything to appear on the display. I am able to connect the Apple TV to my 16" MacBook Pro using the same USB-C cable fine.</p> <p>Does Apple TV not support outputting to a display over USB-C? Is there anyway to enable?</p>
0non-cybersec
Stackexchange
280
936
Pass function arguments by column position to mutate_at. <p>I'm trying to tighten up a <code>%&gt;%</code> piped workflow where I need to apply the same function to several columns but with one argument changed each time. I feel like <code>purrr</code>'s <code>map</code> or <code>invoke</code> functions should help, but I can't wrap my head around it.</p> <p>My data frame has columns for life expectancy, poverty rate, and median household income. I can pass all these column names to <code>vars</code> in <code>mutate_at</code>, use <code>round</code> as the function to apply to each, and optionally supply a <code>digits</code> argument. But I can't figure out a way, if one exists, to pass different values for <code>digits</code> associated with each column. I'd like life expectancy rounded to 1 digit, poverty rounded to 2, and income rounded to 0.</p> <p>I can call <code>mutate</code> on each column, but given that I might have more columns all receiving the same function with only an additional argument changed, I'd like something more concise.</p> <pre class="lang-r prettyprint-override"><code>library(tidyverse) df &lt;- tibble::tribble( ~name, ~life_expectancy, ~poverty, ~household_income, "New Haven", 78.0580437642378, 0.264221051111753, 42588.7592521085 ) </code></pre> <p>In my imagination, I could do something like this:</p> <pre class="lang-r prettyprint-override"><code>df %&gt;% mutate_at(vars(life_expectancy, poverty, household_income), round, digits = c(1, 2, 0)) </code></pre> <p>But get the error</p> <blockquote> <p>Error in mutate_impl(.data, dots) : Column <code>life_expectancy</code> must be length 1 (the number of rows), not 3</p> </blockquote> <p>Using <code>mutate_at</code> instead of <code>mutate</code> just to have the same syntax as in my ideal case:</p> <pre class="lang-r prettyprint-override"><code>df %&gt;% mutate_at(vars(life_expectancy), round, digits = 1) %&gt;% mutate_at(vars(poverty), round, digits = 2) %&gt;% mutate_at(vars(household_income), round, digits = 0) #&gt; # A tibble: 1 x 4 #&gt; name life_expectancy poverty household_income #&gt; &lt;chr&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; #&gt; 1 New Haven 78.1 0.26 42589 </code></pre> <p>Mapping over the digits uses each of the <code>digits</code> options for <em>each</em> column, not by position, giving me 3 rows each rounded to a different number of digits.</p> <pre class="lang-r prettyprint-override"><code>df %&gt;% mutate_at(vars(life_expectancy, poverty, household_income), function(x) map(x, round, digits = c(1, 2, 0))) %&gt;% unnest() #&gt; # A tibble: 3 x 4 #&gt; name life_expectancy poverty household_income #&gt; &lt;chr&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; #&gt; 1 New Haven 78.1 0.3 42589. #&gt; 2 New Haven 78.1 0.26 42589. #&gt; 3 New Haven 78 0 42589 </code></pre> <p><sup>Created on 2018-11-13 by the <a href="https://reprex.tidyverse.org" rel="noreferrer">reprex package</a> (v0.2.1)</sup></p>
0non-cybersec
Stackexchange
1,065
3,195
What&#39;s difference between &quot;varchar&quot; and &quot;text&quot; type in PostgreSQL?. <p>All I know about differences of them is <code>varchar</code> has limit, and <code>text</code> is not. The <a href="http://www.postgresql.org/docs/8.4/static/datatype-character.html" rel="noreferrer">documentation</a> does not mention about this. </p> <p>Is that really the only difference? No consideration about performance or etc? </p>
0non-cybersec
Stackexchange
138
434
Console vs PC. Hey all, as 2020 is just getting started I find myself debating between X Box Series X or PS5 or building a gaming PC. As I get older I find I have less and less time to actually play online. But I do enjoy it when I can. Most of my friends are moving in a similar direction. While the technical side of this is important, I'm more focused on the community aspect. For example I've never really been able to expand my friend list on PS4 outside of people I work with because I never have been able to really get comfortable in that community, where xbox is considered I have a similar experience as most of my friends list is from the early 2000's. Being comprised of guys I grew up with who dont really get to play much either. So I find myself at a cross roads, is the PC community welcoming, am I missing something in the playstation and xbox communities? Honestly any thoughts would go a long way to helping.
0non-cybersec
Reddit
207
929
Does the &quot;no gaps&quot;-property with transcendental numbers mean that there is only &quot;one number&quot;?. <p>I admit, the question is a little provocative, but is asked in all earnestness.</p> <p>It is inspired by this one: <a href="https://math.stackexchange.com/questions/11/does-99999-1">Is it true that $0.999999999\ldots = 1$?</a></p> <p>Many of the arguments here point to the fact that 0.999... and 1 are arbitrarily close together. Put differently this means that "there is no gap in-between the two" - which concludes that these numbers are just the same one number: 1.</p> <p>In another field, concerning the <a href="http://en.wikipedia.org/wiki/Transcendental_number" rel="nofollow noreferrer">transcendental numbers</a>, it is proved that they are complete. So again put differently there are "no gaps in the number-line".</p> <p>Interestingly enough this is not seen as a proof that all transcendental numbers are only just one number. </p> <p>At the moment I can't find a good explanation why "no gaps" here means "is equal" and there it means "they are all different" (=complete). Could anybody please enlighten me?</p>
0non-cybersec
Stackexchange
327
1,150
Postgres: clear entire database before re-creating / re-populating from bash script. <p>I'm writing a shell script (will become a cronjob) that will:</p> <p>1: dump my production database</p> <p>2: import the dump into my development database</p> <p>Between step 1 and 2, I need to clear the development database (drop all tables?). How is this best accomplished from a shell script? So far, it looks like this:</p> <pre><code>#!/bin/bash time=`date '+%Y'-'%m'-'%d'` # 1. export(dump) the current production database pg_dump -U production_db_name &gt; /backup/dir/backup-${time}.sql # missing step: drop all tables from development database so it can be re-populated # 2. load the backup into the development database psql -U development_db_name &lt; backup/dir/backup-${time}.sql </code></pre>
0non-cybersec
Stackexchange
245
801
Accordion is breaking the height of the div. <p>I'm using Angular and ng-bootstrap.</p> <p>I've a problem with the accordion component (<a href="https://ng-bootstrap.github.io/#/components/accordion/examples" rel="nofollow noreferrer">https://ng-bootstrap.github.io/#/components/accordion/examples</a>)</p> <p>When I put an accordion into a div with a max-height, the accordion can go over this max-height.. But I want to get the max-height of my div respected.</p> <p>To reproduce the bug it's simple :</p> <p>Create a div with a max-height (for example 80% and width: 200px) then put inside few accordions with few panels for each. Then open them and you'll see your panels going over the max height.</p> <p>What I want is to have a scrollbar on my div and not on my body but it's not working even with a max height inside of my div.</p>
0non-cybersec
Stackexchange
252
845
Disable action associated with extension &#39;fileinto&#39; in the managesieve interpreter (Dovecot). <p>After doing some research on <code>sieve</code> support with <code>dovecot</code>, I decided to implement it on a virtual machine for testing. I have everything working as expected, i.e. a script is uploaded onto the server, and the interpreter works correctly.</p> <p>However, I'm having trouble understanding how I could disable an <em>action</em>, rather than an entire <em>extension</em>. For example, I need to disable the <code>redirect</code> <em>action</em> to prevent anyone creating a forward. This action so happens to be a part of the <code>fileinto</code> extension, which contains other actions that I would like to keep enabled. (Such as <code>keep</code>, and <code>discard</code>). After reading the RFC standards, I don't think this would be possible.</p> <p>Out of curiosity, I've tried including the following line to see if I could disable it:</p> <pre><code>sieve_extensions = -redirect </code></pre> <p>However, as expected:</p> <pre><code>managesieve: Warning: sieve: ignored unknown extension 'redirect' while configuring available extensions </code></pre> <p>Because this is an action, not an extension.</p> <p>Has anyone else run into this situation? </p> <p>What are some approaches to solve this problem?</p>
0non-cybersec
Stackexchange
365
1,351
$L^1$ and $L^2$ norms inequality. <p>Let <span class="math-container">$f:[0,\infty)\to\mathbb{R}$</span> be a bounded measurable function with respect to the Lesbegue measure satisfying <span class="math-container">$\|f\|_2 = \left\{\int_0^\infty f^2(x)dx\right\}^{1/2}&lt;\infty$</span>. Is there any known condition of <span class="math-container">$f$</span> for <span class="math-container">$\|f\|_1 = \int_0^\infty |f(x)|dx &lt; \infty$</span>? In other words, is there any condition of <span class="math-container">$f$</span> such that if <span class="math-container">$\|f\|_2&lt;\infty$</span>, then there exists <span class="math-container">$M_f&lt;\infty$</span> that depends on <span class="math-container">$f$</span> such that <span class="math-container">$\|f\|_1 \le M_f\|f\|_2$</span>?</p> <hr> <p><strong>Edit</strong></p> <p>Probably, it would be better to give an example I am working on. Let <span class="math-container">$\delta&gt;0$</span>. Then, by the Schwarz inequality <span class="math-container">\begin{equation*} \|f\|_1 = \sum_{n=0}^\infty\int_{n\delta}^{(n+1)\delta}|f(x)|dx \le \sqrt{\delta}\sum_{n=0}^\infty\left\{\int_{n\delta}^{(n+1)\delta}f^2(x)dx\right\}^{1/2}. \end{equation*}</span> The series on the right converges if <span class="math-container">\begin{equation*} \limsup_{n\to\infty}\left\{ \int_{n\delta}^{(n+1)\delta}f^2(x)dx\right\}^{1/n} &lt; 1 \end{equation*}</span> or <span class="math-container">\begin{equation*} \limsup_{n\to\infty}\frac{\int_{(n+1)\delta}^{(n+2)\delta}f^2(x)dx}{\int_{n\delta}^{(n+1)\delta}f^2(x)dx}&lt;1. \end{equation*}</span> Thus, if the convergent series <span class="math-container">\begin{equation*} \sum_{n=0}^\infty\int_{n\delta}^{(n+1)\delta}f^2(x)dx = \|f\|_2^2 &lt;\infty \end{equation*}</span> satisfies one of those conditions, then <span class="math-container">$\|f\|_1&lt;\infty$</span>.</p> <p>I hope that this example is correct. By the way, the conditions I found above are not easy to work with for my original problem. So, I am wondering if there are some other conditions.</p>
0non-cybersec
Stackexchange
758
2,073
Why Mongo Spark connector returns different and incorrect counts for a query?. <p>I'm evaluating Mongo Spark connector for a project and I'm getting the inconsistent results. I use MongoDB server version 3.4.5, Spark (via PySpark) version 2.2.0, Mongo Spark Connector version 2.11;2.2.0 locally on my laptop. For my test DB I use the Enron dataset <a href="http://mongodb-enron-email.s3-website-us-east-1.amazonaws.com/" rel="noreferrer">http://mongodb-enron-email.s3-website-us-east-1.amazonaws.com/</a> I'm interested in Spark SQL queries and when I started to run simple test queries for count I received different counts for each run. Here is output from my mongo shell:</p> <pre><code>&gt; db.messages.count({'headers.To': '[email protected]'}) 203 </code></pre> <p>Here are some output from my PySpark shell:</p> <pre><code>In [1]: df = spark.read.format("com.mongodb.spark.sql.DefaultSource").option("uri", "mongodb://127.0.0.1/enron_mail.messages").load() In [2]: df.registerTempTable("messages") In [3]: res = spark.sql("select count(*) from messages where headers.To='[email protected]'") In [4]: res.show() +--------+ |count(1)| +--------+ | 162| +--------+ In [5]: res.show() +--------+ |count(1)| +--------+ | 160| +--------+ In [6]: res = spark.sql("select count(_id) from messages where headers.To='[email protected]'") In [7]: res.show() +----------+ |count(_id)| +----------+ | 161| +----------+ In [8]: res.show() +----------+ |count(_id)| +----------+ | 162| +----------+ </code></pre> <p>I searched in Google about this issue but I didn't find anything helpful. If someone has any ideas why this could happen and how to handle this correctly please share your ideas. I have a feeling that maybe I missed something or maybe something wasn't configured properly.</p> <p><strong>UPDATE:</strong> I solved my issue. The reason of inconsistent counts was the <strong>MongoDefaultPartitioner</strong> which wraps <strong>MongoSamplePartitioner</strong> which uses random sampling. To be honest this is quite a weird default as for me. I personally would prefer to have a slow but a consistent partitioner instead. The details for partitioner options can be found in the official <a href="https://docs.mongodb.com/spark-connector/master/configuration/" rel="noreferrer">configuration options</a> documentation.</p> <p><strong>UPDATE:</strong> Copied the solution into an answer.</p>
0non-cybersec
Stackexchange
737
2,704
Prove that there are at least $N$ distinct &quot;absolute&quot; differences between $N$ k-dimensional vectors. <p>I encountered the following problem: Let's define $h(a, b) = (|a_1 - b_1|, |a_2 - b_2|, ..., |a_k - b_k|)$, where $a$ and $b$ are two k-dimensional vectors with natural numbers and $a = (a_1, ..., a_k)$ and $b = (b_1, ..., b_k)$, $|x -y|$ is the absolute difference between $x$ and $y$. Now we have to prove the following: </p> <p>Given $n$ different vectors $v_1, v_2, ..., v_n$, consider $A = \{h(a_i, a_j) |1 \leq i, j \leq n \}$. Prove that $|A| \geq n$, in other words that the number of different values of $h$ among all pairs of vectors is at least $n$. Note that we count $o = (0, 0, ..) = h(a_1, a_1)$ as one of these values.</p> <p>What I have tried: As my linear algebra isn't very good(and I'm also not sure if such operation as $h$ is "standard" as for ex. dot product), I tried proving the statement with induction on the dimensions of these vectors. The case where they are $1$-dimensional is pretty straightforward, the vectors are just integers, we can sort them in increasing order, then $|a_1 - a_i|$ for $1 \leq i \leq n$ has $n$ different values. However, I'm not sure how to continue. I would be glad if somebody could help me. I'm interested in other approaches also. Please note that we are talking about absolute difference here, if it were normal difference I have already solved it.</p>
0non-cybersec
Stackexchange
440
1,430
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 become a "Family". My husband and I have had iPhones pretty much since they were first available. We each had our own accounts. After a couple of years we met and then married. What is the best way to become a "family" so that we can start to make use of Family Sharing in iTunes so that we can share purchases? We have both purchased different apps over the years and ideally we don't want to lose the right to install each other's apps. I know that you can log out of the appstore, log in as the other person and then download the app the other one purchased. However, that's inconvenient and requires the other persons password when apps are updated. I'm hoping that somehow we can become a "Family" to avoid all that hassle....but I'm not clear on how best to move forward.
0non-cybersec
Reddit
188
798
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
What are the polar coordinates of the origin?. <p>In polar coordinates, the origin has $r = 0$, but $\theta$ is not unique.</p> <p>what sort of problems does this create, and how can I resolve them? For example, suppose an ant is wandering around a plane. Its speed is</p> <p>$$s = \sqrt{\dot{r}^2 + r^2 \dot{\theta}^2}$$</p> <p>but if the ant wanders through the origin a quantity like $\dot{\theta}$ is undefined. In this particular case I can deal with it because the limit</p> <p>$$\lim_{r\to 0}\ r^2\dot{\theta}^2$$</p> <p>is defined. Similarly, if I want to find an area with integration, I'd need to look at the Jacobian</p> <p>$$\left|\begin{array}{cc}\partial r / \partial x &amp; \partial r / \partial y \\ \partial \theta / \partial x &amp; \partial \theta / \partial y\end{array}\right|$$</p> <p>which is not defined at the origin. Again I can get around it. If I want the area of the unit circle, for example, I can take</p> <p>$$\lim_{\epsilon \to 0} \int_{\theta = 0}^{2\pi}\int_{r=\epsilon}^1 r\ \textrm{d}r\textrm{d}\theta$$</p> <p>How do I know I can always work around things like this? If I receive some other coordinate system, how can I tell if the points with no unique coordinates are going to give me trouble?</p>
0non-cybersec
Stackexchange
406
1,255
Macbook won&#39;t connect to xfinity hotspot. <p>Try as I might, I can't get my MacBook to talk to the local Xfinity hotspot, by which I mean the public hotspots called "xfinitywifi" (not my house's router). </p> <p>My iPad connects to it fine and it gives me the magical sign-on page, which I do, and Bob's Your Uncle. But the MacBook -- nada -- just no network seen. I've tried with both Chrome and Safari. </p> <p>What's supposed to happen (and which happens perfectly fine on the iPad) is that you go to some random url, and it redirects you first to an Xfinity specific login page, which you do, and then you're in. Again, my iPad does this exactly fine. But try as I might, I can't get my MacBook to do it on either Chrome or Safari, just sees no network at all. </p> <p>I've tried turning off my firewalls, no joy. Some web surfing led me to a probably bogus theory about having to go to a non-https site. I tried that too but it didn't work. I'm stumped. </p> <p>BTW, my MacBook works fine on every other secondary hotspot I've tried, like the local library, so I know I can normally connect to public wifi. </p>
0non-cybersec
Stackexchange
320
1,126
RealVNC GPO Install not showing in systray. <p>Have installed RealVNC 6.3.2 on a test PC using the GPO Computer Configuration.</p> <p>However when it is deployed to the test machine, I can see VNC Server in the start menu (doesn't produce any dialog box when clicked on), cannot see a VNC Server icon in the notification area/systray, and when trying to connect get "The connection was refused by the computer", which according to <a href="https://www.realvnc.com/en/connect/docs/connect-error-ref.html#connect-error-ref" rel="nofollow noreferrer">https://www.realvnc.com/en/connect/docs/connect-error-ref.html#connect-error-ref</a> infers that the server isn't running (despite services.msc stating it is) or it is listening on the wrong port. Unless I am missing something, without the notification area/systray icon for RealVNC, I cannot check on which port it is configured to listen on.</p> <p>My assumption is that VNC has been installed on some system account, and hence the GUI is appearing on a different console. Though the install docs didn't mention any issue with deploying to PCs, Users, or both.</p> <p>Anyone know what is going here?</p>
0non-cybersec
Stackexchange
317
1,157
Update Server BIOS - Supermicro 5015A-EHF-D525. <p>I've got a Barebone-Server with the Supermicro 5015A-EHF-D525 Mainboard. Now I urgently need to update the BIOS to the newest version. Too bad I've never done that before and google isn't much help either. </p> <p>I've downloaded the newest version of the BIOS and got the following 4 files:</p> <ul> <li>AFUDOS.SMC</li> <li>ami.bat</li> <li>Readme for AMI BIOS.txt</li> <li>X7SPA3.719</li> </ul> <p>But now what? I read somewhere that I have to put this files on a bootable USB device? Is that true, and if so, how do I do it?</p> <p>I also read, that I have to run the ami.bat with the X7SPA3.719 as a parameter on the device I want to be able to boot from later, but that didn't wokr either.</p> <p>Since I really don't have to deal with that kind of problem often I'm pretty unexperienced so please try to explain it so even a newbie like I can understand it.</p> <p>Thanks a lot in advance for your time and effort. L Meier</p>
0non-cybersec
Stackexchange
334
990
[Help] Any advice for crate training a new dog with severe separation anxiety?. Last Thursday, my husband and I adopted a beautiful 4 year old rescue. She had been abandoned in El Paso, TX and given up to a Cocker Spaniel Rescue with her siblings. She's not a Cocker at all, though. She was with her foster for a month and then came to us. We had to leave for a few events in the evening since we got her and have put her in the crate with plenty of toys and a stuffed Kong. Whenever she's in the crate, she goes BALLISTIC and tears apart everything in sight without touching her Kong. She's destroyed 2 crate pads, a collar, several toys, and the bars on the crate are already bending. Does anyone have advice on crate training a dog with separation anxiety like this? We're planning on starting with smaller increments and working up to more but I'm not sure what to put in the crate with her while we do that or how to get her to relax in there and eat her distraction food.
0non-cybersec
Reddit
224
981
-bash-4.2$ for command line?. <p>I don't know why when I SSH with putty onto my VPS, my command line starts with: <code>-bash-4.2$</code> It hasn't ever been like that, it was <code>myname@localhost</code></p> <p>Only thing I have done different in the last 24 hours, was disable root, and create myself a login, rebooted the VPS. I did in fact SSH back onto the VPS after reboot, so I don't know why when I woke up, it's running under bash.</p> <p>Nothing is changing in bash, so its obvious something isn't right.</p> <pre><code>-bash-4.2$ cd/ -bash: cd/: No such file or directory -bash-4.2$ cd // -bash-4.2$ cd / -bash-4.2$ cd /var/www/ </code></pre>
0non-cybersec
Stackexchange
228
659
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
Borrow checker error after adding generic parameter to struct. <p>I have code that works, but it stops compiling with a borrow checker error after a change. I don't understand how the change could affect borrow checking.</p> <p>Common part to both working and non-working code:</p> <pre class="lang-rust prettyprint-override"><code>/// Some struct that has references inside #[derive(Debug)] struct MyValue&lt;'a&gt; { number: &amp;'a u32, } /// There are many structs similar to `MyValue` and there is a /// trait common to them all that can create them. In this /// example I use the `From` trait. impl&lt;'a&gt; From&lt;&amp;'a u32&gt; for MyValue&lt;'a&gt; { fn from(value: &amp;'a u32) -&gt; Self { MyValue { number: value } } } /// `Producer` makes objects that hold references into it. So /// the produced object must be first dropped before any new /// one can be made. trait Producer&lt;'a, T: 'a&gt; { fn make(&amp;'a mut self) -&gt; T; } </code></pre> <p>Here is the working code:</p> <pre class="lang-rust prettyprint-override"><code>struct MyProducer { number: u32, } impl MyProducer { fn new() -&gt; Self { Self { number: 0 } } } impl&lt;'a, T: 'a + From&lt;&amp;'a u32&gt;&gt; Producer&lt;'a, T&gt; for MyProducer { fn make(&amp;'a mut self) -&gt; T { self.number += 1; T::from(&amp;self.number) } } fn main() { let mut producer = MyProducer::new(); println!( "made this: {:?}", &lt;MyProducer as Producer&lt;MyValue&gt;&gt;::make(&amp;mut producer) ); println!( "made this: {:?}", &lt;MyProducer as Producer&lt;MyValue&gt;&gt;::make(&amp;mut producer) ); } </code></pre> <p>This compiles and prints the expected output:</p> <pre class="lang-none prettyprint-override"><code>made this: MyValue { number: 1 } made this: MyValue { number: 2 } </code></pre> <p>I don't like that <code>MyProducer</code> actually implements <code>Producer</code> for every <code>T</code> as it makes it impossible to call <code>make</code> directly on it. I would like to have a type that is a <code>MyProducer</code> for a specific <code>T</code> (for example for <code>MyValue</code>).</p> <p>To achieve this, I want to add a generic parameter to <code>MyProducer</code>. Because the <code>MyProducer</code> does not really use the <code>T</code>, I use <code>PhantomData</code> to prevent the compiler from complaining.</p> <p>Here is the code after changes:</p> <pre class="lang-rust prettyprint-override"><code>use std::marker::PhantomData; struct MyProducer&lt;'a, T: 'a + From&lt;&amp;'a u32&gt;&gt; { number: u32, _phantom: PhantomData&lt;&amp;'a T&gt;, } impl&lt;'a, T: 'a + From&lt;&amp;'a u32&gt;&gt; MyProducer&lt;'a, T&gt; { fn new() -&gt; Self { Self { number: 0, _phantom: PhantomData::default(), } } } impl&lt;'a, T: From&lt;&amp;'a u32&gt;&gt; Producer&lt;'a, T&gt; for MyProducer&lt;'a, T&gt; { fn make(&amp;'a mut self) -&gt; T { self.number += 1; T::from(&amp;self.number) } } fn main() { let mut producer = MyProducer::&lt;MyValue&gt;::new(); println!("made this: {:?}", producer.make()); println!("made this: {:?}", producer.make()); } </code></pre> <p>The <code>main</code> function now looks exactly as I would like it to look like. But the code does not compile. This is the error:</p> <pre class="lang-none prettyprint-override"><code>error[E0499]: cannot borrow `producer` as mutable more than once at a time --&gt; src/main.rs:50:33 | 49 | println!("made this: {:?}", producer.make()); | -------- first mutable borrow occurs here 50 | println!("made this: {:?}", producer.make()); | ^^^^^^^^ | | | second mutable borrow occurs here | first borrow later used here </code></pre> <p>I don't understand why it no longer works. The produced object is still dropped before the next one is made.</p> <p>If I call the <code>make</code> function just once, it compiles and works.</p> <p>I am using edition 2018, so NLL is active.</p> <p><a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=3d8430803a2919fb7dea6aa4ecbb98ef" rel="nofollow noreferrer">Rust Playground: working version before change</a></p> <p><a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=25e9849cd6fa9b87f3ee04a739e184d7" rel="nofollow noreferrer">Rust Playground: broken version after change</a></p>
0non-cybersec
Stackexchange
1,602
4,697
Expansion of this function in a Fourier-Legendre series. <p>Let $f : (-1,1)\to \mathbb{R}$ be given by</p> <p>$$f(x) = \begin{cases}0, &amp; x\in (-1,0) \\ 1, &amp; x \in [0,1)\end{cases}$$</p> <p>and suppose we want to compute the Fourier-Legendre series of $f$, that is we want to write</p> <p>$$f = \sum_{n}c_n P_n$$</p> <p>with</p> <p>$$c_n = \dfrac{\langle f,c_n\rangle }{|P_n|^2} = \dfrac{2}{2n+1}\int_{-1}^{1}f(x)P_n(x)dx.$$</p> <p>This integral, though is quite complicated. Substituting $f$ we have</p> <p>$$c_n = \dfrac{2}{2n+1}\int_0^1P_n(x)dx.$$</p> <p>Now, I've been trying to compute the RHS but I still couldn't. I've tried writing</p> <p>$$P_n(x) = \dfrac{1}{2^nn!}\dfrac{d^n}{dx^n}[(x^2-1)^n]$$</p> <p>so that</p> <p>$$c_n = \dfrac{2}{(2n+1)2^n n!} \left[\dfrac{d^{n-1}}{dx^{n-1}}[(x^2-1)^n]\right]_0^1,$$</p> <p>but still I can't compute the boundary terms. In that case, is there an easier way to compute those coefficients? If not, how could I finish the calculation I've started?</p> <p>Thanks very much in advance.</p>
0non-cybersec
Stackexchange
475
1,054
Is there a Java Map keySet() equivalent for C++&#39;s std::map?. <p>Is there a Java Map keySet() equivalent for C++'s <code>std::map</code>? </p> <p>The Java <code>keySet()</code> method returns <a href="http://download.oracle.com/javase/7/docs/api/java/util/Map.html#keySet()" rel="nofollow noreferrer">"a set view of the keys contained in this map."</a></p>
0non-cybersec
Stackexchange
128
362
plotting a histogram on a Log scale with Matplotlib. <p>I have a pandas DataFrame that has the following values in a Series</p> <pre><code>x = [2, 1, 76, 140, 286, 267, 60, 271, 5, 13, 9, 76, 77, 6, 2, 27, 22, 1, 12, 7, 19, 81, 11, 173, 13, 7, 16, 19, 23, 197, 167, 1] </code></pre> <p>I was instructed to plot two histograms in a Jupyter notebook with Python 3.6. No sweat right?</p> <pre><code>x.plot.hist(bins=8) plt.show() </code></pre> <p>I chose 8 bins because that looked best to me. I have also been instructed to plot another histogram with the log of x.</p> <pre><code>x.plot.hist(bins=8) plt.xscale('log') plt.show() </code></pre> <p>This histogram looks TERRIBLE. Am I not doing something right? I've tried fiddling around with the plot, but everything I've tried just seems to make the histogram look even worse. Example:</p> <pre><code>x.plot(kind='hist', logx=True) </code></pre> <p>I was not given any instructions other than plot the log of X as a histogram. </p> <p>I really appreciate any help!!! </p> <p>For the record, I have imported pandas, numpy, and matplotlib and specified that the plot should be inline. </p>
0non-cybersec
Stackexchange
392
1,147
Sinon stub being skipped as node express middleware. <p>I'm trying to test the behavior of a particular route. It continues to run the middleware even when I create a stub. I want the event authentication to simply pass for now. I understand that it's not truly a "unit" test at this point. I'm getting there. I've also simplified the code a little. Here is the code to test:</p> <pre><code>const { rejectUnauthenticated } = require('../modules/event-authentication.middleware'); router.get('/event', rejectUnauthenticated, (req, res) =&gt; { res.sendStatus(200); }); </code></pre> <p>Here is the middleware I am trying to skip:</p> <pre><code>const rejectUnauthenticated = async (req, res, next) =&gt; { const { secretKey } = req.query; if (secretKey) { next(); } else { res.status(403).send('Forbidden. Must include Secret Key for Event.'); } }; module.exports = { rejectUnauthenticated, }; </code></pre> <p>The test file:</p> <pre><code>const chai = require('chai'); const chaiHttp = require('chai-http'); const sinon = require('sinon'); let app; const authenticationMiddleware = require('../server/modules/event-authentication.middleware'); const { expect } = chai; chai.use(chaiHttp); describe('with correct secret key', () =&gt; { it('should return bracket', (done) =&gt; { sinon.stub(authenticationMiddleware, 'rejectUnauthenticated') .callsFake(async (req, res, next) =&gt; next()); app = require('../server/server.js'); chai.request(app) .get('/code-championship/registrant/event') .end((err, response) =&gt; { expect(response).to.have.status(200); authenticationMiddleware.rejectUnauthenticated.restore(); done(); }); }); }); </code></pre> <p>I've tried following other similar questions like this: <a href="https://stackoverflow.com/questions/41995464/how-to-mock-middleware-in-express-to-skip-authentication-for-unit-test">How to mock middleware in Express to skip authentication for unit test?</a> and this: <a href="https://stackoverflow.com/questions/41392497/node-express-es6-sinon-stubbing-middleware-not-working">node express es6 sinon stubbing middleware not working</a> but I'm still getting the 403 from the middleware that should be skipped. I also ran the tests in debug mode, so I know the middleware function that should be stubbed is still running.</p> <p>Is this an issue with stubbing my code? Is this an ES6 issue?</p> <p>Can I restructure my code or the test to make this work?</p>
0non-cybersec
Stackexchange
763
2,510
Distributed mirrored filesystem under FreeBSD. <p>Can someone share their experience in building a distributed mirrored filesystem between multiple FreeBSD machines? I. e. we have two (three, four...) servers and special partition "part1" mounted on each of them. We make some changes on it on the machine1 and theese changes instantly take effect on "part1" at all other machines. There are not often write operations on our "cluster", but very often read operations (like static web data of high loaded internet project). We want to have a symmetric access to all machines at the same time (witout "blocking" access to one of them). Our goal is providing high availability, fault tolerance and redudance (and probably hot-swap adding and removing members of this "cluster"). Are there any native technologies like Ceph for Linux?</p>
0non-cybersec
Stackexchange
182
836
Help with partitioning. <p>I am attempting to install Ubuntu alongise Windows on my laptop with a 128GB ssd. When I got to the step to partition the drive, I decided to allocate 25 GB for Ubuntu. But the computer froze. </p> <p>I looked around and read that it's recommended to first run Ubuntu off of the flash drive and use GParted to partition my drive that way. So that is what I decided to do. However, when I got into GParted, I realized I was still a bit confused. Not sure which partition to select and which is what, so on. </p> <p><a href="https://i.stack.imgur.com/YxZQM.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YxZQM.jpg" alt="gparted screenshot"></a></p> <p>I would appreciate any help. Thanks in advance!</p>
0non-cybersec
Stackexchange
223
752
Populate a mongoose model with a field that isn&#39;t an id. <p>Is it possible to populate a mongoose model with a field of a reference model that isn't the _id ... e.g. a username.</p> <p>so something like</p> <pre><code>var personSchema = Schema({ _id : Number, name : String, age : Number, stories : { type: String, field: "username", ref: 'Story' } }); </code></pre>
0non-cybersec
Stackexchange
133
392
Alphabetical order problem in bibliography. <p>I am using BibTeX (with <code>natbib</code>) and I have a file <code>mybib.bib</code> with the following reference:</p> <pre><code>@Article{DPMN92, author = {G. Da Prato and P. Malliavin and D. Nualart}, title = {Compact families of Wiener functionals}, journal = {C. R. Acad. Sci. Paris}, year = {1992}, OPTkey = {•}, volume = {315}, number = {S\'{e}rie I}, pages = {1287--1291}, OPTmonth = {•}, OPTnote = {•}, OPTannote = {•} } </code></pre> <p>Then I have many more. The problem is that this reference is ordered as "P" and not as "D". I have tried binding "Da~Prato" like that but it does not help, writing {Da Prato} does not help either.</p> <p>What is the problem? My <code>.tex</code> file looks like this:</p> <pre><code>\documentclass[article]{imsart} \usepackage{amsthm,amsmath,natbib} \begin{document} \bibliographystyle{plain} \bibliography{mybib} \end{document} </code></pre>
0non-cybersec
Stackexchange
332
942
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
Invertible matrices, permutations and leading principal minors. <p>Given an invertible $\{-1,0,1\}$-matrix $A$ (its determinant is $\pm 1$), are there two permutation matrices $P$ and $Q$ such that all the leading principal minors (determinants of the top-left sub-matrices) of $A' = P A Q$ are $\pm 1$?</p> <p>For example, $$ A = \left[ \begin{array}{cccc} 0 &amp; 1 &amp; 1 &amp; -1 \\ 0 &amp; 0 &amp; -1 &amp; -1 \\ 1 &amp; 1 &amp; 0 &amp; 1 \\ 1 &amp; 1 &amp; 0 &amp; 0 \end{array} \right], \quad \det(A) = 1 $$ and $$ A' = \left[ \begin{array}{cccc} 0 &amp; 1 &amp; 0 &amp; 0 \\ 0 &amp; 0 &amp; 1 &amp; 0 \\ 0 &amp; 0 &amp; 0 &amp; 1 \\ 1 &amp; 0 &amp; 0 &amp; 0 \end{array} \right] \cdot A \cdot \left[ \begin{array}{cccc} 0 &amp; 0 &amp; 0 &amp; 1 \\ 0 &amp; 0 &amp; 1 &amp; 0 \\ 1 &amp; 0 &amp; 0 &amp; 0 \\ 1 &amp; 1 &amp; 0 &amp; 0 \end{array} \right] = \left[ \begin{array}{cccc} -1 &amp; -1 &amp; 0 &amp; 0 \\ 0 &amp; 1 &amp; 1 &amp; 1 \\ 0 &amp; 0 &amp; 1 &amp; 1 \\ 1 &amp; -1 &amp; 1 &amp; 0 \end{array} \right] $$ accomplishes the condition.</p>
0non-cybersec
Stackexchange
464
1,065
Facebook Graph API : get larger pictures in one request. <p>I'm currently using <a href="https://developers.facebook.com/tools/explorer/">the Graph API Explorer</a> to make some tests. That's a good tool.</p> <p>I want to get the user's friend list, with friends' names, ids and pictures. So I type :</p> <pre><code>https://graph.facebook.com/me/friends?fields=id,picture,name </code></pre> <p>But picture is only 50x50, and I would like a larger one in this request.</p> <p>Is it possible ?</p>
0non-cybersec
Stackexchange
160
500
Passing error messages through flash. <p>What is the best way to push error messages on redirect to?</p> <p>I've previously used couple of approaches, but both of them has issue.</p> <p>(1) Passing the entire object with error on flash and using error_messages_for:</p> <pre><code> def destroy if @item.destroy flash[:error_item] = @item end redirect_to some_other_controller_path end </code></pre> <p>I found that this method causes cookie overflows.</p> <p>(2) Passing a single error message:</p> <pre><code> def destroy if @item.destroy flash[:error] = @item.full_messages[0] end redirect_to some_other_controller_path end </code></pre> <p>This way I only send a single error message, what if there are many? Does Anyone knows a better way?</p>
0non-cybersec
Stackexchange
251
798
Prove $f(0_n)=0_m$. <p>If $f: \mathbb{R}^n\rightarrow \mathbb{R}^m$ is a linear map, prove that $f(\boldsymbol{0}_n)=\boldsymbol{0}_m$</p> <p>Can someone explain how I would prove this? I understand that to be a linear map it must satisfy...</p> <p>1) $F(x+y)= F(x)+F(t)$ for all $x,y\in \mathbb{R}^n$</p> <p>2) $f(cx)=cF(x)$ for all $x\in \mathbb{R}^n$ and all scalar $c \in \mathbb{R}$</p> <p>But I understand how to apply this information into proving $f(\boldsymbol{0}_n)=\boldsymbol{0}_m$. </p>
0non-cybersec
Stackexchange
210
504
HDMI to VGA somehow zooming computer screen in. <p>So i recently purchased an Acer AL1916W from a garage sale (about 50 cents) and I planned to use it as a dual monitor to my computer (with an Staples-branded HDMI to VGA converter as my computer does not have a second VGA port). It worked fine for a while until I accidentally set it to a different resolution than its native 1440x900, and so now when I set it back the screen is very noticeably zoomed in (as in, the taskbar is only halfway visible and you cannot see to the right of the minimize button, i have windows). I was wondering if i could do anything about this? And what makes it even weirder is the fact that upon checking the "Info" section of the monitors menu, it originally said it was a 1440x900 resolution but now it says its 1400x1050. Also when i plug the computer in directly to the monitor it works fine (to be expected), and the same when i reverse it (plugging the first monitor into the HDMi converter, second into the VGA) it also works fine (my first is an Acer E202HL).</p> <p>edit 9/13: so its working fine now but only when on the "extend" mode, any other mode (duplicate, second screen only, etc) has the same problem described before</p>
0non-cybersec
Stackexchange
310
1,223
Does $\sum\limits_{n=1}^{\infty}\frac{\cos^{2}(n+1)}{n}$ converge?. <p>The original question, given to my Calculus II recitation class, was:</p> <p>Determine if the series <span class="math-container">$$\sum\limits_{n=1}^{\infty}\frac{(-1)^{n}\cos^{2}(n+1)}{n}$$</span></p> <p>converges absolutely, conditionally, or diverges. I can kind of see a comparison with the alternating harmonic series here, but making that formal is tough. With the absolute series <span class="math-container">$\sum\limits_{n=1}^{\infty} \frac{\cos^{2}(n+1)}{n}$</span>, I'm not sure what test to apply.</p> <p><strong>What I've Tried:</strong> No tests (in the classical Calc II curriculum) work. I've tried expanding <span class="math-container">$\cos^{2}(n+1)$</span> into a power series within the series in question, but I'm not really sure where to go from there. My intuition tells me this series will diverge, since it seems "close" to the harmonic series; but <span class="math-container">$\cos(x)$</span> is less than <span class="math-container">$1$</span> infinitely often. </p>
0non-cybersec
Stackexchange
323
1,072
How to insert a big brace, arrows crossing etc. <p>As english is not my primary language, I don't know how describe my problem the right way. But I have a picture of what I want to type.</p> <p>This is how far I have made it:</p> <pre><code>\documentclass[a4paper]{article} \usepackage{tikz-cd} \begin{document} \begin{tikzcd} Cr &amp; 3\downarrow \arrow[rd] &amp; 2Cr: &amp; 6\downarrow \\ C &amp; 2\uparrow \arrow[ru]&amp; 3C: &amp; 6\uparrow \end{tikzcd} \end{document} \ </code></pre> <p><a href="https://i.stack.imgur.com/vGVb6.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vGVb6.jpg" alt="enter image description here"></a></p> <p>Background: At my school we use this to show how to align(?) a redox-reaction.</p>
0non-cybersec
Stackexchange
270
753
Unexpressibility of a property in first order logic. <p>We can give a very general notion of what is to iterate a function. Given a set $\mathcal U$ and a function $f:\mathcal U \rightarrow \mathcal U$, then, <em>to iterate the function $f$</em> will mean to compose f with itself. We can also define $f_0=f$ and $f_n = f \circ f_{n-1}$for any $n \in \mathbb N$. With this notation, an <em>iteration of $f$</em> will be any of the functions $f_n$.</p> <p>Now comes the question. We are given a nonempty set $\mathcal U$, an elemtent $\alpha \in \mathcal U$ and a function $f:\mathcal U \rightarrow \mathcal U$. Can we express in first order logic the property that for any $x \in \mathcal U$ there exists an $n \in \mathbb N_0$ with $f_n(x)=\alpha$?</p> <p>More precisely: given a first order language $\mathcal L = \langle\mathcal U, =, c,f\rangle$ where $c$ is a constant symbol and $f$ is a unary function symbol, is the class of models with the aforementioned property definable in first order? That is, does there exists a first order sentence $\phi$ such that its satisfied only by the models of $\mathcal L$ with the property?</p> <p>I've been thinking about this for a while but nothing came out. I guess that the property is not definable in first order and that this can be proved using the compactness theorem, but I don't know how.</p> <p>If the property turns out to be undefinable it may be useful to construct models with unbounded $n$ to get a proof. For example, I took $\mathcal U = \mathbb N$, $c = 1$ and $f$ defined by $f(1)=1$ and $f(x)=x-1$ for any $x$ grater than $1$.</p> <p>Thanks</p>
0non-cybersec
Stackexchange
484
1,616
Existence of an injective continuous function $\Bbb R^2\to\Bbb R$?. <p>Let's say $f(x,y)$ is a continuous function. $x$ and $y$ can be any real numbers. Can this function have one unique value for any two different pairs of variables? In other words can $f(a,b) \neq f(c,d)$ for any $a$, $b$, $c$, and $d$ such that $a \neq c$ or $b \neq d$? I don't think there can at least not if the range of $f$ is within the real numbers. Could someone please offer a more formal proof of this or at least start me off in the right direction.</p>
0non-cybersec
Stackexchange
163
535
Entity to DTO Usage. <p>Been trying to come up with a flow for a basic tiered web application, and have been reading conflicting information online. What I'm trying to figure out is if there is an advantage to still using DTO objects from your DAO to Service layer through the use of some sort of mapper. </p> <p>The basic flow I foresee is as follows:</p> <ol> <li>UI Model / Form --> Controller</li> <li>Controller converts Model into Domain Object (Entity)</li> <li>Domain Object --> Service Layer</li> <li>Domain Object --> DAO</li> <li>DAO --> Domain Object(s)</li> <li>Service --> UI</li> <li>UI converts Domain into UI models</li> </ol> <p>If DTO was followed DAO would pass back a DTO not the Entity. After doing some reading it seems like DTO has become slightly defunct since (at least in Java) entities have become annotated POJOs meaning their memory footprint has become very small.</p> <p>Is this the case, or should DTOs be used to completely encapsulate the domain objects within the DAO layer, and, if this is the case, what would the service layer pass to the DAO?</p> <p>Thanks a bunch!</p>
0non-cybersec
Stackexchange
317
1,118
Why is $n_i \frac{\langle \alpha_i , \alpha_i \rangle}{\langle \alpha , \alpha \rangle}$ an integer?. <p>I'm stuck in this question and I would like some help.</p> <blockquote> <p><strong>Question:</strong> In a <a href="https://en.wikipedia.org/wiki/Root_system" rel="nofollow noreferrer">reduced root system</a> let <span class="math-container">$\alpha= n_1 \alpha_1 + ...+ n_k \alpha_k$</span> be a root such that each <span class="math-container">$\alpha_i$</span> is a simple root. Show that <span class="math-container">$$n_i \frac{\langle \alpha_i , \alpha_i \rangle}{\langle \alpha , \alpha \rangle} $$</span> is an integer.</p> </blockquote> <hr> <p>I tried things like writing</p> <p><span class="math-container">$$n_i \frac{\langle \alpha_i , \alpha_i \rangle}{\langle \alpha , \alpha \rangle} = n_i \frac{2\frac{\langle \alpha , \alpha_i \rangle}{\langle \alpha , \alpha \rangle}}{ 2\frac{\langle \alpha , \alpha_i \rangle}{\langle \alpha_i , \alpha_i \rangle}}, $$</span></p> <p>and somehow try to conclude that <span class="math-container">$\left.2\frac{\langle \alpha , \alpha_i \rangle}{\langle \alpha_i , \alpha_i \rangle}\right| n_i\cdot 2\frac{\langle \alpha , \alpha_i \rangle}{\langle \alpha , \alpha \rangle}$</span>. But this led me to anywhere.</p>
0non-cybersec
Stackexchange
445
1,288
VPN can access network drives by IP but not by computer name. <p>I have a VPN set up on my laptop. When I take it out of the office I can't access mapped network drives. I noticed that all my network drives went something like <code>\\THE-FILE-SERVER\Data</code>, but when I changed the computer name with actual local IP address so it became like this <code>\\192.168.1.5\Data</code> then I can access those shared drives via VPN.</p> <p>Why is that? Is there a way to make it so my netowrk drives that are mapped using file server's computer name instead of IP work both in the office and remotely via VPN? At the moment I have two same shared drives but one uses computer name (in the office it works) and one uses LAN IP(remotely on VPN works).</p> <p>I have "Use remote network default gateway" checked under TCP\IP 4 and 6 advanced settings.</p>
0non-cybersec
Stackexchange
223
854
Reference assembly in sqlproj not being deployed to server. <p>I have a Visual Studio 2013 Database Project which takes <a href="https://fastjson.codeplex.com/SourceControl/network/forks/zippy1981/SqlClr/contribution/6596" rel="noreferrer">a modified version</a> of <a href="https://fastjson.codeplex.com/" rel="noreferrer">fastJSON</a> as a reference. I selected Generate DDL in the reference properties as shown in this screenshot:</p> <p><img src="https://i.stack.imgur.com/U32k7.png" alt="fastJSON property panel"></p> <p>And in the .sqlproj msbuild file:</p> <pre><code>&lt;Reference Include="fastJSON"&gt; &lt;HintPath&gt;..\..\fastjson\output\net40\fastJSON.dll&lt;/HintPath&gt; &lt;GenerateSqlClrDdl&gt;True&lt;/GenerateSqlClrDdl&gt; &lt;/Reference&gt; </code></pre> <p>However bin/debug/Project.sql does not contain a line for <code>CREATE ASSEMBLY fastJSON . . .</code>. Adding the assembly manually works and my project will then deploy and run. What do I do to get Visual Studio to deploy my assembly?</p>
0non-cybersec
Stackexchange
330
1,026
Doorkeeper resource owner credential flow for multiple models. <p>The problem I'm having is that I'm using doorkeepers <a href="https://github.com/doorkeeper-gem/doorkeeper/wiki/Using-Resource-Owner-Password-Credentials-flow">resource owner credential flow</a> to authenticate a user from an iOS app. My project has two separate user models though (let's call them User and Admin). My code looks like this:</p> <pre><code>resource_owner_from_credentials do |routes| user = User.find_for_database_authentication(:email =&gt; params[:username]) user if user &amp;&amp; user.valid_password?(params[:password]) end </code></pre> <p>It works but how do I do a check for admin also? In other words I don't know if the person logging in is a user or admin - how do I check for both?</p>
0non-cybersec
Stackexchange
224
786
Get Spacemacs/Emacs GUI version to recognize nix-shell environment. <p>I do my development in a Nix shell (create a default.nix file in my project root and then run <code>nix-shell .</code> to give me a shell with access to the project dependencies).</p> <p>Spacemacs is my main editor, but when I try to run the GUI version via <code>emacs &amp;</code> I don't have access to the programs in my nix-shell (if I were in a Ruby on Rails project for example, and Ruby was declared as a dependency in my <code>default.nix</code>, I would have no syntax highlighting in Spacemacs because the GUI version of Emacs doesn't see my Nix-shell dependencies). If I run <code>:!which ruby</code>, it can't even find the <code>which</code> command.</p> <p>Right now, I'm running spacemacs via <code>emacs -nw</code> and just using it from the console, but I would really like to be able to use the GUI editor and get the full colorschemes available rather than being limited to the ones that look nice in 256 color mode. It's also quicker for me to switch between the terminal and the editor than between tmux panes or terminal splits to get to my CLI editor.</p> <pre><code>with import &lt;nixpkgs&gt; {}; { cannyFreeRadicalEnv = stdenv.mkDerivation rec { name = "rails-project-env"; version = "0.1"; src = ./.; buildInputs = [ stdenv ruby_2_2_2 bundler zlib postgresql94 sqlite zsh git nodejs-0_12 ]; }; } </code></pre>
0non-cybersec
Stackexchange
443
1,510
Ignoring redefined label. <p>How can I make LaTeX ignore a <code>\label</code> that is re-used? That is, if I define a label twice, and then cross-reference it, I would like the reference to indicate the first definition of the label.</p> <p>For example, in this MWE:</p> <pre><code>\begin{document} \begin{equation} x^2=2 \label{l1} \end{equation} \begin{equation} x^2=3 \label{l1} \end{equation} See the equation in \eqref{l1} \end{document} </code></pre> <p>Then I would like the sentence to read '... in (1)' and not '... in (2)'.</p>
0non-cybersec
Stackexchange
197
550
How to decode HTML entities in Rails 3?. <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/1600526/how-do-i-encode-decode-html-entities-in-ruby">How do I encode/decode HTML entities in Ruby?</a> </p> </blockquote> <p>I would like to convert strings like this:</p> <pre><code>"I&amp;#39;m working" </code></pre> <p>to</p> <pre><code>"I'm working" </code></pre> <p>(i.e. decode HTML entities)</p> <p>What Ruby/Rails function does the trick ?</p> <p>I want to use this function in the model.</p>
0non-cybersec
Stackexchange
208
559
copy files created in one folder to multiple other folders on linux. <p>I'm looking for a way to copy photos that are uploaded to one folder to many other folders and visa versa. </p> <p>Example: a photo is uploaded to folder 1, it is then copied to folders 2-5. And if a photo is uploaded to folder 2 it is copied to folders 1 and 3-5. </p> <p>I'm running CentOS 5. All of these folders are on the same server. </p> <p>I came across another post on here that talked about incron, but that type of programming is over my head. </p>
0non-cybersec
Stackexchange
149
535
Why can&#39;t I convert an object (which is really object[]) to string[]?. <p>I have a field that is of type 'object'. When I inspect it within the Watch window of visual studio I see its Object[] and when I drill into the elements I see each element is a string.</p> <p>But when I try to cast this to a String[] I get this error:</p> <blockquote> <p>Cannot cast 'MyObject' (which has an actual type of 'object[]') to 'string[]' string[]</p> </blockquote> <p>Any reason why I can't do this cast? What is the best way to convert this object to a string array?</p>
0non-cybersec
Stackexchange
170
570
Motherboard has one HDMI port but supports three monitors. How can it?. <p>I am looking at an <a href="https://www.asus.com/Motherboards/Z87MPLUS/specifications/" rel="nofollow noreferrer">Asus motherboard</a> and it says :</p> <pre><code>Integrated Graphics Processor Multi-VGA output support : HDMI/DVI-D/RGB ports - Supports HDMI with max. resolution 4096 x 2160 @ 24 Hz / 2560 x 1600 @ 60 Hz - Supports DVI-D with max. resolution 1920 x 1200 @ 60 Hz - Supports RGB with max. resolution 1920 x 1200 @ 60 Hz Maximum shared memory of 1024 MB Supports Intel® InTru™ 3D, Quick Sync Video, Clear Video HD Technology, Insider™ Supports up to 3 displays simultaneously </code></pre> <p>Having read the manual it's not clear if the three monitors it supports are {1 HDMI + 1 DVI-D and 1 RGB} or {3 HDMI covering the 4096*2160 area}.</p> <p>I'd ideally like to support three HDMI monitors (without buying a graphics card), ie, to get the 4096 * 2160 split over two or three monitors with HDMI .</p> <p>I'm noting looking to do any gaming, I just want a really good home set up for web dev and general computing. As I'm not going to be gaming I'd rather not get a separate graphics card.</p> <p>Am I unaware of an obvious trick to support three monitors from a single port? Or do I have to get a graphics card to support multiple monitors via the same interface? Or (given that I have only one monitor at present) aim to get the subsequent ones over different interfaces? Although I have read that <a href="https://superuser.com/a/407152/325591">using a VGA port with a modern monitor is a waste of time</a>.</p>
0non-cybersec
Stackexchange
463
1,618
The context is being used in Code First mode with code that was generated from an EDMX file for either Database First or Model First development. <p>I m trying to migrate a project initially developed using EF4 to EF6, to take advantage of EF6 transactions management.</p> <p>The problem I m facing is that the project has been created using the Database First approach, so when I m using code like <code>context.Database.UseTransaction</code>, I m encountering the following error:</p> <pre><code>The context is being used in Code First mode with code that was generated from an EDMX file for either Database First or Model First development. </code></pre> <p>This exception triggers inside the <code>OnModelCreating</code> method of my <code>DbContext</code> class.</p> <p>Any idea ?</p> <p>Thanks</p> <p><strong>EDIT:</strong></p> <p>The thing is that it's legacy code using EDMX with database first approach. I have to implement EF6 transactions inside this project, so it should now be more like a code first pattern.</p> <p>In addition, here's the context class:</p> <pre><code>public class MyContext : BaseDbContext { public MyContext (DbConnection existingConnection, bool contextOwnsConnection) : base(existingConnection, contextOwnsConnection) { } } </code></pre> <p>And the connection string:</p> <pre><code> &lt;add name="CS" connectionString="Data Source=MyServ;Initial Catalog=MyDBName;User Id=MyUser;Password=MyPwd;Pooling=True;Min Pool Size=5;Max Pool Size=20;Persist Security Info=True;MultipleActiveResultSets=True;Application Name=EntityFramework;Enlist=false" providerName="System.Data.EntityClient" /&gt; </code></pre> <p>I tried setting the <code>providerName</code> to <code>System.Data.SqlClient</code> but it doesn't change anything.</p> <p>Please note that the original connection string was in the database first format:</p> <pre><code>&lt;add name="OrderManagement" connectionString="metadata=res://*/MyManagementModel.csdl|res://*/MyManagementModel.ssdl|res://*/MyManagementModel.msl;provider=System.Data.SqlClient;provider connection string=&amp;quot;Data Source=MyServer;Initial Catalog=MyDBName;User Id=MyUser;Password=MyPwd;Pooling=True;Min Pool Size=5;Max Pool Size=20;Persist Security Info=True;MultipleActiveResultSets=True;Application Name=EntityFramework&amp;quot;" providerName="System.Data.EntityClient" /&gt; </code></pre> <p>If I try to open a connection whilst I keep the connection string in the database first format, I m facing the exception <code>Keyword metadata not supported</code>, and when I put the connection string on the code first format, I m facing the error <code>The context is being used in Code First mode with code that was generated from an EDMX file for either Database First or Model First development.</code></p>
0non-cybersec
Stackexchange
776
2,844
I feel like I'm a terrible person. but I can't help but hating my stepson. He's 6, just a kid and dumb as a brick. He has the personality of his mother, lies, and has no social skills. I cannot stand spending time with him. Unfortunately we do not get him for long enough periods of time to do any real progress. I feel like a terrible person, because I genuinely do like kids, for the most part. The awful ones I'm not a fan of. He happens to fall under that category. I've tried for so long to look past the reasons I don't like spending time with him and I'm ashamed that I could feel this way about a child. I can't tell my husband because he feels like since he is a part of him, I should love him, but it just doesn't work like that. Unless I really am the worst person in the world (not just the worst stepmother)
0non-cybersec
Reddit
203
825