text
stringlengths
36
35k
label
class label
2 classes
source
stringclasses
3 values
tokens_length
int64
128
4.1k
text_length
int64
36
35k
Parameter on $\mathrm{SU}(4)$ and $\mathrm{SU}(2)$. <p>From my reading, $\mathrm{SU}(4)$ has 15 parameters and $\mathrm{SU}(2)$ has 3 paramaters that range differently with certain parameter (rotation angle). And all the parameter is linearly independent to each other.</p> <p>My question are:</p> <ol> <li>What the characteristic of each of the parameter? </li> <li>If I choose two of them, what is the reason behind the theory? </li> <li>Can anyone explain to me or suggest any book/paper to me to understand the parameter itself.</li> </ol>
0non-cybersec
Stackexchange
158
549
hardlinks seem to take several hundred bytes just for the link itself (not file data). <h2>Additional Info</h2> <p>Firstly, thank you for all the answers.</p> <p>So I re-ran the tests again to test the answer below that a directory/folder entry takes up 4KB and this was skewing my numbers, so this time by placing 20,000 files in a single directory and doing the cp -al to another directory. The results were very different, after taking off the length of the filenames, the hardlinks worked out to about 13 bytes per hardlink, much better than 600. Ok, so then for completeness working on the answer given below that this is due to each entry for a directory/folder taking up 4KB I did the test again, but this time I created thousands of directories and placed one file in each directory. The result after the maths (increased space taken on hd / by number of files (ignoring directories) was almost exactly 4KB for each file, showing that a hardlink does only take up a few bytes but that an entry for an actual directory/folder takes 4KB.</p> <hr> <p>So I was thinking of implementing the rsync / hardlink /snapshot backup strategy and was wondering how much data a hardlink took up, like it has to put an entry for the extra link as a directory entry etc. Anyway I couldn't seem to find any information on this and I guess it is file system dependent. The only info I could find was suggestions they took no space (probably meaning they take no space for file contents), to the space they take is negligible to they only take a few bytes to store the hardlink.</p> <p>So I took a couple of systems (one a vm and one on real hardware) and did the following in the root directory as root:</p> <pre><code>mkdir link cp -al usr link </code></pre> <p>The <code>usr</code> directory had about 54,000 files. The space used on the hd increased by about 34MB. So this works out around 600 bytes per hardlink, or am I doing something wrong?</p> <hr> <p>I am using LVM on both systems, formatted as ext4.</p> <p>The file name size is about 1.5MB altogether (I got that by doing ls -R and redirecting it to a file).</p> <p>To be honest, the rsync with hardlinks works so well I was planning on using it for daily backup on a couple of the work servers. I also thought it would be easy to make incremental backups / snapshots like this for a considerable period of time. However, after ten days 30mb is 300mb and so on. In addition if there have only been a few changes to the actual file data/contents, say a few hundred KB then storing 30+ MB of hardlinks per day seemed excessive, but I take your point about the size of modern disks. It was simply that I had not seen this hardlink size mentioned anywhere that I thought I may be doing something wrong. Is 600 bytes normal for a hardlink on a Linux OS?</p> <p>To calculate the space used I did a <code>df</code> before and after the <code>cp -al</code>.</p>
0non-cybersec
Stackexchange
756
2,928
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
&quot;Differentiate without color&quot; setting in Accessibility System Preferences. <p>In the <strong>Accessibility</strong> preference pane of <strong>El Capitan</strong>'s <strong>System Preferences</strong>, I've noticed a "<em>Differentiate without color</em>" setting that I didn't notice before.</p> <p><a href="https://i.stack.imgur.com/0V4RY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0V4RY.png" alt="enter image description here"></a></p> <p>Does anyone know to what extent this setting will change the experience of <strong>Finder</strong>?</p> <p>I couldn't find much in the help and <a href="http://forums.macrumors.com/threads/differentiate-without-color.1784161/" rel="nofollow noreferrer">the only link I found about this</a> was very succinct (I can't believe this setting only acts on the dots of this exemple).</p> <p>I would love to know exactly how toggling this setting would affect the Mac's OS display, and its apps.</p>
0non-cybersec
Stackexchange
291
973
Can Amazon Elastic Beanstalk auto-scale Amazon RDS?. <p>I'm planning to run a PHP/MySQL application using Amazon Elastic Beanstalk. In the settings I can define when it should launch new instances automatically (Auto-Scaling).</p> <p>However, as I understand this, this only creates new EC2-Instances and does not touch the RDS-Data-Layer (which I also configured in the settings).</p> <p>Is there any way to auto-scale this RDS, with automated Read-Replicas or database size upgrade, or do I have to do this manually in some way?</p>
0non-cybersec
Stackexchange
148
538
SonarQube: Mutable members should not be stored or returned directly. <p>This is my code so far:</p> <pre><code>public class RestApplication extends Application { private final Set&lt;Class&lt;?&gt;&gt; resourceSet; public RestApplication() { this.resourceSet = new HashSet&lt;Class&lt;?&gt;&gt;(); resourceSet.add(PCardController.class); resourceSet.add(PricingController.class); resourceSet.add(TransactionFeedController.class); initializeMaps(); } @Override public Set&lt;Class&lt;?&gt;&gt; getClasses() { return resourceSet; // ... } // Added by edit! // ... } // Added by edit! </code></pre> <p>SonarQube says that the return of a copy is a resource set.<br> How can I do that?</p>
0non-cybersec
Stackexchange
241
739
Name of a &quot;normalized&quot; second moment. <p>I am asking myself how this second moment would be referred to in English:</p> <p><span class="math-container">$$ \frac{E(X^2)} {(EX)^2} $$</span></p> <p>I would have called it standardized for instance, but for example <a href="https://en.wikipedia.org/wiki/Standardized_moment" rel="nofollow noreferrer">Wikipedia</a> refers to standardized moments as something different. Sorry, not a native speaker...</p>
0non-cybersec
Stackexchange
139
463
What are these ip adresses my computer is connected and how do I block them if they are malicious?. <p>When I execute a netstat command i see several ip-adresses that have connection to my pc and I don't what they are for. These are the ip's. </p> <pre><code> TCP 192.168.1.20:1042 fa-in-f125:5222 HERGESTELLT TCP 192.168.1.20:1238 we-in-f100:http HERGESTELLT TCP 192.168.1.20:1281 bru01m01-in-f82:http HERGESTELLT TCP 192.168.1.20:1282 bru01m01-in-f82:http HERGESTELLT TCP 192.168.1.20:1283 bru01m01-in-f82:http HERGESTELLT TCP 192.168.1.20:1284 bru01m01-in-f82:http HERGESTELLT TCP 192.168.1.20:1285 bru01m01-in-f82:http HERGESTELLT TCP 192.168.1.20:1289 bru01m01-in-f138:https HERGESTELLT TCP 192.168.1.20:1294 bru01m01-in-f101:http HERGESTELLT TCP 192.168.1.20:1295 bru01m01-in-f138:http HERGESTELLT TCP 192.168.1.20:1296 bru01m01-in-f101:http HERGESTELLT TCP 192.168.1.20:1297 ww-in-f132:http HERGESTELLT TCP 192.168.1.20:1298 bru01m01-in-f191:http HERGESTELLT TCP 192.168.1.20:1299 bru01m01-in-f191:http HERGESTELLT TCP 192.168.1.20:1300 bru01m01-in-f191:http HERGESTELLT TCP 192.168.1.20:1301 bru01m01-in-f191:http HERGESTELLT TCP 192.168.1.20:1302 bru01m01-in-f191:http HERGESTELLT TCP 192.168.1.20:1303 fra07s07-in-f113:http HERGESTELLT TCP 192.168.1.20:1304 bru01m01-in-f191:http HERGESTELLT TCP 192.168.1.20:1310 mil01s16-in-f18:http HERGESTELLT TCP 192.168.1.20:1316 mil01s16-in-f18:http HERGESTELLT TCP 192.168.1.20:1318 193.247.193.85:https HERGESTELLT TCP 192.168.1.20:1334 server-216-137-61-177:http HERGEST TCP 192.168.1.20:1381 46.105.131.100:http HERGESTELLT TCP 192.168.1.20:1410 87.252.216.36:https HERGESTELLT TCP 192.168.1.20:1412 87.252.210.40:http HERGESTELLT TCP 192.168.1.20:1425 mil01s16-in-f18:http HERGESTELLT </code></pre> <p>How do I find out if they are malicious, for example a connection opened by a troyaner. And how do I block them?</p>
1cybersec
Stackexchange
948
2,235
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
UFD, prime and Irreducible. <p>I am taking following definitions and calling algebraic structure U1 and U2 definition as: </p> <p>U1 is A ring R with unity and properties properties</p> <ol> <li><p>Every element of R is neither 0 nor a unit can be factored into a product of finite no. of <strong>primes</strong></p></li> <li><p>And factorization unique upto associates.</p></li> </ol> <p>U2 is A ring R with unity and properties properties</p> <ol> <li><p>Every element of R is neither 0 nor a unit can be factored into a product of finite no. of <strong>irreducible</strong></p></li> <li><p>And factorization unique upto associates.</p></li> </ol> <p>Are U1 and U2 equivalent? What if I include commutative condition also? Does there exist structure like this? What is example of U2 which is not UFD?(if possible)</p> <p>Note: a and b Associate means if a=ub or a = bv then u and v are unit</p>
0non-cybersec
Stackexchange
283
903
Bootstrap 4 - Change breakpoint navbar?. <p>This question was already asked <a href="https://stackoverflow.com/questions/36329305/bootstrap-4-responsive-navbar">here</a> but this don't work because of the Javascript. So in the provided answer only the CSS was changed but not the JS, which means the content of the nav bar is still visible while the toggler is not. Any solution?</p> <p>Edit:</p> <p>My question is how to change the breakpoint of the nav bar in Bootstrap 4.xx</p>
0non-cybersec
Stackexchange
135
483
React Native pass function to child component as prop. <p>I'm new to React Native (and React), and I'm trying to pass a function as a prop to a component.</p> <p>My goal is to create a component where its onPress functionality can be set by the instantiator of the component, so that it is more reusable.</p> <p>Here is my code so far.</p> <p>App.js</p> <pre><code>import React, { Component } from 'react'; import { View } from 'react-native'; import TouchableButton from './components/touchable-button'; export default class App extends Component&lt;Props&gt; { constructor () { super(); } handlePress () { // this should be called when my custom component is clicked } render () { return ( &lt;View&gt; &lt;TouchableButton handlePress={this.handlePress.bind(this)}/&gt; &lt;/View&gt; ); } } </code></pre> <p>TouchableButton.js</p> <pre><code>import React, { Component } from 'react'; import { TouchableHighlight } from 'react-native'; import AppButton from "./app-button"; export default class TouchableButton extends Component { handlePress; constructor(props){ super(props); } render () { return ( &lt;TouchableHighlight onPress={ this.props.handlePress }&gt; &lt;AppButton/&gt; &lt;/TouchableHighlight&gt; ); } } </code></pre> <p>I am passing the handlePress function as the prop handlePress. I would expect the TouchableButton's props to contain that function, however it isn't there.</p>
0non-cybersec
Stackexchange
457
1,512
Is a map $G$ composed with a local diffeomorphism smooth iff $G$ is smooth?. <p>Suppose <span class="math-container">$F: M \to N$</span> is a local diffeomorphism between smooth manifolds. </p> <p><span class="math-container">$(a)$</span> Let <span class="math-container">$G: P \to M$</span> be a continuous map between smooth manifolds. Then <span class="math-container">$G$</span> is smooth if and only if <span class="math-container">$F \circ G$</span> is smooth.</p> <p><span class="math-container">$(b)$</span> Let <span class="math-container">$H: N \to P$</span> be any map between smooth manifolds and in addition assume <span class="math-container">$F$</span> is surjective. Then <span class="math-container">$H$</span> is smooth if and only if <span class="math-container">$H\circ F$</span> is smooth.</p> <p>Is it possible to strengthen this result? Perhaps by dropping the requirement that <span class="math-container">$G$</span> is continuous in <span class="math-container">$(a)$</span> or <span class="math-container">$F$</span> surjective in <span class="math-container">$(b)$</span>?</p>
0non-cybersec
Stackexchange
340
1,107
Implicit/Explicit Assertions. <p>During code review, a minor suggestion was presented that some implicit behavior be made explicit. The reviewer had skimmed over the code in question, became confused after mistakenly interpreting the code's purpose, and only discovered the cause after some careful analysis. Below are the implicit practice and suggested practice, in that order:</p> <pre><code>stuffLookup = {--[[functions in here]]} function doStuff(stuffType, ...) assert(stuffLookup[stuffType], "stuffType is not a valid stuff!")(...) end function doStuff2(stuffType, ...) if stuffLookup[stuffType] then stuffLookup[stuffType](...) else error("stuffType is not a valid stuff") end end </code></pre> <p><code>assert</code> is frequently used without invoking another function as in this case, so at first glance the reviewer did not see such a small invocation at the end of assert, and assumed the line served no purpose past a sanity check.</p> <p>The argument in favor of practice 1 was that it's syntactically correct, that it's used in Lua docs, that it's faster, and that if someone didn't anticipate assert being used like that it was their own fault. The argument in favor of practice 2 was that the nature of practice 1 could easily be misunderstood, that it was an implicit idiosyncrasy that wasn't legible enough, and that considering performance was premature optimization (code was not designed to be used frequently and table lookup time was negligible).</p> <p>Are there any merits to the concerns and viewpoints of either party?</p>
0non-cybersec
Stackexchange
371
1,566
Looking for a snowy destination for December for a family from SoCal. My family is considering going on a vacation for winter break this year. We are from Southern Califonia, so we'd like to go to a place that has some snow. We like some outdoor activities, hiking, snowboarding, fishing, stuff like that. My mom and sister would also prefer some shopping, though I personally would like to see one of the national parks. We're hoping to be able to rent some sort of cabin. We used to live in Portland, OR (and have thus been to Seattle often), so we'd like to stay away from there and see other places. Any suggestions or ideas for a location? Is what we're looking for too unrealistic? Thanks Edit: Forgot to say we'd like to stay stateside
0non-cybersec
Reddit
172
747
Azure Graph API C# Client - Unable to get user&#39;s Manager object. <p>User's manager object is always null when i try to retrieve a user. But i get "objectId", which is the corresponding manager(user) GUID. I can use this GUID to get Manager from API calls or from <a href="https://graphexplorer.cloudapp.net" rel="noreferrer">https://graphexplorer.cloudapp.net</a> but not from Graph Client using C# (even with 2.1.0 version: <a href="https://www.nuget.org/packages/Microsoft.Azure.ActiveDirectory.GraphClient" rel="noreferrer">https://www.nuget.org/packages/Microsoft.Azure.ActiveDirectory.GraphClient</a>).</p> <p>Can someone guide me on this? Thanks in advance.</p>
0non-cybersec
Stackexchange
204
674
Running computations on a remote server using 2 possible methods. Which is ideal?. <p>So, this is more of a general question than a specific problem. I'm using AWS and I have my main web server on an m1.medium instance but there are some computationally intensive tasks that I want to run so I created an high compute (multicore, high speed) c1.medium instance as well. </p> <p>I was thinking of putting all the scripts I want to run in the compute server. These are obviously separate volumes but I wanted to know which would be a better approach.</p> <ol> <li>SSH + call the script on the compute server or</li> <li>NFS mount the compute server and call the script</li> </ol> <p>I'm fairly sure I know the behavior of #1 but I'm not sure about #2. If I did that would it use the CPU on the compute instance? Because that's the whole point in splitting them</p>
0non-cybersec
Stackexchange
226
866
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 CAN THIS BE BUILT? - Single operating system for 950 sqft., 2 bedroom apartment. Access points are 3 touchscreens (one in each room), at least 24"; they will be wall-mounted and can autorotate (like a mobile device).. This is for an in-house command center. Somehow this build needs to be controlled by a tablet that I can use as a free screen for the home OS. *This is a redux of an old deleted post. My "dream-wall PC" concept is attached [here.](http://imgur.com/NCd0NOB)* EDIT*I want my own JARVIS, even if it's the "dumbest" kind that I have to build myself. Ideally, I'd like to walk into any room with a tablet and throw the screen contents onto the nearest display (one might call this "Minority Report-style). My research led me to one possibility, via WiFi-based screen-linking software called Pinch (Verge article link [here,](https://www.theverge.com/2012/11/1/3584632/pinch-smartphone-tablet-synchronized-display-link-interface-app) 2nd video [here.](https://www.youtube.com/watch?v=d8JvZTHh8Xs)) I hope someday to be able to control some of the software I'm running via voice control, but that's assuming that Amazon, Google or Apple end up building out their assistants to be compatible with a wider range of products to allow the level of deep customization that I'd ultimately want to have. Realistically, this will just be running Windows, with the option of a VM running stock Android. :) My budget is around $10K USD. If I can come in lower than that, hooray. If it needs to go higher, I'm flexible. ...I don't want to see any wires, at all. In order of preference, it would be 1) wall-mounted screen with sheathed power cord running down the wall, and the signal coming in via wireless HDMI transmitters, -or- 2) somehow having each monitor attached to a client PC, with a central server in a closet connected via ethernet. In my research, I've found no "plug-and-play" options to bring this vision together. I've been brainstorming this for over a year now, either trying to rearrange/ reconfigure my plans or looking around for some new tech development that would make my vision easier to implement. I've listed my journey below: * 1) There are no touchscreen monitors below 40" that have both a high-resolution display and multitouch capability, which *also* has a rotation detection/ accelerometer built into it. * 2) I haven't found anything besides REMIX OS that would allow me to run a full window version of Android on an Intel or AMD based PC, not to mention that REMIX doesn't yet support touchscreen. * 3) I've considered building a powerful PC with multiple monitor support, then attaching wireless HD transmitters to flat screens in each room. But this doesn't solve the touchscreen problem. * 4) I've considered "making" my own touch screens by purchasing aftermarket touch screen panels, then mounting them to flat screens, but the sizes are much larger than I want for my desired application, and this still doesn't solve the auto-rotate issue. * 5) I've looked into rotation scripts that would detect a wall mounted screen being swiveled, and even found a company that "almost" does what I want [Potrait - Screen Rotation](http://www.portrait.com/technology/screen-rotation.html); it's the closest I've found to solving the issue, but I want to make sure the system I want can support multiple monitors before I sink cash into software. I would like to find a way to make this seamless, grand vision happen, but I'm at a loss and I'm reaching out to those with fresh eyes and ideas.
0non-cybersec
Reddit
876
3,539
Check string content of response before retrying with Polly. <p>I'm working with a very flaky API. Sometimes I get <code>500 Server Error</code> with <code>Timeout</code>, some other time I also get <code>500 Server Error</code> because I gave it input that it can't handle <code>SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.</code>.</p> <p>Both of these cases give me <code>HttpRequestException</code> but I can look into the reply message from the server and determine the cause of the exception. If it is a timeout error, I should try again. If it is a bad input I should re-throw the exception, because no amount of retries will fix the problem of bad data.</p> <p>What I'd like to do with Polly is to check on response message before attempting to retry. But all the samples I've seen so far only included type of exception.</p> <p>I've come up with this so far:</p> <pre><code> HttpResponseMessage response = null; String stringContent = null; Policy.Handle&lt;FlakyApiException&gt;() .WaitAndRetry(5, retryAttempt =&gt; TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)), async (exception, timeSpan, context) =&gt; { response = await client.PostAsync(requestUri, new StringContent(serialisedParameters, Encoding.UTF8, "application/json")); stringContent = await response.Content.ReadAsStringAsync(); if (response.StatusCode == HttpStatusCode.InternalServerError &amp;&amp; stringContent.Contains("Timeout")) { throw new FlakyApiException(stringContent); } }); </code></pre> <p>Is there a better way to do this kind of checking?</p>
0non-cybersec
Stackexchange
460
1,757
How to draw a smooth continuous line with mouse using html canvas and javascript. <p>I'm attempting to create a simple draw/paint programme using html5 canvas and plain javascript. I've got it working ok, but when drawing and moving the mouse too fast the line disconnects and I just end up with a line of dots - how can I make this a smooth continuous line?</p> <p>Advice would be much appreciated! I'm quite new to JS so code examples would be really useful, thanks in advance.</p> <p>Current JS is:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var canvas, ctx var mouseX, mouseY, mouseDown = 0 function draw(ctx,x,y,size) { ctx.fillStyle = "#000000" ctx.beginPath() ctx.arc(x, y, size, 0, Math.PI*2, true) ctx.closePath() ctx.fill() } function clearCanvas(canvas,ctx) { ctx.clearRect(0, 0, canvas.width, canvas.height) } function onMouseDown() { mouseDown = 1 draw(ctx, mouseX, mouseY, 2) } function onMouseUp() { mouseDown = 0 } function onMouseMove(e) { getMousePos(e) if (mouseDown == 1) { draw(ctx, mouseX, mouseY, 2) } } function getMousePos(e) { if (!e) var e = event if (e.offsetX) { mouseX = e.offsetX mouseY = e.offsetY } else if (e.layerX) { mouseX = e.layerX mouseY = e.layerY } } function init() { canvas = document.getElementById('sketchpad') ctx = canvas.getContext('2d') canvas.addEventListener('mousedown', onMouseDown, false) canvas.addEventListener('mousemove', onMouseMove, false) window.addEventListener('mouseup', onMouseUp, false) } init();</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;canvas id="sketchpad" width="500" height="500"&gt;&lt;/canvas&gt;</code></pre> </div> </div> </p>
0non-cybersec
Stackexchange
653
1,954
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
Lexicographically order matrix into a vector. <p>I am trying to implement the algorithm contained in <a href="https://ieeexplore.ieee.org/abstract/document/995059" rel="nofollow noreferrer">this article here</a>. It is about solving a 2 and 2.5D Fredholm integral, focused on bidimensional NMR experiments. I've made significant progress, despite this being my very first time doing any computational science. The output I get is clearly wrong, but seems shifted from what would be ideal. I am trying to stamp out problematic areas, and am wondering if I interpreted this passage wrong:</p> <blockquote> <p>In principle, the 2-D problem in (2) can be reduced to a 1-D problem <span class="math-container">$m_r = K_0f_r + \epsilon_r \quad r=1,...,R$</span>. Here, the vectors <span class="math-container">$m_r$</span>, <span class="math-container">$f_r$</span> and <span class="math-container">$e_r$</span> are obtained by lexicographically ordering matrices <span class="math-container">$M_r$</span>, <span class="math-container">$F_r$</span>, <span class="math-container">$E_r$</span>.</p> </blockquote> <p>For reference, eq (2) that they mention is the Fredholm integral we are trying to solve, which relates the measured data <span class="math-container">$M_r$</span> and the joint probability distribution <span class="math-container">$\mathcal{F}_r$</span> of the relaxation times (x, y):</p> <p><span class="math-container">$$M_r(\tau_1,\tau_2) = \int \int k_1(x, \tau_1)k_2(y, \tau_2)\mathcal{F}_r(x,y)dxdy + \epsilon_r(\tau_1,\tau_2) \quad r=1,...,R$$</span></p> <p>According to the text, the shape of <span class="math-container">$M_r$</span> is <span class="math-container">$N_1\times N_2$</span> and <span class="math-container">$m_r$</span> is <span class="math-container">$(N_1N_2\times 1)$</span>. I thought I could use a simple reshape, but looking at definitions of <em>lexicographic</em>, there seems to be a sort involved. So, which one of these two python snippets is right? Or is it something else entirely?</p> <ul> <li><code>m_r = np.sort(M_r, axis=None)[:, np.newaxis]</code> or</li> <li><code>m_r = M_r.reshape((N1*N2, 1))</code>?</li> </ul> <p>Later, they also state that</p> <blockquote> <p>The matrix <span class="math-container">$F_r$</span> is estimated by reordering <span class="math-container">$f_r$</span> into the matrix notation.</p> </blockquote> <p>So, I could do a simple <code>reshape</code> back. But if I have to unsort <span class="math-container">$F_r$</span>, which has the shape <span class="math-container">$N_x \times N_y$</span>, I am lost.</p>
0non-cybersec
Stackexchange
874
2,605
accessing data using datatool when headers aren&#39;t available. <p>I have a series of <code>csv</code> files I'm expecting to receive on a regular basis, and there are two problems with these files. </p> <ol> <li>I am not guaranteed to have headers.</li> <li>I cannot rely on how many data entries there will be per row (sometimes there may be 50 or so, sometimes more)</li> </ol> <p>What I am guaranteed is that, let's say, the 1st, 10th, and 30th column have the data I want. Up until now I've been using a perl script to <em>collapse</em> these <code>csv</code> files to something where the rows have only the elements I'm interested in.</p> <p>Is there a way in <code>datatool</code> to tell it to create headers for certain columns and ignore the rest?</p> <p>For example, it would be nice to be able to do something like the following:</p> <pre><code>\DTLloaddb[noheader,headers={modelname=1,serialnumber=10,weight=30}]{itemweights}{somefile.csv} </code></pre> <p>which would mean that <code>modelname</code> is in the first column, <code>serialnumber</code> is in the 10th column and <code>weight</code> is in column 30.</p> <p>Here is an extremely simplified example of a <code>csv</code> file I might work with.</p> <pre><code> "toaster", "", "", "", "234-02015-23-948", "", "", "", "", "", "1255", "", "" "blender", "junk", "", "", "753-20842-46-824", "", "", "junk", "", "", "1567", "" "microwave", "", "", "stuff", "376-73178-68-487", "", "", "", "junk", "", "2434", "", "", "" "radio", "", "stuff", "junk", "724-86499-61-446", "", "", "", "junk", "", "2343" "tv", "", "", "", "423-90219-60-149", "", "junk", "", "", "", "3023", "", "", "" </code></pre> <p>A solution that creates a header for every column is completely infeasible because I have upwards of 50 columns only 3 or 4 of which I'm interested in. </p> <p>What I'd like to be able to do is write:</p> <pre><code>\DTLloaddb[noheader,headers={appliance=1,serialnumber=5,detailnumber=11}]{itemweights}{somefile.csv} </code></pre>
0non-cybersec
Stackexchange
762
2,196
How do I disable Hibernate foreign key constraint on a bidirectional association?. <p>I am trying to disable the foreign key constraint being generated on my bidirectional association. I have managed to do this for all my unidirectional associations, but for some reason it is not working here.</p> <p>I do know about the bug with <em>ContraintMode.NO_CONSTRAINT</em> that was recently fixed in Hibernate 5.x, and I am running the latest Hibernate 5.2.6.</p> <p>My annotations presently look like this:</p> <pre><code>class Parent { @OneToMany(mappedBy="parent", cascade=CascadeType.ALL, orphanRemoval=true) @OrderColumn(name="childIndex") public List&lt;Child&gt; getChildren() { return children; } } class Child { @ManyToOne(optional=false) @JoinColumn(name="parent", foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT)) public Parent getParent() { return parent; } } </code></pre> <p>But despite NO_CONSTRAINT, Hibernate is still creating the foreign key constraint on child.parent -> parent.id.</p> <p>Is there something additional I need to do to suppress the foreign key for the bidirectional case?</p> <p>Thanks!</p>
0non-cybersec
Stackexchange
345
1,167
$\int_{\mathbb R} |f(x)| dx &lt; \infty \implies \sum_{n\in \mathbb Z} |f(n)| &lt; \infty $?. <p>Put, $C_{0} (\mathbb R)=\{f:\mathbb R \to \mathbb C: f \text { is continuous on} \ \mathbb R \ \text {and } \lim_{|x|\to \pm \infty}f(x)=0 \}$(= Continuous functions on $\mathbb R$ vanishing at $\infty$) </p> <p>Let $f\in C_{0} (\mathbb R)$ such that $\int_{\mathbb R} |f(x)| dx &lt; \infty $.</p> <p><strong>My Question</strong>: Can we expect $\sum_{n\in \mathbb Z} |f(n)| &lt; \infty$; Or, we get a counter example, that is, $\sum_{n\in \mathbb Z} |f(n)| = \infty $ ?</p>
0non-cybersec
Stackexchange
235
576
Probability that hamming distance is d.. <p>Two '$n$' bit binary strings $S_1$ and $S_2$ are chosen randomly with uniform probability. The probability that the hamming distance between these strings (the number of bit positions where the two strings differ) is equal to $d$ is ?</p> <hr> <p><strong>My approach</strong></p> <p>We can choose 2 random strings out of $2^n$ strings possible in $2^n C 2$ ways. </p> <p>Now the probability of 2 bits being different is $0.5$</p> <p>Applying binomial distribution we get,</p> <p>$2^n C 2 * (0.5)^d * (0.5)^{n-d}$ .</p> <p>Here $(0.5)^d$ means probability of 'd' bits being different in 2 strings which were chosen.</p> <p>Why is this approach wrong ?</p>
0non-cybersec
Stackexchange
240
708
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
Semigroups with no morphisms between them. <p>Given two monoids we always have a morphism from one to the other thanks to the presence of the identity element.</p> <p>Are there examples of non-empty semigroups that have no morphisms from one to the other? The destination semigroup can't be finite, because if we have an idempotent present, we just map everything to it and get a constant morphism. Apparently, it can't contain an idempotent, period.</p> <p>Put another way, the subcategory of finite semigroups is clearly strongly connected. Is the same true of the category of all semigroups?</p> <hr> <p>Are there two such non-empty semigroups that don't have a morphism in either direction?</p>
0non-cybersec
Stackexchange
182
703
unknown cc payment to my account, help!. (Bank of America cc, tied to BOA checking account... I know its bad, please feel free to mock me) Last evening my wife and I were reviewing our budget and cc statements and spotted a payment to one of our cc accounts. The amount was larger than typical for us and because we keep track of our expenses and payments carefully it jumped out at us as abnormal. We immediately called the number on the back of our card and the representative we spoke to was unable to give us any information about the payment. He claimed it was unknown and unknowable where the payment came from and that it would likely "get denied" the next day and disappear. This didnt sit well with me so I urged him to make a note on our account that we were aware of the payment, that we did not make it, and that should any fees or penalties result from this issue we would like them dismissed. He did so. Today, after checking again, the payment did not "get denied" and has processed successfully............ I know there's no such thing as a free lunch, ESPECIALLY FROM BANK OF AMERICA. What do I do to figure this out? I'm terrified that we're about to get smashed with some kind of charge or fee due to their error but no one can tell us what to do about this mysterious payment. Any help is appreciated, thank you for reading.
0non-cybersec
Reddit
327
1,384
I'm a large, dark-complexioned guy and I need to buy a suit or sports coat. HELP ME!!!. Hey all, so long story short, I have some grad school interviews coming up and I would really appreciate some help. I'm a 6'4, muscular-athletic (240 lbs) build black guy, dark complexion (think Wesley Snipes) and I need to buy a suit. Could you guys give me some ideas/ tips for buying a suit. I really only have a few hundred dollars so I'm trying to get a quality suit in terms of color, style and fit. Anyone have suggestions on what colors would work best with a complexion like mines? Also, like I said, I'm a bigger guy, 6'4, 240 lbs, about 16% bf, so my waist is about 38. I'm trying to cut that down quite a bit, but help would be appreciated. Also, considering my size and height, what/ where should I really pay attention in terms of fit. I realize that because I don't have a lot to drop on a custom suit, I'll probably have to get it tailored so it fits really nice.
0non-cybersec
Reddit
247
968
How can I record part of an HLS-streamed audio and upload it to YouTube as an audio podcast. <p>I will be posting a how-to guide as an answer to this question. It will demonstrate how to accomplish the above task, while meeting five requirements that at first seemed difficult to achieve:</p> <ol> <li><p>I needed to do this with a minimal set of software tools, preferably free and even better if open source. The ones I used are listed below.</p></li> <li><p>I wanted to convert the audio file from m4a to mp3.</p></li> <li><p>I wanted to edit the audio to trim it at both ends and possibly to also remove some bits in between.</p></li> <li><p>It is possible to create a video (e.g. mp4) file with only an audio track and no video track, but YouTube will not accept such a file. At a bare minimum, YouTube requires at least a single, still image to accompany the audio track.</p></li> <li><p>Saving the audio stream to a file is fairly easy, but the file would need to undergo some subsequent processing for steps 2 to 4, and just loading a 2.5-hour audio file into an editor can be quite time-consuming, so ideally it would be preferable to just download the half-hour segment in the middle that I wanted. That segment commences at time ~1:34:00.</p></li> </ol>
0non-cybersec
Stackexchange
334
1,266
Sleep does not work. <p>When I choose sleep in the start menu. My PC simply does not go into sleep. I went through the device manager and did all the steps described <a href="http://support.microsoft.com/kb/976877" rel="nofollow noreferrer">here</a>. So far this had no effect.</p> <p>I've also installed Ubuntu 10.10 but I have the same problem (and in addition I don't know weather the kernel is configured correctly to support sleep) The mainboard is a Gigabyte P55A-UD4.</p>
0non-cybersec
Stackexchange
137
481
How can I get wine to support outputting to pulseaudio (through ALSA compatibility layer) with 32 bit Windows programs on Slackware64?. <p>So, I have a working multilib setup as per the <a href="http://alien.slackbook.org/dokuwiki/doku.php?id=slackware:multilib" rel="nofollow noreferrer">slackbook</a> instructions. I have wine successfully working with 32 bit Windows programs (namely Skyrim and Deus Ex: Human Revolution). And I have pulseaudio successfully installed and configured for native 64 bit programs. Normally, I kill pulseaudio with <code>pulseaudio --kill</code> prior to using wine, as when I run something without doing so, this pops up in the terminal I start it from:</p> <pre><code>fixme:win:EnumDisplayDevicesW ((null),0,0x33f7d8,0x00000000), stub! ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused </code></pre> <p>This following part I've since solved by adding <code>export ARCH=i486</code> after the <code>. /etc/profile.d/32dev.sh</code> as I noticed was required on the multilib page in Slackbook. The fix allowed me to at least get json-c and speex (specified dependencies for pulseaudio on slackbuilds.org) compiled as i486 packages which I then converted to compat32 packages with convertpkg-compat32 and installed.</p> <blockquote> <p>I've tried the recommended </p> <p># . /etc/profile.d/32dev.sh</p> <p>prior to running <code>sbopkg -b pulseaudio</code>, but the resulting package ends up still being an x86-64, rather than i486, package. And since Slackware doesn't natively have pulseaudio included in the distribution, and nor does Alienbob have a compiled version up for it on his slackbuilds repository, I haven't been able to come across a 32 bit binary package to run <code>converpkg-compat32</code> on.</p> </blockquote> <p>The remaining problem, however, is that when I go to compile pulseaudio using the same method used to compile those dependencies, I get this:</p> <pre><code>daemon/pulseaudio-caps.o: In function `pa_drop_caps': /tmp/SBo/pulseaudio-5.0/src/daemon/caps.c:85: undefined reference to `cap_init' /tmp/SBo/pulseaudio-5.0/src/daemon/caps.c:86: undefined reference to `cap_clear' /tmp/SBo/pulseaudio-5.0/src/daemon/caps.c:87: undefined reference to `cap_set_proc' /tmp/SBo/pulseaudio-5.0/src/daemon/caps.c:88: undefined reference to `cap_free' collect2: error: ld returned 1 exit status make[3]: *** [pulseaudio] Error 1 </code></pre> <p>This following issue I fixed by installing libcap and GConf as compat32 packages, followed by re-running the pulseaudio.Slackbuild script (again, in the 32dev environment as with the above packages). </p> <blockquote> <p>Is this a matter of a missing library I still need to install as a dependency, not mentioned on Slackbuilds.org? It certainly wouldn't be the first time I've encountered that situation, but usually my errors are a little more helpful when it comes to hunting down the library I need.</p> </blockquote> <p>Having gotten pulseaudio thus installed, I went to run <code>winecfg</code> to test sound (Note: I tried doing this both with <code>/usr/bin/pulseaudio --start</code>, and when that didn't work, killed the server and tried with <code>/usr/bin/32/pulseaudio --start</code>. Both yielded the same result). The resulting error message followed:</p> <pre><code>ALSA lib dlmisc.c:252:(snd1_dlobj_cache_get) Cannot open shared library /usr/lib64/alsa-lib/libasound_module_pcm_pulse.so ALSA lib dlmisc.c:252:(snd1_dlobj_cache_get) Cannot open shared library /usr/lib64/alsa-lib/libasound_module_pcm_pulse.so libgcc_s.so.1 must be installed for pthread_cancel to work </code></pre> <p>I tried backing up the /usr/lib64/alsa-lib/libasound_module_pcm_pulse.so and making a symlink at that location to /usr/lib/alsa-lib/libasound_module_pcm_pulse.so, as well as copying the file, neither of which had any effect whatsoever on the error message that came out. Also, I tried setting the environment variable <code>ALSA_MIXER_SIMPLE_MODULES</code> to <code>/usr/lib/alsa-lib</code>, still to no avail. Starting to run out of ideas.</p> <p>I know this is pretty uncharted territory with Slackware, as the majority of users seem to have no interest in using it, but there being no reason why it wouldn't be workable, I'm just curious if anyone has any sage advice on getting this package compiled so I can get it installed. If anyone has direct experience with this situation, so much the better.</p>
0non-cybersec
Stackexchange
1,348
4,567
Finding the smallest positive integer $n$ such that $S_n$ contains an element of order 12. <p>My attempt:</p> <p>Suppose <span class="math-container">$\sigma \in S_{n}$</span> such that <span class="math-container">$|\sigma|$</span>. We know that every element of <span class="math-container">$S_{n}$</span> can be written as a product of disjoint cycles, that is:</p> <p><span class="math-container">$\sigma = \theta_{1}... \theta_{i}$</span> .</p> <p>Now we know that the order of any element in <span class="math-container">$S_{n}$</span> will be the least common multiple of the disjoint sets, that is:</p> <p>Order(<span class="math-container">$\sigma$</span>)<span class="math-container">$=12=lcm{|\theta_{1}|...|\theta_{i}|}$</span>.</p> <p>Note, the prime factorization of 12 would be 2*2*3. As we know <span class="math-container">$lcm(4,3)=12$</span>, therefore the following permutation would have order 12,</p> <p><span class="math-container">$(1234)(567)\in S_{7}$</span>.</p> <p>Here is where my problem arises, I know that 7 will be the answer but I don't know how to properly justify it. I know I need to show that any other set of numbers with an LCM of 12 can't have a sum of less than 7, I just don't know how to do it. </p>
0non-cybersec
Stackexchange
399
1,251
How many vertices/nodes are too many in a graph and stop being beneficial?. <p><strong>Background</strong></p> <p>I'm working on a project that requires me to keep track of transactions as well as the flow of items in a game. In order to do that, I'm storing those transaction in a graph db (Orient-DB).</p> <p>A Shop in the game can have zero or more basekts each of which can hold one type of item. So when a Player sells something, the sold items (if any) will be placed into the respective basket and the transaction is complete.</p> <p><strong>Question</strong></p> <p>I'm not entirely sure how to model that behavior properly though. I can think of two more or less sane ways to represent this, but don't know which representation is best for this scenario.</p> <p><em>Things I need to know at any given time</em></p> <ul> <li>how did item x end up in basket y <ul> <li>which transaction was responsible for that?</li> <li>which Player sold that item?</li> </ul></li> <li>which shops/players did item x pass through previously</li> <li>which Player did business with shop x (and the reverse)?</li> </ul> <p><em>Option A:</em></p> <p><a href="https://i.stack.imgur.com/OH4yz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OH4yz.png" alt="Option A"></a></p> <p>I create a transaction vertex and create edges between that, any and all <code>Items</code>, the <code>Basket</code> and the <code>Player</code> in question. Downside is, I have to add data to the <code>contains</code> edges, to specify which item went into which <code>Basket</code> (here in light blue).</p> <p><em>Option B:</em></p> <p><a href="https://i.stack.imgur.com/1YKEN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1YKEN.png" alt="Option B"></a></p> <p>I add additional nodes, to link transactions with <code>Baskets</code> and <code>Items</code>. Here I get to represent all data in the graph in the form of vertices and edges but I'm introducing yet more hops to get from <code>Shop</code> to <code>Player</code>.</p> <hr> <p>The downside of <em>A</em> that could see is that when I want to get the items of a given transaction, I have to do additional queries if I want to know how an <code>Item</code> ended up in that specific <code>Basket</code>.</p> <p>Which way should I go? Is there a better option?</p> <p>Would adding a direct edge between Player and Shop be benefitial (with a reference to the transaction as property) to reduce unnecessary hops when all I want to know is, who went to a Shop?</p> <p>I think this question boils down to, how many vertices are too many and when do I separate this into different queries (basically like a <code>JOIN</code> in relational databases)?</p> <p>I did consider a transaction log for this, but some requirements that need to be queried would make this a hell to <code>JOIN</code></p>
0non-cybersec
Stackexchange
869
2,874
Second order homogeneous linear differential equation. <p>The differential equation of the form </p> <p>$x^2\frac{d^2y}{dx^2}+p_1\frac{dy}{dx}+p_2y=Q$ where $p_1$ ,$p_2$ are constants and Q the function of x is called Second order homogeneous linear equation.</p> <p>How can we prove that above equation is second order homogeneous linear differential equation.And also help me to understand the significance of above equation in engineering field.</p>
0non-cybersec
Stackexchange
129
458
Default argument allowing constructor to call private method. <p>I have the class</p> <pre><code>class A { public: class Key { Key() {} Key(Key const &amp;) {} }; A(Key key, int a = 5) {} }; </code></pre> <p>The constructor for <code>Key</code> is private, so no one should be able to construct an object <code>A</code>. However, with the following code:</p> <pre><code>int main() { A a(A::Key()); // this compiles !!! A a2(A::Key(), 5); // this doesn't // somehow defaulting the argument causes the private constructor // to be OK - no idea why return 0; } </code></pre> <p>By making use of the default argument for <code>int a</code> in my constructor, the compiler happily compiles my usage of <code>A::Key()</code> despite the fact that it is private. If I explicitly give a value for <code>a</code>, though, the compiler correctly recognizes that I am trying to use a private constructor and errors out. Why is this? Is there someway to force the compiler to error out for the first example as well?</p> <p>See <a href="https://ideone.com/fqeGGc" rel="nofollow noreferrer">here</a> for live example.</p>
0non-cybersec
Stackexchange
355
1,167
&quot;[!] Something went wrong.. Try again&quot; sendmail with setoolkit in kali behind tor. <p>I've been working in a little project, and the goal right now is spoof an e-mail address. That simple, but doing it in an elegant way.</p> <p>I've done the following, using Kali on a VM (in VirtualBox) I downloaded sendmail and used it with setoolkit, the result was successful, with the only problem that my IP was revealed on the message. I search in unix.stackexchange.com and found a way to <a href="https://unix.stackexchange.com/questions/79808/localhost-127-0-0-1-in-email-headers">hide the IP</a> (I used the second answer, the one not accepted): one of them assured that editing the <em>interfaces</em> file, one can spoof the IP. I followed the tutorial step by step and it didn't worked, probably, because the IP used by this guy was his own public IP address, thing that I don't have, and it's completely what I am avoiding to share.</p> <p>For me the coolest solution right now is Tor. So I tunneled the entire Kali OS with the Whonix Gateway (actually re installed Kali), updated everything and surprise:</p> <p>When I try to send an email using setoolkit, running sendmail everything behind whonix I receive the error "[!] Something went wrong.. Try again" with no information at all, but that something went wrong.</p> <p><strong>Question is:</strong></p> <p>First, how to fix it?. Second, if there's no way to fix it, why does that happen?, Am I unable to use sendmail behind Whonix?</p> <h2>Important Note:</h2> <p>I don't really know what information from the system you need, so do not get mad at me and just ask for any information you need, I'll be more than happy to post it.</p>
1cybersec
Stackexchange
483
1,706
Can&#39;t mount or repair Transcend 1TB external HD. <p>I have a Transcend 1TB external hard drive. The hard drive shows up in Disk Utility but when I click on Mount, the LED of the drive blinks for 2 seconds. And then nothing happens. When I clicked on Repair I got this message:</p> <pre><code>Repairing file system. Invalid content in journal Checking Journaled HFS Plus volume. Detected a case-sensitive volume. Checking extents overflow file. Checking catalog file. Invalid node structure The volume HD1 could not be verified completely. Invalid content in journal File system check exit code is 8. Updating boot support partitions for the volume as required. </code></pre> <p>I don't think that's the problem but my hard drive was almost full and I clicked on backup. And I think the problem happen at this moment.</p> <p>I tried another USB cable, and on Windows but without success.</p> <p>Any idea that involves not losing my data is very welcome :)</p> <hr> <p>OS : El Capitan 10.11.6 MacBook Pro (late 2008)</p>
0non-cybersec
Stackexchange
286
1,031
Export sql query results to excel using vba with headers. <p>I need to export a simple SQL query result to excel. I am able to get the results, however the headers are missing, how can I export the headers as well?</p> <p>This is what i have so far:</p> <pre><code>Sub Conn2SQL() Dim cnn1 As New ADODB.Connection Dim mrs As New ADODB.Recordset Set cnn1 = New ADODB.Connection cnn1.ConnectionString = "driver={SQL Server};server=MyDBServer;uid=MyuserID;pwd=mypassword;database=MyDB" cnn1.ConnectionTimeout = 30 cnn1.Open SQry = "use MyDB select * from TableName" mrs.Open SQry, cnn1 Sheet2.Range("A2").CopyFromRecordset mrs mrs.Close cnn1.Close End Sub </code></pre>
0non-cybersec
Stackexchange
244
683
Factory for creating a singleton instance. <p>We have some legacy code that has a bunch of singletons all over the place (written in C#).</p> <p>The singleton is a fairly "classic" implementation of the pattern:</p> <pre><code>public class SomeSingleton { private static SomeSingleton instance; private SomeSingleton() { } public static SomeSingleton Instance { get { if (instance == null) { instance = new SomeSingleton(); } return instance; } } } </code></pre> <p>Note that thread safety is not a concern, so no locks are used.</p> <p>In order to make the code more testable, and without making too many modifications, I'd like to modify this code to delegate the creation of the singleton instance in another class (a factory or similar pattern).</p> <p>This can assist in creating a "test" instance for testing purposes, or the real version, as it is used now.</p> <p><strong>Is this a common practice? I could not find any reference to such pattern being used.</strong></p>
0non-cybersec
Stackexchange
289
1,105
What should I do about my wife?. I've been married for 23 years. I know that's older than most Redditors have been alive but hopefully there are some married men here with a similar experience. I don't know what to do about my wife. For the last 10 years or so she has been depressed. It's gotten steadily worse over the years to the point in the last couple of years where I just don't know if I can deal with it any more. In the last couple of years, she has been in a job she really likes that is in a medical setting. Her job will pay for her to go to school to get education which improves her job prospects and pay potential. She started college for the first time in her life in January taking two classes. After a month, she dropped 1 class despite the fact that she was getting a 100%. She said it was just too much for her. Now this morning she won't get out of bed to go to the other class she had remaining and told me that she is dropping this class too because there just isn't any point. She is also doing very well in this class. Her depression is obviously the reason she is quitting these things but I just can't stand it. I don't know if I can confront her about it or if I even should care at this point. I want to tell her to get her ass out of bed and get to class. College is a grind and there are plenty of days you just don't feel like doing it, but you do it and just get through it. She is not at all open to discussion about anything. If I talk about it, she gets very defensive and cries and says she is worthless and that no one wants her around and that she should just disappear. That has caused me over the years to shut down all discussion about what is clearly a huge problem. There are other issues in the marriage as well that stem from her depression. I don't know what to do. She has tried medication but stopped because she said she didn't like the way it made her feel. I'm worried that she is more comfortable being depressed and that she doesn't even care to get out of it. We have been married since we were 17. We have grown up together and been through a lot. I don't know what to do. I don't feel like I can leave because we have been together most of our lives but I also feel like I'm drowning. Sorry for the long rant. If anyone has any perspective, I'd appreciate it. EDIT: I am blown away by the response. I've been on Reddit for a couple of years and have thought it was mostly full of unfeeling a-holes. While I've gotten some of that today, it was far less than I would have expected. I appreciate the stories everyone has told me today of how things have been for them. I know a lot of people are suffering with this problem and it's been nice to get some perspective. Nothing drastic is going to happen today. I think we will have a conversation but nothing huge. I want to get the conversation started and see what she is thinking and what kind of response I get from her. Thank you again everyone. I am moved by your responses.
0non-cybersec
Reddit
684
3,001
Patient 314 - Day 5. [Day 4](https://www.reddit.com/r/nosleep/comments/5t2ncl/patient_314_day_4/) Mt. Whitney Psychiatric Ward Patient 314 Personal Log *2/9/2017 – 10:23PM* I guess I need to eat my words a bit. He said today would be fun and it WAS! Sure, yeah it started out kind of slow but shooting a gun was invigorating, mesmerizing even. The power inside of that tiny little weapon is astounding. I wouldn't mind taking it up as a hobby someday but who needs a gun when you can visualize severing the spinal cord and it actually happens? Well I guess I don’t know if the spinal cord severed but the dad-clone died so whatever I did to it killed it. How did he know I could do that? I guess since I am patient 314 that means there were 313 before me but the real question is where they *like* me or were they all different? Like, different abilities and stuff? I am going to ask some questions tomorrow. ------------------ Dr. Feldman *2/9/2017 – 10:59PM* Observations from experiment four – logging… Patient 314 has shown more promise in four days than any other patient in a months’ time. I do not think that we have seen anywhere close to his maximum potential. 314 is also becoming a bit more interactive – this can only be taken in a positive way. Only two other patients have reacted positively once testing began. He appears to be settling in to his routine nicely. As I theorized, an isolated kill is very static, and only fluctuates with emotional connection. This is important for a great many applications where emotion must be removed from a situation. When multiple beings are killed there is a multiplier factor of 1.3. This is possibly linked to adrenaline or a similar effect to “runner’s high” – more testing will be done to determine the exact cause. It should also be noted that the method of killing plays a factor. Patient 314 gained more from killing with the knife than he did with the pistol. He does seem to favor using his hands when killing. This might tie in with the emotion aspect. Most exciting of all is having another patient with the mental ability. Patient 313 was a complete failure in the testing environment however the discovery of her mental abilities led us to Patient 314 so I shouldn’t be too hard on her. Where she failed he has succeeded! Autopsy on the Faceless that 314 failed to kill showed some damage to the neck similar to whiplash and minor internal bleeding on the brain. Autopsy on the clone showed a cleanly severed spinal cord. If we can somehow find a way to translate that result without the personal/emotional connection… I am getting ahead of myself. Tomorrow will be interesting. ----------------- *2/10/2017 – 6:15AM* Experiment five – logging… Breakfast delivered. 314 appears contemplative and relaxed while he eats. Sixteen subjects enter the room just as Dr. Feldman begins to speak. **Dr.** - Good morning, 314. Today we will attempt to verify a few theories I have. In front of you is a mixture of Faceless and clones of your Father, Mother, and myself. Each one is holding a different weapon. Those without a weapon you will kill with your bare hands, except the very last which must be killed with your mind. On my mark move to the first subject. Please wait thirty seconds between each kill. Proceed. Readings are taken, compared, logged. 314 moves to the first subject. When he finds himself in front of the last he locks eyes with the subject. Blood seeps slowly out of the mouth, nostrils, eyes, and ears of the subject as it crumples to the clean, white floor. Readings are taken, compared, logged. A powerful strobe lashes out, blindingly bright, accompanied by a thunderclap of sound. Readings are taken, compared, logged. **Dr.** - Wonderful, simply marvelous! Sixteen more are coming in now. This time I would like for you to try and mentally kill the first subject AND the last subject. Proceed. 314 approaches the first subject. Sweat begins beading on his forehead. His breathing grows harsher. **Dr.** - 314, enough. Use your hands and move on to the next. 314 moves down the line with more violent intent. When he steps in front of the final subject the neck twists swiftly in a full 360 degrees. 314’s hands never left his sides. **Dr.** - Perfect, thank you 314. I am sure you need some rest so I’ll have a snack brought and we can resume at 8. **314** - How did you know I could do that? You know, with my mind? **Dr.** - I suppose you deserve a few answers. Patient 313 had similar mental capabilities. Once an ability is discovered in one Patient we check every Patient for those abilities as well. **314** - Are there other Patients here? Can I meet them? Can I meet 313? **Dr.** - You’ve already met Patient 313. Dr. Feldman walks away and a tray with sliced meats and cheeses is brought it. 314 eats in silence. ------------------ *2/10/2017 – 8:00AM* Experiment five, continued – logging… **Dr.** - How are you feeling, 314? Have you had any headaches or eye strain? **314** - Not yet, no. Was that an issue with 313? **Dr.** - It was, among others. We are going to continue the testing now if that is ok. Three clones of Dr. Feldman enter the observation room. **Dr.** - If you would, please try to kill each one mentally. **314** - [mumbles] Like this world needs more crazy doctors running around… Patient 314 stays on his cot but focuses on the first clone. His knuckles turn white as his grip tightens on the edge of the cot, then the clone crumples to the floor. Readings are taken, compared, logged. 314’s neck bulges and strains as the second clone drops to the floor, twitching slightly twice. A large vein is standing out on 314’s forehead and gleams with sweat. Readings are taken, compared, logged. A guttural yell escapes the lips of Patient 314. His concentration has forced him to stop breathing, his head vibrating back and forth. **Dr.** - Breathe. Recollect yourself. Then try again. Patient 314 leans back, drawing in a large breath. Again. Again. The color in his hands and face start to return to normal. He locks eyes with the last clone – twenty seconds later it drops lifelessly to the floor. Readings are taken, compared, logged. **Dr.** - I believe we have found your threshold. There will be one more test today but it can wait until just before dinner. A second channel has been added to your television. Please try to rest. ---------------- *2/10/2017 – 11:15AM* Lunch delivered. Patient 314 awakened by the sound of the tray. Television mode is activated while 314 eats. ------------------- *2/10/2017 – 4:00PM* Experiment five, continued – logging… Six Faceless enter the room. **Dr.** - This is the last test of the day. I would like you to kill four with your hands. Then try to kill the remaining two at the same time with your mind. **314** - Are you kidding? At the same time? How am I going to do that?! **Dr.** - How do you kill one? You visualize the action and carry out the action with your mind. Try to visualize them both. 314 sighs and closes his eyes. He rubs his temples for a minute before looking up at the Faceless. Breathing is slow and even. Eventually two thuds resonate through the room. Readings are taken, compared, logged. **Dr.** - [whispers] Yes… [to 314] How do you feel? **314** - Tired. Could I meet 313 again? **Dr.** - I am afraid that isn’t possible anymore. You killed her yesterday. [ADDENDUM TO LOG] - Patient 314 killed her two days before. See Day 3. --------------- *2/10/2017 – 5:15PM* Dinner is delivered. A comedy movie is playing on the television. Experiment [5 complete.](https://www.reddit.com/r/nosleep/comments/5thx2n/patient_313/) [■](https://www.facebook.com/aaron.writes.1)
0non-cybersec
Reddit
1,966
7,736
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
Tox over Tor won&#39;t come online. <p>I've recently installed toxic (tox-based terminal chat client) and am attempting to route it through Tor for extra privacy. I followed <a href="https://wiki.tox.chat/users/tox_over_tor_tot" rel="nofollow">this</a> tutorial for installing the tor service. But, when I try and start toxic with forced TCP going through the localhost Tor proxy, toxic will start, but will remain offline.</p> <p>How can I fix this? I can provide screenshots/configurations if necessary, I really just want to get this up and running.</p>
0non-cybersec
Stackexchange
148
558
How to access Android File system from Windows 7 command line through USB. <p>When my Android device (Samsung galaxy s4) is connected to my laptop (Windows 7), I would like to be able to access files on the Android device from the Windows 7 command line. The commands :</p> <pre><code>cd Computer\GGS4\Phone </code></pre> <p>or </p> <pre><code>Computer\GGS4\Phone: </code></pre> <p>don’t work</p> <p>FYI, the reason why I need this is to use <code>mp3slpt</code> from laptop to cut mp3 file on the Android device. Something like : </p> <pre><code>D:\temp&gt; mp3splt Computer\GGS4\Podcast\program1.mp3 7.12 7.30 -d out -o program1Extract </code></pre>
0non-cybersec
Stackexchange
231
661
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
Easy way to find FTP Path used by COTS package?. Simple question I already have an answer for but am asking to see if there is something even easier. Software package has an option to download the latest patches from the vendor via FTP. However the software package sucks and I would much rather just grab the bits and push them out via alternate means (this is supported, but you have to download every patch individually). So I was wondering how I can run the software in a sandbox of some kind, watch the internet traffic going out to determine the address and login details (if any, might be anonymous) of the FTP connection. I assumed WireShark on the machine (its Windows based software) would work, but I don't already have that up and running nor familiarity with it. So I was wondering if there was something else that was even easier given my specific goals outlined above. Thanks Guy and Gals.
1cybersec
Reddit
203
913
How to simulate an &#39;outer join&#39; in core.logic?. <p>I've just started playing with core.logic, and to work on it I'm trying to implement something simple that is similar to a problem that I am currently working on professionally. However, one part of the problem has me stumped...</p> <p>As a simplification of my example, if I have a catalog of items, and some of them are only available in certain countries, and some are not available in specific countries. I'd like to be able specify the list of items, and the exceptions, something like:</p> <pre><code>(defrel items Name Color) (defrel restricted-to Country Name) (defrel not-allowed-in Country Name) (facts items [['Purse 'Blue] ['Car 'Red] ['Banana 'Yellow]]) (facts restricted-to [['US 'Car]]) (facts not-allowed-in [['UK 'Banana] ['France 'Purse]]) </code></pre> <p>If possible, I'd rather not specify allowed-in for all countries, as the set of items with restrictions is relatively small, and I'd like to be able to make a single change to allow/exclude for an item for a given country.</p> <p>How can I write a rule that gives the list of items/colors for a country, with the following constraints:</p> <ul> <li>The item must be in the list of items</li> <li>The country/item must be not be in the 'not-allowed-in' list</li> <li>Either: <ul> <li>There is no country in the restricted-to list for that item</li> <li>The country/item pair is in the restricted-to list</li> </ul></li> </ul> <p>Is there some way to do this? Am I thinking about things in entirely the wrong way?</p>
0non-cybersec
Stackexchange
465
1,611
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application. I need to scale my app adding some spot instances that EB do not support.</p> <p>So I create a second autoscaling from a launch configuration with spot instances. The autoscaling use the same load balancer created by beanstalk.</p> <p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p> <p>This work fine, but:</p> <ol> <li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p> </li> <li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p> </li> </ol> <p><strong>UPDATE</strong></p> <p>Elastic Beanstalk add support to spot instance since 2019... see: <a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
0non-cybersec
Stackexchange
349
1,234
How to make a batch script to run commands on a remote machine using credentials. <p>I have wrote some batch scripts to perform docker commands on a machine and made it run using c# program. I can successfully run those batch scripts in my local machine, but I want it to run on a remote machine. How can I do that by giving remote machine access credentials? I am looking for batch commands that will first connect to the remote machine and then execute its body in remote machine. A sample batch script is as below.</p> <pre><code>::Start an exited container ::Iam expecting some code here to connect to a remote machine @echo off docker start %1 </code></pre> <p>Or, Is there any option to do it through c# program? </p>
0non-cybersec
Stackexchange
176
727
Integral $\int_{-\infty}^\infty dx e^{-nx^2/2}(z-ix)^n$. <p>$$ I\equiv\mathcal{F}_n(z)=\int_{-\infty}^\infty dx e^{-nx^2/2}(z-ix)^n. $$ Evaluate I for $n \to \infty$ and z real. We can consider $z\geq 0$ due to the symmetry of $\mathcal{F}$ given by $$ \mathcal{F}_n(-z)=(-1)^n\mathcal{F}_n(z). $$ I am looking for a solution, thanks. </p>
0non-cybersec
Stackexchange
142
341
Technical Review of Bitcoin. <p>I am currently looking on how does Bitcoin work, and I would like to sum things up with your help. The point is, if I ever want to write my own mining agent, what do I have to understand in order to do so ?</p> <p>First Point: The Data</p> <p>Through my research, I didn't really understand WHO gives the current hash to work on. I know that it is working as a P2P network, and I think, but not sure, that all clients connected to the network are aware of the transactions.</p> <p>But what should I do if I want to have access to the latest OFFICIAL (might not be the best word) block, without being in a mining pool ?</p> <p>Second Point: The Computation</p> <p>If I undestood this part, I have to try every nonce until sha256(sha256(data + nonce)) meets the requirements from Bitcoin.</p> <p>Third part, submitting the answer</p> <p>Assuming I found the right nonce, how can I submit my result. But I didn't find how I can do that.</p> <p>I want to make this point clear, I want to be SOLO, not mining solo, but if I wanted to write my own mining program, how could I do that WITHOUT being in a mining pool and finding information all by myself.</p> <p>Thanks for your answers.</p>
0non-cybersec
Stackexchange
346
1,225
What 1 year of keto and sobriety has done for me.. Hello! I’ve hit my one year keto anniversary. One year ago today I was over 365 pounds, I smoked a pack a day, and would binge drink 3 days a week. And ate nothing but absolutely garbage. Today I’m happy to say I’ve lost 120 pounds (80 to go), quit smoking one year ago (3/27/18) and have touched alcohol one time (oops) since (3/27/2018). And wow. My body is thanking me every single day. [Hello to a new face](http://imgur.com/0qnLVUA) [In progress ](http://imgur.com/wWAjmrX) **edited to add another photo.
0non-cybersec
Reddit
175
569
I just wanna be immune to it.. I’m only 20 and I’m about to collapse under societal pressure. I hate that I think about who my “match” will be and constantly guessing if any guy who throws their attention my way will be “the one”. I’m at a constant battle with myself because on one hand I know my self-worth and I know that when it happens, it will be the perfect time. But there’s also this longing in me that just wants that, even if it’s w/ someone that I know won’t be good for me. I want that “someone”. Y’all know what I mean when I say “someone”. I even tried tinder and learnt very quickly what everyone was looking for. *sigh* I’m tired of feeling this pressure. Im tired of the fact that I feel it. I just wanna be immune to it. So... If there’s a guy out there who’s 20-24... 😂😂 I’m just kidding.
0non-cybersec
Reddit
228
815
Network Media Player with Other OS option. <p>Not sure this is the right SE site to post this on but figure from the faq: "and is not about... consumer electronics such as media players, cell phones or smart phones, except when <b>designing these products or hacking their electronics for other uses</b>" this probably fits the bill.</p> <p>Is there any known network media player that allows for an "Other OS" option? Take for example the Apple TV, or the WD Live TV, etc systems, which are really small form factors, have decent hard drives, have great options for hooking up displays (Composite, Component, HDMI/DVI/etc.). The PS3 used to allow the Other OS option but then they removed it for unknown reasons, I would love something like.</p> <p>I need a hardware device that I can install Windows on (I know, probably a long shot). Does anyone know of any hardware device that will allow this?</p> <p>Now, there is a small form factor PC device from Dell called the Zino (as an example), which would work out very good, except that it only has VGA/HDMI output, my needs call for the older composite, component outputs to work as well as an option for hooking up to a TV.</p>
0non-cybersec
Stackexchange
293
1,186
How to add new Dataframe Column with Dictionary Key, if the Value is found in a column text string. <p>I have a dataframe in which one column has text information.</p> <pre><code>print(df): ... | ... | Text | ... | ... | StringA. StringB. StringC | ... | ... | StringZ. StringY. StringX | ... | ... | StringL. StringK. StringJ | ... | ... | StringA. StringZ. StringJ | </code></pre> <p>I also have a dictionary that has the following:</p> <pre><code>dict = {'Dogs': ['StringA', 'StringL'],'Cats': ['StringB', 'StringZ', 'StringJ'],'Birds': ['StringK', 'StringY']} </code></pre> <p>EDIT: i have about 100 dictionary Keys which each have 4+ Values.</p> <p>What I am hoping to do is create extra columns in the dataframe for each Key in the dictionary and then place a "1" in the column when any of the Values from the dictionary appear.</p> <p>Therefore the output i am trying to get is:</p> <pre><code>print(df): ... | ... | Text | Dogs | Cats | Birds ... | ... | StringA. StringB. StringC | 1 | 1 | 0 ... | ... | StringZ. StringY. StringX | 0 | 1 | 1 ... | ... | StringL. StringK. StringJ | 1 | 1 | 1 ... | ... | StringA. StringZ. StringJ | 1 | 1 | 0 </code></pre> <p>EDIT: The issue is I'm not sure how to search for the values within the text column and then return a 1 if found to the Key column. Any help would be much appreciated! Thanks!</p>
0non-cybersec
Stackexchange
497
1,541
The log transform turns scalar multiplication into addition. Is there an analogous transformation for matrix-vector multiplication?. <p>Napier's method of logarithms and corresponding <a href="https://en.wikipedia.org/wiki/Mathematical_table" rel="nofollow noreferrer">tables of logarithms</a> provided a important tool to simplify hand computation by converting multiplication and division to equivalent problems of addition and subtraction.</p> <p>Suppose I have a linear equation for <span class="math-container">$x$</span>:</p> <p><span class="math-container">$$ a x = b $$</span></p> <p>While it would be overkill, if I wanted to avoid division by <span class="math-container">$a$</span> I could log transform both sides and use the convenient property converting products to sums</p> <p><span class="math-container">$$ \log(a) + \log(x) = \log(b) $$</span></p> <p>then subtract <span class="math-container">$\log(a)$</span> and express the solution as</p> <p><span class="math-container">$$ x = \exp(\log(b) - \log(a)) .$$</span></p> <p>Consider the matrix equation</p> <p><span class="math-container">$$ A X = B $$</span></p> <p>where <span class="math-container">$A, X, B$</span> are square matrices. Under certain conditions we can compute <a href="https://en.wikipedia.org/wiki/Logarithm_of_a_matrix" rel="nofollow noreferrer">logarithms of square matrices</a>; the convenient products-to-sums property only holds for matrices which commute, but if A commutes with X then we have</p> <p><span class="math-container">$$ \log(A) + log(X) = \log(B) $$</span></p> <p><span class="math-container">$$ X = \exp(\log(B) - \log(A)) $$</span></p> <p>What about when <span class="math-container">$x$</span> is a vector? Is there an analogous method to solve the system <span class="math-container">$$ A \vec{x} = \vec{b} \ \ \ ?$$</span></p> <p>I don't believe it's possible to exponentiate a vector, let alone take its logarithm. Eigenvalue decomposition would be a natural choice to separate the equations, but then you still have to divide. Perhaps there is another transformation that can be applied, something between the simple logarithm and the Laplace/Fourier/etc transforms so useful in differential equations.</p> <p>I'm aware of iterative methods to solve linear equations without computing <span class="math-container">$A^{-1}$</span>. I'm looking for a pre-processing transformation (which might itself be very complicated!) to convert the equation into something trivially easy to solve (say, for a black box computer which only knows addition &amp; subtraction), after which I can apply the inverse transformation to solve the original equation.</p>
0non-cybersec
Stackexchange
752
2,678
Open source command line tool for Linux to diff XML files ignoring element order. <p>Is there an open source command-line tool (for Linux) to diff XML files which ignores the element order?</p> <p>Example input file <code>a.xml</code>:</p> <pre><code>&lt;tag name="AAA"&gt; &lt;attr name="b" value="1"/&gt; &lt;attr name="c" value="2"/&gt; &lt;attr name="a" value="3"/&gt; &lt;/tag&gt; &lt;tag name="BBB"&gt; &lt;attr name="x" value="111"/&gt; &lt;attr name="z" value="222"/&gt; &lt;/tag&gt; &lt;tag name="BBB"&gt; &lt;attr name="x" value="333"/&gt; &lt;attr name="z" value="444"/&gt; &lt;/tag&gt; </code></pre> <p><code>b.xml</code>:</p> <pre><code>&lt;tag name="AAA"&gt; &lt;attr name="a" value="3"/&gt; &lt;attr name="b" value="1"/&gt; &lt;attr name="c" value="2"/&gt; &lt;/tag&gt; &lt;tag name="BBB"&gt; &lt;attr name="z" value="444"/&gt; &lt;attr name="x" value="333"/&gt; &lt;/tag&gt; &lt;tag name="BBB"&gt; &lt;attr name="x" value="111"/&gt; &lt;attr name="z" value="222"/&gt; &lt;/tag&gt; </code></pre> <p>So comparing these 2 files should not output any differences. I have tried to sort the files with XSLT first:</p> <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; &lt;xsl:output method="xml" encoding="WINDOWS-1252" omit-xml-declaration="no" indent="yes"/&gt; &lt;xsl:strip-space elements="*"/&gt; &lt;xsl:template match="node()|@*"&gt; &lt;xsl:copy&gt; &lt;xsl:apply-templates select="node()|@*"&gt; &lt;xsl:sort select="@*" /&gt; &lt;/xsl:apply-templates&gt; &lt;/xsl:copy&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>But the problem is that for the elements <code>&lt;tag name="BBB"&gt;</code> there is no sorting. They are simply output the order which they are input.</p> <p>I have already looked at <code>diffXml</code>, <code>xDiff</code>, <code>XMLUnit</code>, <code>xmlstarlet</code> but none of these solve the problem; the diff output should be human readable, e.g. like when using <code>diff</code>.</p> <p>Any hints on how either the sorting or ignoring element-order diff can be solved? Thanks!</p>
0non-cybersec
Stackexchange
860
2,172
Global variable implementation. <p>When I write the following program:</p> <p>file 1:</p> <pre><code>#include &lt;stdio.h&gt; int global; void print_global1() { printf("%p\n", &amp;global); } </code></pre> <p>file 2:</p> <pre><code>#include &lt;stdio.h&gt; char global; void print_global2() { printf("%p\n", &amp;global); } </code></pre> <p>file 3:</p> <pre><code>void print_global1(); void print_global2(); int main() { print_global1(); print_global2(); return 0; } </code></pre> <p>output:</p> <pre><code>$ ./a.out 0x804a01c 0x804a01c </code></pre> <p>Here is my question:</p> <ul> <li>Why are the linker implementing "int global" and "char global" as the same global variable:</li> <li>How come the compiler does not complain (not the smallest warning with <code>-Wall -Wextra -ansi</code> ...)</li> <li>How are the size of the global variable managed (the size of int and char are different)</li> </ul> <p>PS: The second question is architecture/compiler related, so lets take the gcc or Visual C++ (for C) with the int size as 32 bits</p> <p>EDIT: THIS IS NOT A QUESTION FOR C++ BUT for C!</p> <p>I use gcc version 4.4.1 and on Ubuntu 9.10, Here is the compilation console output:</p> <pre><code>$ ls global_data1.c global_data2.c global_data.c $ gcc -Wall -Wextra -ansi global_data*.c $ ./a.out 0x804a01c 0x804a01c or $ gcc -Wall -Wextra -ansi -c global_data*.c $ gcc -Wall -Wextra -ansi global_data*.o $ ./a.out 0x804a01c 0x804a01c </code></pre>
0non-cybersec
Stackexchange
578
1,524
I&#39;ve been on C# course and struggle to remember things?. <p>I'm an apprentice and I've been on a couple of training courses in C#, I understood the concept of c# programming and covered inheritance etc, but when I've came to code for my coursework "I've got to make a shopping basket and save the contents into a .txt" I just seems to not know what to do, as if I've got no idea how to program. I've got a copy of the end product apart from it's altered so we can't copy it whole, so I've just been taking code and not really understanding everything that's doing on. I just seem as if I don't want to program as if I'm in a different mind set, I just seem to go blank at the thought of creating a simple program from scratch and have no Idea where to start? Any one got any ideas for help ? :) thx</p>
0non-cybersec
Stackexchange
203
807
Love of my life boyfriend cheated on me. So confused and wondering what I should do. Advice please.. Hi reddit, I'm (f, 21) he's (m, 23). We have a long history together. We've been friends for 3 years. Long story short we got together last October. In December he freaked out and wanted to take a break because he had just gotten out of a relationship and felt lost. I said that was fine, we were moving fast. But about a week into our break he came back to me with flying colors. Constantly we would say I love you, I want to be with you forever, I miss you, I want you. We were attached at the hip. We went through a lot this year, but it was agreed we would be together for a long time and these things would only make us stronger. What was the kicker though, was that I have something called "vestibulitis." That means I have painful sex, and need months (if not years) of treatment. So, my sex drive took a dive while my boyfriend and I did simple things. I could tell he wanted more, but I knew he would never cheat on me. It is NOT in his character to "hook up" or cheat on someone. I know this because I know all his friends and ex's. If he didn't like the relationship he would end it. He is also incredibly insecure. Always thinking I was going to leave him. He said I was the first real love he had had. I was also his second sex partner and his first oral sex partner. We had planned much ahead of what we wanted for each other. We agreed to always talk about our problems. Last Sunday we had a fight. Last monday he told me he wanted space to find himself out for a bit, but was distant. He told me he loved me and didnt want to separate. Three days go by and he gets more distant, all those days though we see each other and he tells me he loves me. On Thursday Morning, I biked to his house to talk to him and found him in bed with another girl I had never seen before. She left, I screamed, he was in shock, and cried. I asked why and who she was. He said he had met her at work, she was a customer. She came over and knew he was already fucked and let it happen. He said they didn't have sex. I took all my things and told everyone about it. NOBODY expected it. His sister, his ex's, people he knew since high school. It was very unexpected. Yesterday it has been 4 days, and he hasn't contacted me. His sister told me that they had met up and he had never felt more depressed in his life and that it was only that time. I went to his house while he was at work so I could get more of my stuff. I found that he had mementos on his bedside of us. And a note either left out so I could see it or a confession for himself. To put briefly, he said how sorry he was, how bad he wronged me, how I didn't deserve that, and how he cries everyday knowing I won't be in his arms again. He also admitted he didnt know what he wanted from this girl, just for the excitement. I found two condoms left in his drawer, which meant he was being truthful about not having sex with her because all we had left was two. I left the room the way it was and still haven't heard from him. Why do I think he hasn't talked to me? Because whenever we fought and he knew he lost, he would never talk. Just let me "beat him" in a way and just take it knowing he did something wrong and that he thought I didn't deserve him. Very self defeating kind of guy. But loved me to no end. He told his sister just a week or so before the incident that he was going to be with me for a long time. I'm in love with him still. I can't imagine finding someone else better or like him. He hasn't talked to me yet. What do I do? To be honest, I want him back. I don't see him cheating again, but I want him to know that my respect and trust will have to be earned back, but it can be done. He does need some space, I'm not saying I will accept him back within a few months but I do want him back eventually. What do I do?
0non-cybersec
Reddit
961
3,917
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application. I need to scale my app adding some spot instances that EB do not support.</p> <p>So I create a second autoscaling from a launch configuration with spot instances. The autoscaling use the same load balancer created by beanstalk.</p> <p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p> <p>This work fine, but:</p> <ol> <li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p> </li> <li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p> </li> </ol> <p><strong>UPDATE</strong></p> <p>Elastic Beanstalk add support to spot instance since 2019... see: <a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
0non-cybersec
Stackexchange
349
1,234
When can a Non-Deterministic Finite Automaton with Epsilon transitions considered to be in an accepted state?. <p>A non-deterministic finite automaton is considered to be halted when either the whole input string has been consumed or when we reach a state where no available transition (if any) matches the current character being read.</p> <p>If the machine halts when it's in an accepted state and at the same time the whole input has been consumed the input string is considered to be accepted.</p> <p>Now, when introduce <span class="math-container">$\epsilon$</span> transitions the machine doesn't necessarily halt when the whole input string has been consumed, for it is possible that there are still <span class="math-container">$\epsilon$</span> transitions available.</p> <p>Suppose we have a NFA that is in an accepted state and also that the whole input has been consumed, but there are still <span class="math-container">$\epsilon$</span> transitions available in this state, can we considered the input string to be accepted or do we need to &quot;follow the trail&quot; of <span class="math-container">$\epsilon$</span> transitions until we reach a state where no other transition is available?</p>
0non-cybersec
Stackexchange
283
1,214
Restrict portrait orientation for Ionic App. <p>I am using Ionic, cordova to make an app. I am trying to restrict the orientation of the view to portrait only, I am doing the following in the config.xml file, but it is still not working any ideas?</p> <pre><code> &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt; &lt;widget id="com.ionicframework.ionicucas805049" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"&gt; &lt;name&gt;ionicUcas&lt;/name&gt; &lt;description&gt; An Ionic Framework and Cordova project. &lt;/description&gt; &lt;author email="hi@ionicframework" href="http://ionicframework.com/"&gt; Ionic Framework Team &lt;/author&gt; &lt;content src="index.html"/&gt; &lt;access origin="*"/&gt; &lt;preference name="webviewbounce" value="false"/&gt; &lt;preference name="UIWebViewBounce" value="false"/&gt; &lt;preference name="DisallowOverscroll" value="true"/&gt; &lt;preference name="BackupWebStorage" value="none"/&gt; &lt;preference name="Orienation" value="portrait" /&gt; &lt;feature name="StatusBar"&gt; &lt;param name="ios-package" value="CDVStatusBar" onload="true"/&gt; &lt;/feature&gt; &lt;/widget&gt; </code></pre> <p>I have added <code>&lt;preference name="Orienation" value="portrait" /&gt;</code> But no Joy....</p>
0non-cybersec
Stackexchange
492
1,360
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
mommies(and daddies) of r/parenting...for the first time ever, this summer i will be flying to cancun with my two year old son(also has never flown before) for vacation. advice needed!. as my title says, this is the first time we've both ever been on an airplane, and im already panicking. we will have one layover for an hour and a half in baltimore before we head to cancun. we're going with my father, brother, stepmom, and stepsister. in all of your collective wisdom, what are some tips, tricks, to-do's, and general to-knows about a trip like this? i already have my passport, but im starting the process for my little to get his. any answers will be greatly appreciated! edit: also, does anyone know if i will be able to bring sand home as a souvenir? i like to collect sand from any new beach that i go to.
0non-cybersec
Reddit
210
816
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 do Angular (1.5) components always have an isolated scope?. <p>I'm building an Angular library that provides a bunch of components that should make it easier to build SPA application on top of a certain API. For some components we're using the multi-slot transclusions feature. Multi-slot transclusions and components were introduces in the AngularJS 1.5 release. </p> <p>I really like both features, but I don't understand why components always have an isolated scope. I would like to control how variables are accessible in my transcluded template. But now I can't, because I can't control the scope. This basically means I have to tell the users of my library to reference the parent scope first in order to get to the data they need.</p> <p>Does anyone know a workaround?, or maybe I'm doing it wrong. Then please tell me :-)</p> <p>So this is my component: </p> <pre><code>export const ProductsListComponent = { transclude: { 'template' : '?productListItemTemplate' }, templateUrl: 'app/components/products-list/products-list.html', controller: ProductsListComponentController, bindings: { list: '=' } } ... angular.module('MyWebApplication', ['ngMessages', 'ui.router' ]) .component( 'productList', ProductsListComponent ) ... </code></pre> <p>Here's the template HTML:</p> <pre><code>&lt;div class="product-list-wrapper" ng-repeat="$product in $ctrl.list"&gt; &lt;ng-transclude ng-transclude="template"&gt; &lt;product-list-item product="$product"&gt;&lt;/product-list-item&gt; &lt;/ng-transclude&gt; &lt;/div&gt; </code></pre> <p>And this is how it can be used. And you see my problem. The expression must begin with <strong>$parent.</strong>$product.title, because the component scope is contained.</p> <pre><code>&lt;product-list list="search.products"&gt; &lt;product-list-item-template&gt; &lt;h2&gt;{{$parent.$product.title}}&lt;/h2&gt; &lt;/product-list-item-template&gt; &lt;/product-list&gt; </code></pre>
0non-cybersec
Stackexchange
596
2,016
Hard disk on Macbook Pro. <p>I am very new to Mac and Apple world, please excuse me for my ignorance if any. I do see Macbook pro or Air doesn't come with Hard Disk drive..!! It comes with flash storage with just storage like 128GB etc (which is very low I feel). Can anyone let me know why no Hard Disk on Macbook pro? Is it possible to install third party hard disk to it?</p> <p><a href="http://www.apple.com/in/macbook-pro/specs-retina/" rel="nofollow">http://www.apple.com/in/macbook-pro/specs-retina/</a></p>
0non-cybersec
Stackexchange
159
516
Thinking of the group $(\mathbb{Z}, +)$ as a single-object category?. <p>I am totally new to the category theory and my question might sound stupid. Nevertheless, I am eager to understand.</p> <p>I assume existence of category $C$ with a single object $A$. So each an every arrow in this category deliberately points back to itself. In other words, all the maps there are $A \mapsto A$. </p> <p>Now, at this point, nothing guarantees that those $A \mapsto A$ morphism are indeed <strong>isomorphisms</strong>. It appears to happen only when any group emerges, since, by definition, whatever group required to ship pairs of $(a, a^{-1})$; hence, it is perfectly fine to acknowledge the existence of $a \mapsto a^{-1}$ morphism together with $a^{-1} \mapsto a$, which both make $(a, a^{-1})$ isomorphic to each other. </p> <p>Next step is to define, let say, $(\mathbb{Z}, +)$ group as a category $C$. At this point I fail:</p> <blockquote> <p>Then category $C$ consists of set (or class) $A \mapsto A$ maps and associative composition function $(A, A) \times (A, A) \mapsto (A, A)$.</p> </blockquote> <p>I can't understand: $(+)$ is not an instance of $(A, A) \times (A, A) \mapsto (A, A)$. So somehow $(+) : (g \in A, g' \in A) \mapsto g'' \in A$ must be "upgraded" to become an $((+, +), (+, +)) \mapsto (+, +)$ and I see no clear yet obvious way to achieve it.</p> <p>So my question is: what is the magic trick to get the Cartesian product of <strong>binary operators</strong> given by any group such that it satisfy above-mentioned requirement? It would be really great if you stick to the $(\mathbb{Z}, +)$ example. </p>
0non-cybersec
Stackexchange
475
1,633
The reals in $L$. <p>Assume "$0^\#$ exists". </p> <p>We know that $0^\#$ is a $\Pi^1_2$-singleton. That means, there is a Shoenfield tree $S$ on $\omega \times (\omega \times \omega_1)$ so that $$x = 0^\# \leftrightarrow S_x \text{ is wellfounded},$$ where $S$ has the following definiton: for some recursive $$f : (\omega\times\omega)^{&lt;\omega} \to \text{linear orders} $$ we have </p> <ul> <li>$|s|=|t|=k \to f(s,t)$ is a linear order $k+1$ with greatest element $0$</li> <li>$s \subset s' \wedge t \subset t' \to f(s,t)$ is a suborder of $f(s',t')$.</li> <li>$(s,(t,\vec{\alpha})) \in S \leftrightarrow (\{\alpha_0, \dots,\alpha_k\};&lt;) \simeq (k+1, f(s,t)) \wedge t(0)=0$. (The requirement $t(0)=0$ is only for convenience in the question to follow)</li> </ul> <p>The question is: <strong>How wellfounded is $S_{0^\#}$?</strong> Since 0 is always the greatest element of $f(s,t)$, the rank of $\emptyset$ in $S_{0^\#}$ must $\omega_1$. But what is the rank of a length-1 node $(\langle 0 \rangle, \langle \alpha \rangle )$? Let $S'$ be the "stretch" of $S$ onto some $\kappa&gt;\omega_1$. That is, $S'$ is a tree on $\omega \times (\omega \times \kappa)$ with the same definition. <strong>What is the smallest possible value of $$ \beta_{S,0^\#}=\text{rank}_{S'_{0^\#}} (\langle 0 \rangle, \langle \omega_1 \rangle )$$ for all possible choices of $S$ satisfying $p[S] = \omega^\omega \setminus \{0^\#\}$?</strong></p> <p>It is not hard to come up with a definition of $S$ so that $\beta_{S,0^\#} = (\omega_1^V)^{+L}$. It seems that $\beta_{S,0^\#} &lt; (\omega_1^V)^{+L}$ is impossible. </p> <p>The ordinal $(\omega_1^V)^{+L}$ appears to be some kind of closure ordinal, or the higher level analog of $\omega_1^{CK}$.</p> <p><strong>In general, if $x$ is a $\Pi^1_2$-singleton and there is a choice of $S$ so that $\beta_{S,x} &lt; (\omega_1^V)^{+L}$ and $p[S] = \omega^\omega \setminus \{x\}$, must $x \in L$?</strong></p>
0non-cybersec
Stackexchange
726
1,942
How can I [20f] make some new friends that are girls?. Hello, try to keep an open mind while reading this. I am a twenty year old girl and I moved to a new state about a year ago, and I have not made any new friends. It is really depressing. I have a boyfriend but he lives about an hour away, with the rest of my old friends. I still keep in contact with my out of state friends (texting/facebook messaging a few times a week) but I rarely actually see them in person. I hang out with my boyfriend and his friends every weekend, but I do not have any of my own where I am currently living. It is almost embarrassing because my boyfriend has many, many friends and makes them very easily. I have a best friend that lives nearby my boyfriend but we don't hang out much due to her working and going to school, and also being boyfriend-obsessed which is fine., although we talk just about everyday through texting. I go to college (yes, I know, perfect place to make friends) but go to a commuter-only school. There are barely any clubs and no intramural sports teams. It's already a month into the semester so I am not sure if I can even join any new clubs? I have a part-time job and talk to my co-workers often, genuinely enjoying talking to them and I feel as though they feel the same about me, but there are either a) many years older, b) have kids and/or are married, so I don't see them having a great desire to hang out outside of work. In my classes I usually talk to people, but the classes are very small and I am the only girl in most of them (computer science major), so I feel as though becoming friends with a guy outside of class is just a bad idea. I really am desperate to make friends, preferably girls, but I don't even know where to start. I have anxiety but am working hard on managing it, which I think would help a lot with making some new friends to hang out with in my new home-state when I'm not with my boyfriend. I am considering just showing up to a club meeting at school but am worried about coming halfway into the school year into a group of people that already know each other. I would really appreciate some kind words and advice on how I can make some new friends.
0non-cybersec
Reddit
500
2,201
OpenVPN can connect but no internet unless UFW is disabled. <p>I have searched and found several questions similar to this, but they often are unanswered or the answers do not work in my case. I'm hoping that the added detail will help debug my problem.</p> <p>My Raspberry Pi B+ has OpenVPN running on port 443/TCP. I can successfully connect even with UFW enabled but my device cannot access the internet. With UFW disabled the VPN works correctly.</p> <p>Interestingly, I tried disabling and resetting UFW, then re-adding the rules to allow 53, 80, 443 and everything from 10.8.0.0/24. This worked for a bit (I think it stopped working after the first reboot).</p> <p><strong>cat /var/log/ufw.log</strong></p> <pre><code># 100s of near identical lines ommitted Aug 24 20:14:25 raspberrypib kernel: [ 559.195772] [UFW BLOCK] IN=tun0 OUT=enxb827eb4217d2 MAC= SRC=10.8.0.2 DST=172.217.25.36 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=42717 DF PROTO=TCP SPT=50554 DPT=443 WINDOW=65535 RES=0x00 SYN URGP=0 Aug 24 20:14:25 raspberrypib kernel: [ 559.343362] [UFW BLOCK] IN=tun0 OUT=enxb827eb4217d2 MAC= SRC=10.8.0.2 DST=216.58.220.106 LEN=1378 TOS=0x00 PREC=0x00 TTL=63 ID=12146 DF PROTO=UDP SPT=46888 DPT=443 LEN=1358 Aug 24 20:14:46 raspberrypib kernel: [ 580.290379] [UFW BLOCK] IN=tun0 OUT=enxb827eb4217d2 MAC= SRC=10.8.0.2 DST=216.58.200.99 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=63518 DF PROTO=TCP SPT=35938 DPT=443 WINDOW=65535 RES=0x00 SYN URGP=0 </code></pre> <p>This seems to suggest that UFW is blocking my traffic intentionally but I believe that I have the required rules. All traffic to or from <code>tun0</code> should be allowed. Traffic from 10.8.0.0/24 should be allowed.</p> <p><strong>ufw status verbose</strong></p> <pre><code>Status: active Logging: on (low) Default: deny (incoming), allow (outgoing), allow (routed) New profiles: skip To Action From -- ------ ---- 22 ALLOW IN Anywhere 443 ALLOW IN Anywhere 80 ALLOW IN Anywhere 443/tcp ALLOW IN Anywhere Anywhere ALLOW IN 10.8.0.0/24 53 ALLOW IN Anywhere Anywhere on tun0 ALLOW IN Anywhere 22 (v6) ALLOW IN Anywhere (v6) 443 (v6) ALLOW IN Anywhere (v6) 80 (v6) ALLOW IN Anywhere (v6) 443/tcp (v6) ALLOW IN Anywhere (v6) 53 (v6) ALLOW IN Anywhere (v6) Anywhere (v6) on tun0 ALLOW IN Anywhere (v6) Anywhere ALLOW OUT Anywhere on tun0 Anywhere (v6) ALLOW OUT Anywhere (v6) on tun0 </code></pre> <p><strong>ip route | grep default</strong></p> <pre><code>default via 192.168.1.1 dev enxb827eb4217d2 src 192.168.1.101 metric 202 </code></pre> <p><strong>cat /etc/ufw/before.rules</strong></p> <pre><code># # rules.before # # Rules that should be run before the ufw command line added rules. Custom # rules should be added to one of these chains: # ufw-before-input # ufw-before-output # ufw-before-forward # # START OPENVPN RULES # NAT table rules *nat :POSTROUTING ACCEPT [0:0] # Allow traffic from OpenVPN client to masquerade -A POSTROUTING -s 10.8.0.0/24 -o enxb827eb4217d2 -j MASQUERADE COMMIT # END OPENVPN RULES # Don't delete these required lines, otherwise there will be errors *filter :ufw-before-input - [0:0] :ufw-before-output - [0:0] :ufw-before-forward - [0:0] :ufw-not-local - [0:0] # End required lines # allow all on loopback -A ufw-before-input -i lo -j ACCEPT -A ufw-before-output -o lo -j ACCEPT # quickly process packets for which we already have a connection -A ufw-before-input -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT -A ufw-before-output -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT -A ufw-before-forward -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT # drop INVALID packets (logs these in loglevel medium and higher) -A ufw-before-input -m conntrack --ctstate INVALID -j ufw-logging-deny -A ufw-before-input -m conntrack --ctstate INVALID -j DROP # ok icmp codes for INPUT -A ufw-before-input -p icmp --icmp-type destination-unreachable -j ACCEPT -A ufw-before-input -p icmp --icmp-type source-quench -j ACCEPT -A ufw-before-input -p icmp --icmp-type time-exceeded -j ACCEPT -A ufw-before-input -p icmp --icmp-type parameter-problem -j ACCEPT -A ufw-before-input -p icmp --icmp-type echo-request -j ACCEPT # ok icmp code for FORWARD -A ufw-before-forward -p icmp --icmp-type destination-unreachable -j ACCEPT -A ufw-before-forward -p icmp --icmp-type source-quench -j ACCEPT -A ufw-before-forward -p icmp --icmp-type time-exceeded -j ACCEPT -A ufw-before-forward -p icmp --icmp-type parameter-problem -j ACCEPT -A ufw-before-forward -p icmp --icmp-type echo-request -j ACCEPT # allow dhcp client to work -A ufw-before-input -p udp --sport 67 --dport 68 -j ACCEPT # # ufw-not-local # -A ufw-before-input -j ufw-not-local # if LOCAL, RETURN -A ufw-not-local -m addrtype --dst-type LOCAL -j RETURN # if MULTICAST, RETURN -A ufw-not-local -m addrtype --dst-type MULTICAST -j RETURN # if BROADCAST, RETURN -A ufw-not-local -m addrtype --dst-type BROADCAST -j RETURN # all other non-local packets are dropped -A ufw-not-local -m limit --limit 3/min --limit-burst 10 -j ufw-logging-deny -A ufw-not-local -j DROP # allow MULTICAST mDNS for service discovery (be sure the MULTICAST line above # is uncommented) -A ufw-before-input -p udp -d 224.0.0.251 --dport 5353 -j ACCEPT # allow MULTICAST UPnP for service discovery (be sure the MULTICAST line above # is uncommented) -A ufw-before-input -p udp -d 239.255.255.250 --dport 1900 -j ACCEPT # don't delete the 'COMMIT' line or these rules won't be processed COMMIT </code></pre> <p><strong>ip addr show tun0</strong></p> <pre><code>3: tun0: &lt;POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP&gt; mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 100 link/none inet 10.8.0.1/24 brd 10.8.0.255 scope global tun0 valid_lft forever preferred_lft forever inet6 fe80::b3bb:ee7d:df9e:3f65/64 scope link flags 800 valid_lft forever preferred_lft forever </code></pre> <p><strong>cat /etc/default/ufw</strong></p> <pre><code># /etc/default/ufw # # Set to yes to apply rules to support IPv6 (no means only IPv6 on loopback # accepted). You will need to 'disable' and then 'enable' the firewall for # the changes to take affect. IPV6=yes # Set the default input policy to ACCEPT, DROP, or REJECT. Please note that if # you change this you will most likely want to adjust your rules. DEFAULT_INPUT_POLICY="DROP" # Set the default output policy to ACCEPT, DROP, or REJECT. Please note that if # you change this you will most likely want to adjust your rules. DEFAULT_OUTPUT_POLICY="ACCEPT" # Set the default forward policy to ACCEPT, DROP or REJECT. Please note that # if you change this you will most likely want to adjust your rules DEFAULT_FORWARD_POLICY="ACCEPT" # Set the default application policy to ACCEPT, DROP, REJECT or SKIP. Please # note that setting this to ACCEPT may be a security risk. See 'man ufw' for # details DEFAULT_APPLICATION_POLICY="SKIP" # By default, ufw only touches its own chains. Set this to 'yes' to have ufw # manage the built-in chains too. Warning: setting this to 'yes' will break # non-ufw managed firewall rules MANAGE_BUILTINS=no # # IPT backend # # only enable if using iptables backend IPT_SYSCTL=/etc/ufw/sysctl.conf # Extra connection tracking modules to load. Complete list can be found in # net/netfilter/Kconfig of your kernel source. Some common modules: # nf_conntrack_irc, nf_nat_irc: DCC (Direct Client to Client) support # nf_conntrack_netbios_ns: NetBIOS (samba) client support # nf_conntrack_pptp, nf_nat_pptp: PPTP over stateful firewall/NAT # nf_conntrack_ftp, nf_nat_ftp: active FTP support # nf_conntrack_tftp, nf_nat_tftp: TFTP support (server side) IPT_MODULES="nf_conntrack_ftp nf_nat_ftp nf_conntrack_netbios_ns" </code></pre> <p><strong>cat /etc/sysctl.conf</strong></p> <pre><code># # /etc/sysctl.conf - Configuration file for setting system variables # See /etc/sysctl.d/ for additional system variables. # See sysctl.conf (5) for information. # #kernel.domainname = example.com # Uncomment the following to stop low-level messages on console #kernel.printk = 3 4 1 3 ##############################################################3 # Functions previously found in netbase # # Uncomment the next two lines to enable Spoof protection (reverse-path filter) # Turn on Source Address Verification in all interfaces to # prevent some spoofing attacks #net.ipv4.conf.default.rp_filter=1 #net.ipv4.conf.all.rp_filter=1 # Uncomment the next line to enable TCP/IP SYN cookies # See http://lwn.net/Articles/277146/ # Note: This may impact IPv6 TCP sessions too #net.ipv4.tcp_syncookies=1 # Uncomment the next line to enable packet forwarding for IPv4 net.ipv4.ip_forward=1 # Uncomment the next line to enable packet forwarding for IPv6 # Enabling this option disables Stateless Address Autoconfiguration # based on Router Advertisements for this host #net.ipv6.conf.all.forwarding=1 ################################################################### # Additional settings - these settings can improve the network # security of the host and prevent against some network attacks # including spoofing attacks and man in the middle attacks through # redirection. Some network environments, however, require that these # settings are disabled so review and enable them as needed. # # Do not accept ICMP redirects (prevent MITM attacks) #net.ipv4.conf.all.accept_redirects = 0 #net.ipv6.conf.all.accept_redirects = 0 # _or_ # Accept ICMP redirects only for gateways listed in our default # gateway list (enabled by default) # net.ipv4.conf.all.secure_redirects = 1 # # Do not send ICMP redirects (we are not a router) #net.ipv4.conf.all.send_redirects = 0 # # Do not accept IP source route packets (we are not a router) #net.ipv4.conf.all.accept_source_route = 0 #net.ipv6.conf.all.accept_source_route = 0 # # Log Martian Packets #net.ipv4.conf.all.log_martians = 1 # ################################################################### # Magic system request Key # 0=disable, 1=enable all # Debian kernels have this set to 0 (disable the key) # See https://www.kernel.org/doc/Documentation/sysrq.txt # for what other values do #kernel.sysrq=1 ################################################################### # Protected links # # Protects against creating or following links under certain conditions # Debian kernels have both set to 1 (restricted) # See https://www.kernel.org/doc/Documentation/sysctl/fs.txt #fs.protected_hardlinks=0 #fs.protected_symlinks=0 </code></pre> <p><strong>sudo iptables --table nat --list</strong></p> <pre><code>Chain PREROUTING (policy ACCEPT) target prot opt source destination Chain INPUT (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination Chain POSTROUTING (policy ACCEPT) target prot opt source destination MASQUERADE all -- 10.8.0.0/24 anywhere </code></pre> <p>EDIT: I can ping the server and connect via SSH.</p>
0non-cybersec
Stackexchange
3,828
11,362
Gradle equivalent to maven systemPath. <p>I can't figure out what to put in gradle to satisfy this dependency:</p> <pre><code> &lt;dependency&gt; &lt;groupId&gt;javax.jnlp&lt;/groupId&gt; &lt;artifactId&gt;jnlp-api&lt;/artifactId&gt; &lt;version&gt;8.0&lt;/version&gt; &lt;scope&gt;system&lt;/scope&gt; &lt;systemPath&gt;${java.home}/lib/javaws.jar&lt;/systemPath&gt; &lt;/dependency&gt; </code></pre>
0non-cybersec
Stackexchange
171
436
How to test redux saga with jest?. <p>Just new in react , react-redux/saga and jest</p> <p>consider:</p> <p><strong>-----The Componnent ()----</strong></p> <pre><code>componentDidMount() { this.props.actions.initTodos( axios, ajaxURLConstants.WP_GET_TODOS, appStateActions.setAppInIdle, appStateActions.setAppInProcessing, todosActions.todosInitialized ); } </code></pre> <p>So when my <strong>TodoApp</strong> component did mount, it will dispatch the <strong>INIT_TODOS</strong> action which then <strong>my root saga is listening</strong> , and when it caught it, will spawn the appropriate worker saga to act accordingly.</p> <p><strong>-----The Corresponding Worker Saga-----</strong></p> <pre><code>export function* initTodosSaga( action ) { try { yield put( action.setAppInProcessing() ); let response = yield call( action.axios.get , action.WP_GET_TODOS ); if ( response.data.status === "success" ) yield put( action.todosInitialized( response.data.todos ) ); else { console.log( response ); alert( response.data.error_msg ); } } catch ( error ) { console.log( "error" , error ); alert( "Failed to load initial data" ); } yield put( action.setAppInIdle() ); } </code></pre> <p><strong>-----The Test So Far-----</strong></p> <pre><code>import todos from "../../__fixtures__/todos"; import { initTodosSaga } from "../todosSaga"; test( "saga test" , () =&gt; { let response = { status : "success", todos }, action = { axios : { get : function() { return new Promise( ( resolve , reject ) =&gt; { resolve( response ); } ); } }, WP_GET_TODOS : "dummy url", setAppInIdle : jest.fn(), setAppInProcessing : jest.fn(), todosInitialized : jest.fn() }; let initTodosSagaGen = initTodosSaga( action ); initTodosSagaGen.next(); expect( action.setAppInIdle ).toHaveBeenCalled(); } ); </code></pre> <p><strong>-----The Test Result-----</strong></p> <p><a href="https://i.stack.imgur.com/sJKiD.png" rel="noreferrer"><img src="https://i.stack.imgur.com/sJKiD.png" alt="enter image description here"></a></p> <p>So the important part is this </p> <p><strong>console.error node_modules\redux-saga\lib\internal\utils.js:240</strong></p> <p><strong>uncaught at check put(action): argument action is undefined</strong></p> <p>but I have console.log the action i passed on my test inside the worker saga and indeed it is not undefined</p> <p>what am I missing?</p> <p>Thanks in advance.</p> <p><strong>----------Update------------</strong></p> <p>Ok notice on the top that it is complaining on this line of code</p> <pre><code>yield put( action.setAppInIdle() ); </code></pre> <p>Which is outside the try catch block , so i made a couple of changes</p> <p>1.) I moved the code above inside the try catch block, just after the else statement of </p> <pre><code>if ( response.data.status === "success" ) </code></pre> <p>please check <strong>initTodosSaga</strong> code above</p> <p>Then on my saga test, i test for </p> <pre><code>expect( action.setAppInProcessing ).toHaveBeenCalled(); </code></pre> <p>instead of the <strong>setAppInIdle</strong> spy function</p> <p>and this is the test result</p> <p><a href="https://i.stack.imgur.com/rcmrs.png" rel="noreferrer"><img src="https://i.stack.imgur.com/rcmrs.png" alt="enter image description here"></a></p> <p>so the test passed! <strong>but still it is complaining about the action being undefined</strong></p> <p>now what is interesting is if in my saga test, if I test for this now</p> <pre><code>expect( action.setAppInProcessing ).toHaveBeenCalled(); expect( action.setAppInIdle ).toHaveBeenCalled(); </code></pre> <p>This is the result</p> <p><a href="https://i.stack.imgur.com/YIBtn.png" rel="noreferrer"><img src="https://i.stack.imgur.com/YIBtn.png" alt="enter image description here"></a></p> <p>so now it still complains about the action still undefined ( I have not included in my screenshot, but still same as above )</p> <p>plus the second assert i have about the <strong>setAppInIdle</strong> spy function was not called, but the <strong>setAppInProcessing</strong> did pass!</p> <p>I hope this additional info helps in resolving this question.</p>
0non-cybersec
Stackexchange
1,459
4,584