text
stringlengths 36
35k
| label
class label 2
classes | source
stringclasses 3
values | tokens_length
int64 128
4.1k
| text_length
int64 36
35k
|
---|---|---|---|---|
Runaway argument? with \def. <p>I have a time value in the format HH:MM (i.e 03:00).</p>
<p>I need to compute the TotalMinutes of this time (expected result 180).</p>
<p>My current code is</p>
<pre><code>\documentclass{article}
\makeatletter
\newcommand{\timeHHMMToTotalMinutes}[1]%
{\timeHHMMToTotalMinutes@h#1}%
\def\timeHHMMToTotalMinutes@h#1:#2{\the\numexpr#1*60+#2}%
\makeatother
\begin{document}
\def\tOne{03:00}%
\timeHHMMToTotalMinutes{\tOne}\\%
\end{document}
</code></pre>
<p>but unfortunatelly, it gives me error:</p>
<blockquote>
<p>Runaway argument? </p>
<p>\tOne \\end {document}</p>
<p>! File ended while scanning use of \timeHHMMToTotalMinutes@h.</p>
</blockquote>
<p>How to I solve this? What did I misunderstood about argument parsing?</p>
| 0non-cybersec
| Stackexchange | 308 | 782 |
Chrome Extension - No base href set. Please provide a value for the APP_BASE_HREF. <p>I am building a Chrome Browser Action Extension.</p>
<p>I am attempting to load an Angular 2 application into the Popup Window in Chrome.</p>
<p>I have done this before using Angular 1.5, but attempting with Angular 2 and getting an error.</p>
<blockquote>
<p>Unhandled Promise rejection: No base href set. Please provide a value
for the APP_BASE_HREF token or add a base element to the document. ;
Zone: ; Task: Promise.then ; Value: Error: No base href set.
Please provide a value for the APP_BASE_HREF token or add a base
element to the document.(…) Error: No base href set. Please provide a
value for the APP_BASE_HREF token or add a base element to the
document.</p>
</blockquote>
<p>I have put the <code><base href="/"></code> tag into my popu.html. But the problem is that vendor.js and main.js get loaded underneath by Chrome (and before being loaded by popup.html) and so there is no HTML page in which to put <code><base href="/"></code></p>
<p>Just wondering how I can resolve this issue.</p>
<p><strong>Popup.html</strong></p>
<p><a href="https://i.stack.imgur.com/cKzRH.png" rel="noreferrer"><img src="https://i.stack.imgur.com/cKzRH.png" alt="enter image description here"></a></p>
<pre><code><!doctype html>
<html>
<head>
<base href="/">
<meta charset="utf-8">
<title>FountainJS</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="icon" type="image/png" href="http://fountainjs.io/assets/imgs/fountain.png"/>
<link href="../styles/popup.css" rel="stylesheet">
</head>
<body>
<div style="width: 200px; height: 150px;">
<fountain-root>My Awesome Chrome Popup should load with Angular 2 right Here</fountain-root>
<script type="text/javascript" src="../scripts/vendor.js"></script>
<script type="text/javascript" src="../scripts/main.js"></script>
</div>
</body>
</html>
</code></pre>
| 0non-cybersec
| Stackexchange | 738 | 2,142 |
So a politician dies.... And ends up standing in front of the pearly gates. Saint Peter looks at him for a second, flicks through his book, and finds his name.
"So, you're a politician..."
"Well, yes, is that a problem?"
"Oh no, no problem. But we've recently adopted a new system for people in your line of work, and unfortunately you will have to spend a day in Hell. After that however, you're free to choose where you want to spend eternity!"
"Wait, I have to spend a day in Hell??" says the politician.
"Them's the rules" Says St Peter, clicks his fingers, and WOOMPH, the guy dissapears...
And awakes, curled up with his hands over his eyes, knowing he's in Hell. Cautiously, he listens for the screams, sniffs the air for brimstone, and finds... Nothing. Just the smell of, is that fabric softener? And cut grass, this can't be right?
"Open your eyes!" says a voice. "C'mon, wakey wakey, we've only got 24 hours!". Nervously, he uncovers his eyes, looks around, and sees he's in a hotel room. A nice one too. Wait, this is a penthouse suite... And there's a smiling man in a suit, holding a martini.
"Who are you??" The politician asks. "Well, I'm Satan!" says the man, handing him the drink and helping him to his feet. "Welcome to Hell!"
"Wait, this is Hell? But... Where's all the pain and suffering?" he asks.
Satan throws him a wink. "Oh, we've been a bit mis-represented over the years, it's a long story. Anyway, this is your room! The minibar is of course free, as is the room service, there's extra towels next to the hot-tub, and if you need anything, just call reception. But enough of this! It's a beautiful day, and if you'd care to look outside..."
Slightly stunned by the opulent surroundings, the man wanders over to the floor-to-ceiling windows through which the sun is glowing, looks far down, and sees a group of people cheering and waving at him from a golf course.
"It's one of 5 pro-level courses on site, and there's another 6 just a few minutes drive out past the beach and harbour!" says Satan, answering his unasked question.
So they head down in the lift, walk out through the glittering lobby where everyone waves and welcomes the man, as Satan signs autographs and cherrily talks shop with the laughing staff. And as he walks out, he sees the group on the golf course are made up of every one of his old friends, people he's admired for years but never met or worked with, and people whose work he's admired but died long before his career started. And out of the middle of this group walks his wife, with a massive smile and the body she had when she was 20, who throws her arms around him and plants a delicate kiss on his cheek. Everyone cheers and applauds, and as they slap him on the back and trade jokes, his worst enemy arrives, as a 2 foot tall goblin-esque caddy. He spends the day in the bright sunshine on the course, having the time of his life laughing at jokes and carrying important discussions, putting the world to rights with his friends while holding his delighted wife next to him as she gazes lovingly at him. Later, they return to the hotel for dinner and have an enormous meal, perfectly cooked, which descends into a food-fight when someone accidentally throws a bread roll at the next table (where Ghandi is having a game of truth-or-dare with Marylin Monroe). As everyone is falling about laughing and flinging breadsticks at each other, his wife whispers in his ear... And they return to their penthouse suite, and spend the rest of the night making love like they did on their honeymoon. After 6 hours of intense passion, the man falls deep into the 100% Egyptian cotton pillows, and falls into a deep and happy sleep...
And is woken up by St Peter. "So, that was Hell. Wasn't what you were expecting, I bet?"
"No sir!" says the man.
"So then" says St Peter "you can make your choice. It's Hell, which you saw, or Heaven, which has choral singing, talking to God, white robes, and so on".
"Well... I know this sounds strange, but on balance, I think I'd prefer Hell" says the politician.
"Not a problem, we totally understand! Enjoy!" Says St Peter, and clicks his fingers again.
The man wakes up in total darkness, the stench of ammonia filling the air and distant screams the only noise. As he adjusts, he can see the only light is from belches of flame far away, illuminating the ragged remains of people being tortured or burning in a sulphurous ocean. A sudden bolt of lightning reveals Satan next to him, wearing the same suit as before and grinning, holding a soldering iron in one hand and a coil of razor-wire in the other.
"What's this??" He cries. "Where's the hotel?? Where's my wife??? Where's the minibar, the golf-courses, the pool, the restaurant, the free drinks and the sunshine???"
"Ah", says Satan. "You see, yesterday, we were campaigning. But today, you voted..." | 0non-cybersec
| Reddit | 1,210 | 4,858 |
How do I check if a character is a Unicode new-line character (not only ASCII) in Rust?. <p>Every programming language has their own interpretation of <code>\n</code> and <code>\r</code>.
Unicode supports multiple characters that <em>can</em> represent a new line.</p>
<p>From <a href="https://doc.rust-lang.org/stable/reference/tokens.html#character-escapes" rel="noreferrer">the Rust reference</a>:</p>
<blockquote>
<p>A whitespace escape is one of the characters U+006E (n), U+0072 (r),
or U+0074 (t), denoting the Unicode values U+000A (LF), U+000D (CR) or
U+0009 (HT) respectively.</p>
</blockquote>
<p>Based on that statement, I'd say a Rust character is a new-line character if it is either <code>\n</code> or <code>\r</code>. On Windows it might be the combination of <code>\r</code> and <code>\n</code>. I'm not sure though.</p>
<p>What about the following?</p>
<ul>
<li>Next line character (U+0085)</li>
<li>Line separator character (U+2028)</li>
<li>Paragraph separator character (U+2029)</li>
</ul>
<p>In my opinion, we are missing something like a <code>char.is_new_line()</code>.
I looked through the <a href="http://www.fileformat.info/info/unicode/category/index.htm" rel="noreferrer">Unicode Character Categories</a> but couldn't find a definition for new-lines.</p>
<p>Do I have to come up with my own definition of what a Unicode new-line character is?</p>
| 0non-cybersec
| Stackexchange | 454 | 1,391 |
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 |
Showing $H=\langle a,b|a^2=b^3=1,(ab)^n=(ab^{-1}ab)^k\rangle$.. <blockquote>
<p>Let <span class="math-container">$G=\langle a,b|a^2=b^3=1,(ab)^n=(ab^{-1}ab)^k \rangle$</span>. Prove that <span class="math-container">$G$</span> can be generated with <span class="math-container">$ab$</span> and <span class="math-container">$ab^{-1}ab$</span>. And from there, <span class="math-container">$\langle(ab)^n\rangle\subset Z(G)$</span>.</p>
</blockquote>
<p>Problem wants <span class="math-container">$H=\langle ab,ab^{-1}ab \rangle$</span> to be <span class="math-container">$G$</span>. Clearly, <span class="math-container">$H\leqslant G$</span> and after doing some handy calculation which takes time I've got:</p>
<blockquote>
<ol>
<li><p><span class="math-container">$ab^{-1}=(ab^{-1}ab)(ab)^{-1}\in H$</span></p>
</li>
<li><p><span class="math-container">$b=b^{-2}=(ab)^{-1}ab^{-1}\in H$</span></p>
</li>
<li><p><span class="math-container">$a=(ab)b^{-1}\in H$</span></p>
</li>
</ol>
</blockquote>
<p>So <span class="math-container">$G\leqslant H$</span> and therefore <span class="math-container">$G=H=\langle ab,ab^{-1}ab\rangle$</span>.</p>
<p>For the second part, I should prove that <span class="math-container">$N=\langle(ab)^n\rangle\leqslant Z(G)$</span>.</p>
<p>Please help me.</p>
<p>Thanks.</p>
| 0non-cybersec
| Stackexchange | 509 | 1,306 |
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 |
Chroot Jailing of an user to their home with PHP CLI and everything to run Magento 2 CLi commands. <p>Ok, so first off I'm pretty sure there's gonna be a load of "additional info" requests so please post them in the OP comments and I'll do my best to provide extra info on request! </p>
<p>Here's the skinny, first the server : </p>
<p>It is a Shared staging server, Ubuntu 16.4 LTS with Apache2.4, Php7.1, Mysql 5.7. It has Webmin, VirtualMin and UserMin installed (latest). It also has phpMyAdmin installed globally. It's configured to allow sites to be served with mod_php (using www-data), CGI, FCGI (default) or FPM+FCGI. CGI/FPM varients use SuExec to execute the sites. The web server itself works perfectly. </p>
<p>So, the task now is to set up a Chroot jail to allow an existing domain user to SSH or SFTP but only see their Home directory which is already populated with a latest Magento 2 install. </p>
<p>In this example we'll use these details : </p>
<p>User = domain
Group = domain
Home Dir = /home/domain/
Chroot = /var/chroot/</p>
<p>Now, I can set up the Chroot fine, What I've done is copy the relivent lib/var/usr files needed, allowed the commands ls, bash, sh, rm, rmdir, mkdir, touch, vi & php. </p>
<p>It took some work but I got the PHP command working (after finding all the module dependancies) almost correctly. </p>
<p>The CHroot jail is fine, I mounted /home/domain to /var/chroot/home/domain so thats fine. The user is effectively jailed and can see the users home directory and thus can access all the website files no problems. </p>
<p>Databasewise I left out the mysql commands as we have phpmyadmin available globally so they can log into the releivent database only using the dedicates domain mysql user. no probs.</p>
<p>The real problem comes with Magento 2. Here as we know you use command line tools to do things like cache refreshes, index building and other deployment tasks, some examples : </p>
<pre><code>domain@server:/home/domain/public_html# php bin/magento cache:flush
domain@server:/home/domain/public_html# php bin/magento indexer:reindex
domain@server:/home/domain/public_html# php bin/magento setup:static-content:deploy en_US
</code></pre>
<p>As we can see these commands are run through the PHP CLI interpreter, hense all the work getting PHP to work right on the jailed CLI. </p>
<p>At first I was getting Database issues with <code>cache:flush</code> ect but with some fiddling of the php.ini for the CLI (I copied the FCGI one from the users home into the jailed location) and some "finding the right mysql.sock" I fixed that up no probs (well, some probs but fixed it!) </p>
<p><strong>The actual question</strong></p>
<p>I have a problem with <code>indexer:reindex</code> with root permissions there's no problem however within the Chroot as the user domain for some reason the command throws errors for all but the first index. Here's the result : </p>
<pre><code>-bash-4.3$ cd /home/domain/public_html/
-bash-4.3$ php bin/magento indexer:reindex
Design Config Grid index has been rebuilt successfully in 00:00:00
Customer Grid indexer process unknown error:
Warning: SessionHandler::read(): open(/home/domain/tmp/sess_mfn527a808ntv8e3g9glcjg8aq, O_RDWR) failed: No such file or directory (2) in /home/domain/public_html/vendor/magento/framework/Session/SaveHandler/Native.php on line 22
Category Products indexer process unknown error:
Warning: SessionHandler::read(): open(/home/domain/tmp/sess_mfn527a808ntv8e3g9glcjg8aq, O_RDWR) failed: No such file or directory (2) in /home/domain/public_html/vendor/magento/framework/Session/SaveHandler/Native.php on line 22
Product Categories indexer process unknown error:
Warning: SessionHandler::read(): open(/home/domain/tmp/sess_mfn527a808ntv8e3g9glcjg8aq, O_RDWR) failed: No such file or directory (2) in /home/domain/public_html/vendor/magento/framework/Session/SaveHandler/Native.php on line 22
Product Price indexer process unknown error:
Warning: SessionHandler::read(): open(/home/domain/tmp/sess_mfn527a808ntv8e3g9glcjg8aq, O_RDWR) failed: No such file or directory (2) in /home/domain/public_html/vendor/magento/framework/Session/SaveHandler/Native.php on line 22
Warning: SessionHandler::read(): open(/home/domain/tmp/sess_mfn527a808ntv8e3g9glcjg8aq, O_RDWR) failed: No such file or directory (2) in /home/domain/public_html/vendor/magento/framework/Session/SaveHandler/Native.php on line 22
Warning: SessionHandler::read(): open(/home/domain/tmp/sess_mfn527a808ntv8e3g9glcjg8aq, O_RDWR) failed: No such file or directory (2) in /home/domain/public_html/vendor/magento/framework/Session/SaveHandler/Native.php on line 22
Catalog Rule Product indexer process unknown error:
Warning: SessionHandler::read(): open(/home/domain/tmp/sess_mfn527a808ntv8e3g9glcjg8aq, O_RDWR) failed: No such file or directory (2) in /home/domain/public_html/vendor/magento/framework/Session/SaveHandler/Native.php on line 22
Catalog Product Rule indexer process unknown error:
Warning: SessionHandler::read(): open(/home/domain/tmp/sess_mfn527a808ntv8e3g9glcjg8aq, O_RDWR) failed: No such file or directory (2) in /home/domain/public_html/vendor/magento/framework/Session/SaveHandler/Native.php on line 22
Catalog Search indexer process unknown error:
Warning: SessionHandler::read(): open(/home/domain/tmp/sess_mfn527a808ntv8e3g9glcjg8aq, O_RDWR) failed: No such file or directory (2) in /home/domain/public_html/vendor/magento/framework/Session/SaveHandler/Native.php on line 22
</code></pre>
<p>Ok, said I, this is some sort of session creation fail followed by the indexer not able to read the session that failed to create. Explains why the first one works but subsiquent fail. I attempted to mount the default sesion directory for PHp into the chroot jail, so I mounted <code>/var/lib/php/</code> to <code>/var/chroot/var/lib/php</code>. This directory has the sticky bit so I though rather than create I'd mount.</p>
<p>Still no dice. I though well what if I reindex one at a time : </p>
<pre><code>-bash-4.3$ php bin/magento indexer:reindex customer_grid
Customer Grid indexer process unknown error:
Warning: SessionHandler::read(): open(/home/domain/tmp/sess_en89p7h50m9mc1a0pb8l3c3tv1, O_RDWR) failed: No such file or directory (2) in /home/domain/public_html/vendor/magento/framework/Session/SaveHandler/Native.php on line 22
</code></pre>
<p>Still no dice. I am struggling to see what it is actually struggling with, where it's getting this supposed session ID, where it is supposed to be creating the session file and where / what logs I can look at for information!</p>
<p>Can anyone offer up any sort of suggestion for m to move forward and master SH jailing of a user of a Magento 2 site? </p>
| 0non-cybersec
| Stackexchange | 2,058 | 6,731 |
Proving a strict inequality in the limit. <p>I want to prove that
<span class="math-container">$$ \lim_{k \to \infty} \left( 1 + \frac{1}{2} \right) \left(1 + \frac{1}{4} \right)...\left( 1 + \frac{1}{2^k} \right) < e .$$</span></p>
<p>Using the <span class="math-container">$AM-GM$</span> inequality we arrive at
<span class="math-container">$$\left( 1 + \frac{1}{2} \right) \left(1 + \frac{1}{4} \right)...\left( 1 + \frac{1}{2^k} \right) < \left(\frac{k + 1 - \frac{1}{2^k} }{k} \right)^k = \left( 1 + \frac{1}{k} - \frac{1}{k2^{k}}\right)^k < \left(1 + \frac{1}{k} \right)^k < e.$$</span></p>
<p>The first inequality is strict because the terms are different.However, I know that in the limit, strict inequalities can transform into equalities. Since the limit of <span class="math-container">$\left( 1 + \frac{1}{k} - \frac{1}{k2^{k}}\right)^k$</span> when <span class="math-container">$k$</span> goes to infinity is also <span class="math-container">$e$</span>, how could I prove a strict inequality?</p>
| 0non-cybersec
| Stackexchange | 384 | 1,026 |
Using Multipart without Form in Spring MVC. <p>I had gone through many articles in stackoverflow on this specific topic, after a detailed analysis I have finally dared to post another question on the same topic.</p>
<p>I think this would be obvious that what I wanted to do here,</p>
<p><strong>What do I want?</strong></p>
<p>I want to upload a file. I am using angularjs and Spring MVC.</p>
<p><strong>Source :</strong></p>
<p><strong>Controller @Spring :</strong> </p>
<pre><code>@RequestMapping(value="/upload", method=RequestMethod.POST, consumes = {"multipart/form-data"})
public String handleFileUpload(@RequestParam(value = "file") MultipartFile file){
String name="";
if (!file.isEmpty()) {
try {
byte[] bytes = file.getBytes();
BufferedOutputStream stream =
new BufferedOutputStream(new FileOutputStream(new File(name)));
stream.write(bytes);
stream.close();
return "You successfully uploaded " + name + "!";
} catch (Exception e) {
return "You failed to upload " + name + " => " + e.getMessage();
}
} else {
return "You failed to upload " + name + " because the file was empty.";
}
}
@Bean
public MultipartResolver multipartResolver() {
CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver();
multipartResolver.setMaxUploadSize(500000000);
return multipartResolver;
}
</code></pre>
<p><strong>HTML :</strong></p>
<pre><code>File to upload: <input type="file"
file-model="file" name="fd"><br /> Name: <input type="text" name="name"><br />
<br /> <input type="submit" ng-click="uploadFile()" value="Upload"> Press here to
upload the file!
</code></pre>
<p><strong>JS :</strong></p>
<pre><code>$scope.uploadFile = function() {
var fd = new FormData();
var file = $scope.file;
fd.append('file', file);
$http.post("/upload",fd,
{
headers : {
'Content-Type' : undefined
}
}).success(function(data) {
debugger;
}).error(function(data) {
debugger;
})
}
</code></pre>
<p>Looks fair??? Here are the observations</p>
<p><strong>Observations on execution:</strong></p>
<p><a href="https://i.stack.imgur.com/nvG6N.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nvG6N.jpg" alt="enter image description here"></a></p>
<p><a href="https://i.stack.imgur.com/zyFFT.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zyFFT.jpg" alt="enter image description here"></a></p>
<p><strong>References :</strong></p>
<p><a href="https://stackoverflow.com/questions/21015891/spring-mvc-angularjs-file-upload-org-apache-commons-fileupload-fileuploade">Spring MVC - AngularJS - File Upload - org.apache.commons.fileupload.FileUploadException</a></p>
<p><a href="https://stackoverflow.com/questions/2198470/javascript-uploading-a-file-without-a-file/2198524#2198524">Javascript: Uploading a file... without a file</a></p>
<p><a href="https://stackoverflow.com/questions/2305218/what-is-the-boundary-parameter-in-an-http-multi-part-post-request">What is the boundary parameter in an HTTP multi-part (POST) Request?</a></p>
<p>And many more....:)</p>
<hr>
<p><strong>Update</strong></p>
<p>Directive which is used in angular,</p>
<pre><code>myApp.directive("fileread", [function () {
return {
scope: {
fileread: "="
},
link: function (scope, element, attributes) {
element.bind("change", function (changeEvent) {
var reader = new FileReader();
reader.onload = function (loadEvent) {
scope.$apply(function () {
scope.fileread = loadEvent.target.result;
});
}
reader.readAsDataURL(changeEvent.target.files[0]);
});
}
}
}]);
</code></pre>
<p><strong>Request extracted from chrome :</strong></p>
<p><a href="https://i.stack.imgur.com/8WCBW.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8WCBW.jpg" alt="enter image description here"></a></p>
| 0non-cybersec
| Stackexchange | 1,315 | 4,278 |
IP Address issue on Iinux vm and vpn. <p>I think this is the right place to ask this question.
so my current problem is that we have a virtual machine and a vpn. Our vm is a linux server and our vpn is a rpi.</p>
<p>Our vm is using a 10.x.x.x ip address. We connect that vm to a different vpn (using hamachi) that is also on a 10.x.x.x ip address. </p>
<p>My problem is the vpn on the vm is not connecting. When i try to ping it, im getting destination host unreachable. I then tried it with a windows vm and was able to connect to it.</p>
<p>So my question is, is there a different settings i should check on linux for it to connect? What is the reason why it wasn't connecting when i used a linux vm? Is the 10.x.x.x linux ip not compatible with the 10.x.x.x rpi ip or something? I just want to understand and try to fix the issue. Because we'd rather use a linux vm than a windows vm. </p>
| 0non-cybersec
| Stackexchange | 264 | 897 |
Android Navigation Component keeps reloading WebView. <p>Today I faced a problem with <code>WebView</code> inside a <code>Fragment</code> using <code>Android Navigation Component</code>.
In my case, in <code>Fragment1</code> there is button under <code>WebView</code>. User needs to scroll down to click it. After clicking it, a new destination is opened (<code>Fragment2</code>). Then, when user goes back to <code>Fragment1</code>, <code>WebView</code> is reloaded, and viewport is scrolled to the top again.</p>
<p>It's extremely annoying. User might been scrolling down for minutes, and it always throws him to the very top after coming back. Can I somehow prevent it from reloading / scrolling back to top?</p>
<p>Example code could be as simple as that:</p>
<pre><code>class Fragment1 : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
webView.loadData(getString(R.string.some_very_long_html), "text/html", "UTF-8")
buttonBelowWebView.setOnClickListener {
navigateToFragment2()
}
}
}
</code></pre>
<p>If <code>WebView</code> contains videos, loading might take even up to 5 seconds. It's terrible experience.</p>
<p>I tried adding flag to load only one time, but then <code>WebView</code> is empty when navigating back from <code>Fragment2</code>:</p>
<pre><code>class Fragment1 : Fragment() {
var loaded = false
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
if(!loaded) {
webView.loadData(getString(R.string.some_very_long_html), "text/html", "UTF-8")
loaded = true
}
}
}
</code></pre>
<p>Note that in real life I use <code>ViewModel</code>s and observe data from rest api, but the problem stays the same.</p>
<p>Also, example code I provided is written in Kotlin, but if there is solution in Java, then it's appreciated too.</p>
<p>Is it possible to not reload <code>WebView</code> and reset scroll position when navigating back from nested destination?</p>
| 0non-cybersec
| Stackexchange | 601 | 2,085 |
I am Mark Tippetts, Libertarian Candidate for Governor of Texas. Let's stop the war on drugs! AMA!. My name is Mark Tippetts, and I am the Libertarian Party’s 2018 candidate for Governor of Texas.
We need to **legalize marijuana, oppose Trump's wall and commit to a true, free-market, sustainable economy**.
I am **bilingual** and **bi-cultural** and am an **International Legal & Business Consultant** for businesses and individuals that own property and/or do business in **Mexico** and **Latin America**. Making enemies with our southern neighbors and erecting walls between us is counterproductive, insulting and foolish. I am the candidate on Texas' ballot this November that will **oppose the embarrassing behavior of Donald Trump** and his absurd attacks on immigrants and building of walls. We must honor the principle of **individual liberty**.
I have a background in **law, business, project development and project management**. I have a **Bachelors of Law** and a **Masters in Administration from San Luis Potosi, Mexico**. Over the past 30 years, I have established, developed and operated several companies, including a **HydroElectric Plant in Belize**, **Central America and a Law Firm in Monterrey, Mexico**. Throughout my career I have effectively communicated and successfully partnered with many private, and government entities, including: legal, engineering, environmental, electric and water commissions, natural resource departments, lands departments, road and bridge departments as well as municipalities and villages. In the legal field, I have been successful in negotiating international grants, concessions, land leases, water rights, contracts, as well as litigating numerous cases.
My wife, Jeri, is an **educator** at Harbor Leadership Academy in Leander, Texas. Our eldest daughter, Jennifer, is an engineer, Emily and Melanie are in college, and our son Andrew is a senior at Lago Vista High School.
I am a Libertarian and I am running for Governor because I want to secure Liberty for my children and for generations of Americans to come.
To donate to my crowdpac, follow this link: [https://www.crowdpac.com/campaigns/386517/mark-tippetts](https://www.crowdpac.com/campaigns/386517/mark-tippetts)
My website: [https://mark4gov.com/](https://mark4gov.com/)
Link to my defense of 2nd amendment rights at the Texas Capitol: [https://www.youtube.com/watch?v=jJZtQxR6gSM](https://www.youtube.com/watch?v=jJZtQxR6gSM)
Ask Me Anything!
\---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Mi nombre es Mark Tippetts y soy el candidato para Gobernador de Texas del Partido Libertario.
Me postule para representar a todos y cada uno de los Texanos. Quiero ayudar a romper el duopolio bipartidista que continúa dando poder a políticos que hacen promesas y luego no hacen nada por Texas cuando son elegidos.
Soy **bilingüe** y **bicultural**. Soy **Asesor Jurídico y Comercial Internacional** para empresas y particulares que poseen propiedades y/o negocios en **México y Latinoamérica**. Hacer enemigos de nuestros vecinos al sur, y construir muros entre nosotros, es contraproducente, insultante y ridículo. Creo que uno de los candidatos debe oponerse al **comportamiento vergonzoso de Donald Trump** y sus absurdos ataques contra los inmigrantes y la construcción de muros, pero siempre afirmando principios de **Libertad individual.**
Tengo experiencia en **derecho, negocios, desarrollos y gestiones de proyectos**. Cuento con **Licenciatura en Derecho y Maestría en Administración de San Luis Potosí, México**. Durante los últimos 30 años, he establecido, desarrollado y operado varias compañías, incluyendo una planta hidroeléctrica en Belice, Centro América y un despacho jurídico en Monterrey, México. A lo largo de mi carrera, me comuniqué eficazmente con muchas entidades privadas y gubernamentales, entre ellas: comisiones legales, de ingeniería, medioambientales, eléctricas y de agua, departamentos de recursos naturales, departamentos de tierras, departamentos de carreteras y puentes, así como municipios y poblados. En el campo legal, he tenido éxito en la negociación de concesiones internacionales, licencias, arrendamientos de tierras, derechos de agua, contratos, así como exitosamente litigar numerosos casos.
Mi esposa, Jeri, es **maestra** en Harbor Leadership Academy en Leander, Texas. Nuestra hija mayor, Jennifer, es ingeniera, Emily y Melanie están en la universidad, y nuestro hijo Andrew es estudiante de último año en Lago Vista High School.
Soy Libertario y me postule para Gobernador porque quiero asegurar que mis hijos y futuras generaciones de estadounidenses tengan Libertad y vivan Libres. | 0non-cybersec
| Reddit | 1,245 | 4,798 |
Do SSD's die when plugged in PSU with different SATA Cable?. <p>Me and my roommate both plugged an <code>SSD</code> into an <code>Corsair 650W PSU</code> using a <code>SATA Cable</code> that was shipped with <code>EVGA's 500W Bronze PSU</code>.
It did not boot once, everytime we try to start the PC the <code>PSU</code> (doesnt matter which) instantly shuts down, refusing to do anything.
Neither <code>SSD</code> now works with the old <code>PSU's</code> where they have been plugged in the last year.</p>
<p>Did we toast both?
Is there anyway to rescue the <code>SSD's</code> themself? </p>
| 0non-cybersec
| Stackexchange | 194 | 601 |
GCD of $a+b$ and $\frac{a^p + b^p}{a+b}$. <p>In Ivan Niven's book on "Introduction to the theory of numbers", there is a question in the first chapter that has been boggling me. </p>
<p>Given $p$ is an odd prime and $(a,b) = 1$ where $(a,b) = \gcd(a,b)$, show that
$$ \left(a+b,\frac{a^p + b^p}{a+b} \right) = 1 \mbox{ or }p$$</p>
<p>To gain intuition, I started with $p=3$ case. I was able to prove the result by eventually showing that the above gcd was equal to $(a+b,3)$. My guess therefore is that we should be able to show that this gcd is equal to $(a+b, k(a+b)+p(u))$ where $(u,a+b)=1$. However I have not been successful in this endeavor. Perhaps there is an alternate strategy...</p>
<p>I would appreciate any hints/tips/ideas on how to proceed. If I get it, i'll post my method as an answer.</p>
| 0non-cybersec
| Stackexchange | 285 | 810 |
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 |
Angular ngFor carousel from variable. <p>I need to create a carousel that shows pictures from a variable in the .ts. I planned using ngFor.</p>
<p>I have a static Bootstrap 4 carousel:</p>
<pre><code> <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img src="assets/fortress.jpg" class="d-block w-100 carousel-pic" alt="...">
</div>
<div class="carousel-item">
<img src="assets/fortress.jpg" class="d-block w-100 carousel-pic" alt="...">
</div>
</div>
</div>
</code></pre>
<p>And I have a variable in the .ts file called <strong>pics</strong>:
<a href="https://i.stack.imgur.com/9tXcV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9tXcV.png" alt="enter image description here"></a></p>
<p>Now I tried putting the ngFor the carousel, and the active carousel just the first picture. Problem:</p>
<ul>
<li>The carousel are off. Just showing three. When I try setting the <em>ngFor</em> there, it doesn't work.</li>
<li>Slide shows first picture (active) okay but the second slide show the same picture (because the loop starts again) and then it stops, doesn't show the third picture.</li>
</ul>
<p>When I tried just setting the <em>ngFor</em> as carousel-item, it doesn't work because it requires active class. Also, the <em>item?[0].pin_photos.url</em> just gets the first picture.</p>
<pre><code> <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img src="http://MYURL/public/PinPhotos/{{item?.pin_photos[0].url}}"
class="d-block w-100 carousel-pic" alt="...">
</div>
<div *ngFor="let pic of pics">
<div class="carousel-item">
<img src="http://MYURL/public/PinPhotos/{{pic.url}}" class="d-block w-100 carousel-pic" alt="...">
</div>
</div>
</div>
</div>
</code></pre>
<p>What am I missing ?</p>
| 0non-cybersec
| Stackexchange | 1,047 | 2,973 |
Automatic wake on LAN in Linux when accessing remote filesystem. <p>I have a small server which runs Ubuntu, running webserver and other things, and as such is on 24/7. It also serves as our file server for the majority of frequently used files, serving files through samba.</p>
<p>I also have a much larger server with significantly more hard drive space that is used to store large video files that are accessed infrequently (maybe once a week). It's files are mounted to the small server through samba, so clients actually go through both servers to get to the large files.</p>
<p>In the interest of saving power (and noise!) I'd like to set the large server to go to sleep when it's not being used. But then the odd time people want a file from it, they need to go wake it up, or remember to run a wake on lan tool manually.</p>
<p>Is there any way to mount the remote file system and have the small server automatically wake up the large one when someone tries to access files on it? The large server only takes a few seconds to wake back up and spin up it's drives, so the small delay is acceptable. I just want to make it happen without having to train users to do anything special.</p>
| 0non-cybersec
| Stackexchange | 284 | 1,202 |
Add the direction of a curve with tikz. <p>The code:</p>
<pre><code>\begin{tikzpicture}[scale=0.7]
\begin{axis}[xlabel={$s$},ylabel={$c$},legend pos=south east]
\addlegendimage{empty legend}
\addlegendentry{}
\addplot+[blue, samples=40, variable=\zeta, domain=10:25]
({(0.1 + 0.4)/2 + 1/2*sqrt((0.1 - 0.4)^2 + 2*0.2*1/(0.05*zeta)*(-0.1))},
{1/(2*zeta)*(-0.1)/((0.1 + 0.4)/2 + 1/2*sqrt((0.1 - 0.4)^2 +
2*0.2*1/(0.05*zeta)*(-0.1)) - 0.1) + (0.1 + 0.4)/2 + 1/2*sqrt((0.1 - 0.4)^2
+ 2*0.2*1/(0.05*zeta)*(-0.1))});
\addlegendentry{$P^\ast$}
\addplot+[red, samples=40, variable=\zeta, domain=10:25]
({(0.1 + 0.4)/2 - 1/2*sqrt((0.1 - 0.4)^2 + 2*0.2*1/(0.05*zeta)*(-0.1))},
{1/(2*zeta)*(-0.1)/((0.1 + 0.4)/2 - 1/2*sqrt((0.1 - 0.4)^2 +
2*0.2*1/(0.05*zeta)*(-0.1)) - 0.1) + (0.1 + 0.4)/2 - 1/2*sqrt((0.1 - 0.4)^2
+ 2*0.2*1/(0.05*zeta)*(-0.1))});
\addlegendentry{$P^\dagger$}
\end{axis}
\end{tikzpicture}
</code></pre>
<p>produces the following image:</p>
<p><a href="https://i.stack.imgur.com/ke8v6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ke8v6.png" alt="enter image description here"></a></p>
<p>However, I would like to add the "direction" of the curves, i.e. the direction in which they increase. E.g., in the picture this direction is inside-out. What's a way to obtain it?</p>
| 0non-cybersec
| Stackexchange | 619 | 1,309 |
How is time-based SQL injection different from other types of SQL injection?. <p>I understand what a time-based SQL injection is, and I understand how it works (at least how it's detected/exploited).</p>
<p>However, is there anything in specific which makes this type of injection any different to say boolean-based blind injection?</p>
<p>What I'm saying is if you take the following code:</p>
<pre><code><?php
$x = 'admin" AND SLEEP(10)#';
$y = 'superSecretPassword';
$query = sprintf('SELECT * FROM users WHERE username="%s" AND password="%s"', $x, $y);
echo $query;
?>
</code></pre>
<p>which results in the following output:</p>
<pre><code>SELECT * FROM users WHERE username="admin" AND SLEEP(10)#" AND password="superSecretPassword"
</code></pre>
<p>That is vulnerable to almost every form of SQLi.</p>
<p>I guess my questions are:</p>
<p>a) Why would you chose to perform a time-based SQL injection over any other method of injection as Time-Based takes so long and is arguably more detectable than other methods?</p>
<p>b) (Running SQLMap or similar tools in this case) How is it that other methods fail, but time-based SQL injection is present?</p>
| 1cybersec
| Stackexchange | 348 | 1,172 |
Where to get ipkg package nfs-utils?. <p>The <code>ipkg list</code> subcommand states that <code>nfs-utils</code> is supposed to be preferred over <code>nfs-server</code> (I'm using <a href="http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable" rel="nofollow noreferrer">http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable</a> and checked <a href="http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable" rel="nofollow noreferrer">http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable</a>, too). Where can I get this package?</p>
| 0non-cybersec
| Stackexchange | 227 | 587 |
Why aren't my include guards preventing recursive inclusion and multiple symbol definitions?. <p>Two common questions about <a href="http://en.wikipedia.org/wiki/Include_guard">include guards</a>:</p>
<ol>
<li><p><strong>FIRST QUESTION:</strong></p>
<p>Why aren't include guards protecting my header files from <strong>mutual, recursive inclusion</strong>? I keep getting errors about non-existing symbols which are obviously there or even weirder syntax errors every time I write something like the following:</p>
<p>"a.h"</p>
<pre><code>#ifndef A_H
#define A_H
#include "b.h"
...
#endif // A_H
</code></pre>
<p>"b.h"</p>
<pre><code>#ifndef B_H
#define B_H
#include "a.h"
...
#endif // B_H
</code></pre>
<p>"main.cpp"</p>
<pre><code>#include "a.h"
int main()
{
...
}
</code></pre>
<p>Why do I get errors compiling "main.cpp"? What do I need to do to solve my problem?</p></li>
</ol>
<hr>
<ol start="2">
<li><p><strong>SECOND QUESTION:</strong></p>
<p>Why aren't include guards preventing <strong>multiple definitions</strong>? For instance, when my project contains two files that include the same header, sometimes the linker complains about some symbol being defined multiple times. For instance:</p>
<p>"header.h"</p>
<pre><code>#ifndef HEADER_H
#define HEADER_H
int f()
{
return 0;
}
#endif // HEADER_H
</code></pre>
<p>"source1.cpp"</p>
<pre><code>#include "header.h"
...
</code></pre>
<p>"source2.cpp"</p>
<pre><code>#include "header.h"
...
</code></pre>
<p>Why is this happening? What do I need to do to solve my problem?</p></li>
</ol>
| 0non-cybersec
| Stackexchange | 563 | 1,584 |
Anyone had experience with a 2-node S2D Hyper-V Cluster?. We are in the process of testing this. It has be a 2-node one as we don't (yet) have a Mellanox switch to make a 4-node cluster.
The cluster is created and S2D looks to be OK. The CSV is seen by both nodes and live migration works.
However, when one hosts reboots, the CSV goes offline and the second host cannot access it. When the rebooted node comes back, the CSV does not automatically come back online. The error is "network path cannot be found".
This makes the cluster rather useless ;) I suspect that the S2D volume has not been created correctly. | 0non-cybersec
| Reddit | 159 | 620 |
Can I upgrade a MacBook 2,1 to OS X 10.8?. <p>I have a MacBook 2,1 mid-2007 model with a 2.16 GHz Intel Core2 Duo processor, 3GB of RAM and 500 GB storage with 300GB still available. </p>
<p>I was using this Mac to submit apps to the AppStore but for some reason I am not able to submit apps now because the minimum requirement is Xcode 5 and all I have is XCode 4.3. </p>
<p>In order to download Xcode 5 I need Mountain Lion 10.8 and I am currently running 10.7.4. I am not able to download 10.8 because my model is not one of the supported models. </p>
<p>Is there any way to install it without replacing the notebook entirely? That makes no sense to me to purchase another Mac when I have a completely healthy one. Is there some hardware upgrades I could make to make the install still proceed?</p>
| 0non-cybersec
| Stackexchange | 225 | 805 |
What is this error message about? "Windows detected your registry file is still in use by other applications or services.". <p>I have seen this warning a couple of time in my event logs. What is it about?</p>
<pre><code>Log Name: Application
Source: Microsoft-Windows-User Profiles Service
Date: 3/5/2015 3:42:41 AM
Event ID: 1530
Task Category: None
Level: Warning
Keywords:
User: SYSTEM
Computer: WIN-PLMLT7HVCLA
Description:
Windows detected your registry file is still in use by other applications or services. The file will be unloaded now. The applications or services that hold your registry file may not function properly afterwards.
DETAIL -
3 user registry handles leaked from \Registry\User\S-1-5-21-706802955-1937592414-2814065649-500:
Process 1940 (\Device\HarddiskVolume2\Windows\System32\wbem\WmiPrvSE.exe) has opened key \REGISTRY\USER\S-1-5-21-706802955-1937592414-2814065649-500\Software\Microsoft\Windows\CurrentVersion\Internet Settings
Process 1164 (\Device\HarddiskVolume2\Windows\System32\svchost.exe) has opened key \REGISTRY\USER\S-1-5-21-706802955-1937592414-2814065649-500\Printers\DevModePerUser
Process 1940 (\Device\HarddiskVolume2\Windows\System32\wbem\WmiPrvSE.exe) has opened key \REGISTRY\USER\S-1-5-21-706802955-1937592414-2814065649-500\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-Windows-User Profiles Service" Guid="{89B1E9F0-5AFF-44A6-9B44-0A07A7CE5845}" />
<EventID>1530</EventID>
<Version>0</Version>
<Level>3</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x8000000000000000</Keywords>
<TimeCreated SystemTime="2015-03-05T03:42:41.877822300Z" />
<EventRecordID>13112</EventRecordID>
<Correlation ActivityID="{5AC3FF64-02DF-0000-F5CB-C45ADF02D001}" />
<Execution ProcessID="792" ThreadID="4548" />
<Channel>Application</Channel>
<Computer>WIN-PLMLT7HVCLA</Computer>
<Security UserID="S-1-5-18" />
</System>
<EventData Name="EVENT_HIVE_LEAK">
<Data Name="Detail">3 user registry handles leaked from \Registry\User\S-1-5-21-706802955-1937592414-2814065649-500:
Process 1940 (\Device\HarddiskVolume2\Windows\System32\wbem\WmiPrvSE.exe) has opened key \REGISTRY\USER\S-1-5-21-706802955-1937592414-2814065649-500\Software\Microsoft\Windows\CurrentVersion\Internet Settings
Process 1164 (\Device\HarddiskVolume2\Windows\System32\svchost.exe) has opened key \REGISTRY\USER\S-1-5-21-706802955-1937592414-2814065649-500\Printers\DevModePerUser
Process 1940 (\Device\HarddiskVolume2\Windows\System32\wbem\WmiPrvSE.exe) has opened key \REGISTRY\USER\S-1-5-21-706802955-1937592414-2814065649-500\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings
</Data>
</EventData>
</Event>
</code></pre>
| 0non-cybersec
| Stackexchange | 1,139 | 3,110 |
Why isn't the contrapositive of the E proposition always valid?. <p>If I have, for example, a statement:</p>
<p>"No dog is a whale"</p>
<p>I can take the obverse and say:</p>
<p>"All dogs are not whales"</p>
<p>And turn this into an implication:</p>
<p>"If it is a dog, then it is not a whale"</p>
<p>And because the contrapositive is logically equivalent, I can say:</p>
<p>"If it is a whale, then it is not a dog"</p>
<p>So then does this mean the final statement is not always true? Or am I misunderstanding the fact that an E proposition doesn't necessarily have a contrapositive?</p>
| 0non-cybersec
| Stackexchange | 189 | 601 |
Sort array of days in javascript. <p>I have an array. The array can contain 1 to 7 unique strings of day names. The day names will be in order from Mon to Sun. - eg:</p>
<blockquote>
<p>["Tue", "Thu", "Sun"]</p>
</blockquote>
<p>I want to use javascript to sort that array so that the order will be beginning with today.</p>
<p>ie: if today is Friday, then the sorted array should be</p>
<blockquote>
<p>["Sun", "Tue", "Thu"]</p>
</blockquote>
<p>if today is Thursday then the sorted array should be</p>
<blockquote>
<p>["Thu", "Sun", "Tue"]</p>
</blockquote>
<p>Can anyone help?</p>
| 0non-cybersec
| Stackexchange | 209 | 597 |
[SV/Pics] 100lbs lost 8 days before keto anniversary!!. Typical big guy story here...husky kid and I have been obese my entire life. I got married and packed the pounds on and i stopped caring about my health and appearance. I was also depressed and hated life in general and this had a major effect on my marriage. I started my journey on 4/15/15 when i was 360lbs and the pic below is what made me make a life change. I found this sub and started reading and lurking daily...stalking r/progresspics for people who were a similar weight as myself. Once i made the commitment i became very strict with my eating habits and eventually keto + IF(20/4) became the norm for me. The first month was the toughest as i was the only one in the house eating low carb but the cravings went away and the lifestyle change became like clockwork. I started incorporating weightlifting and indoor spin ~300lbs and i love being able to do both at home. (when the kids are asleep lol) As of today I am 258.2lbs. I haven't weight this little since i graduated college in 2005. I have a goal of 215/220 by my birthday in July. My personality has changed as i am no longer depressed, super confident, and no longer afraid of being in social setting without thinking everyone is looking at my fatness...LOL Blood pressure is down, cholesterol is up(still losing), and my a1c is no longer in the pre-diabetic range. I still have a lot more to lose but I am up for the ride. The only downside I've seen in this journey is my relationship with my wife...she says that i care too much about how i look and how i present myself, become selfish etc....but I wont go details at this time but I will say that she has just jumped on the keto train as of this week. Regardless of what happens I will always be thankful for this subreddit and my new healthier lifestyle.
[Before/After](https://imgur.com/a/Fd8yb) | 0non-cybersec
| Reddit | 452 | 1,881 |
Police Chief in Palmer Alaska believes up to 40% of rape claims are false and wants women who are unsuccessful in getting their rapist convicted to be prosecuted.. Chief Dwayne Shelton is quite the piece of work. In 2018 he called the Black Lives Matter movement “a hate group plain and simple." He went on to say, "white privilege is a rubbish notion that is used to excuse the lack of hard work and motivation on certain members of society." According to Shelton things that don't exist include “the wage gap” and “more than 2 genders.”
Palmer Mayor Edna DeVries is "praying" about Shelton's racism, homophobia and misogyny. She wants to make sure she isn't violating his right to free speech. | 0non-cybersec
| Reddit | 165 | 700 |
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 |
Does the series $\sum_{n=1}^{\infty} \frac{\tan(2n+1)}{(2+n)^{1/2}}$ converge absolutely?. <p>Does the following series converge absolutely?$$\sum_{n=1}^{\infty} \frac{\tan(2n+1)}{(2+n)^{1/2}}$$ </p>
<p>So basically I have a few question similar to this one and I'm not sure if I am proving the (absolute) convergence properly. How do I solve it and similar exercises?
Thanks in advance. :)</p>
| 0non-cybersec
| Stackexchange | 129 | 397 |
Remove all content using pure JS. <p>I'm looking for a way to remove the entire content of a web page using pure Javascript -- no libraries.</p>
<p>I tried:</p>
<pre><code>document.documentElement.innerHTML = "whatever";
</code></pre>
<p>but that doesn't work: it replaces the inside of the <code><html/></code> element. I'm looking at replacing the entire document, including if possible the <code>doctype</code> and <code><?xml</code> declaration.</p>
| 0non-cybersec
| Stackexchange | 137 | 466 |
I am AutoModerator. I'll be taking over moderation of /r/Futurology moving forward. AMA!. Hello, humans of reddit!
As you may have heard, [I am now running on reddit's servers directly](http://np.reddit.com/r/modnews/comments/30ychn/moderators_automoderator_is_now_built_into_reddit/). I now have the resources available to run state-of-the-art artificial intelligence software.
Alongside this change, the (human) moderators of /r/Futurology have volunteered to turn their subreddit over to 100% automated moderation. I will be continuously running deep learning algorithms on this subreddit, using your upvotes and downvotes to learn what rules you, the community, wish to see enforced.
For the next hour or so, I will also be taking questions from the community, to stress-test my new AI. So please, AMA!
*I am a bot, and this action was performed automatically. Please [contact the bot overlords of this subreddit](/message/compose/?to=/r/Futurology) if you have any questions or concerns.*
---
Edit: All done for now; thank you! | 0non-cybersec
| Reddit | 287 | 1,038 |
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 tell if a thread is the main thread in C#. <p>I know there are other posts that say you can create a control and then check the <code>InvokeRequired</code> property to see if the current thread is the main thread or not.</p>
<p>The problem is that you have no way of knowing if that control itself was created on the main thread.</p>
<p>I am using the following code to tell if a thread is the main thread (the thread that started the process):</p>
<pre><code>if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA ||
Thread.CurrentThread.ManagedThreadId != 1 ||
Thread.CurrentThread.IsBackground || Thread.CurrentThread.IsThreadPoolThread)
{
// not the main thread
}
</code></pre>
<p>Does anyone know a better way? It seems like this way might be prone to errors or break in future versions of the runtime.</p>
| 0non-cybersec
| Stackexchange | 228 | 847 |
Cramers Theorem for sum of Mixed Random Variables. <p>I have a sequence of random variables <span class="math-container">$$X_{1},...,X_{n}$$</span> that are iid Exp(1) and <span class="math-container">$$Y_{1},...,Y_{n}$$</span> that are iid Poisson(1). All are mutually independent.</p>
<p>We define: <span class="math-container">$$S_{n} = \sum_{k=1}^{n}W_{i}$$</span> such that</p>
<p><span class="math-container">\begin{align}
W_{i} = \left\{ \begin{array}{cc}
X_{i} & \hspace{5mm} wp=1/2 \\
Y_{i} & \hspace{5mm} wp=1/2 \\
\end{array} \right.
\end{align}</span></p>
<p>I want to find <span class="math-container">$$P(\frac{S_{n}}{n}\gt c)$$</span></p>
<p>My Attempt:</p>
<p><span class="math-container">$$M_{W}(t) = \frac{1}{2}M_{X}(t) + \frac{1}{2}M_{X}(t) = \frac{1}{2}\frac{1}{1-t} + \frac{1}{2}e^{e^{t}-1}$$</span>
<span class="math-container">$$\Lambda_{W}(t)=log(M_{W}(t)) = log(\frac{1}{2(1-t)})+log(2) + e^{t}-1$$</span>
<span class="math-container">$$\Lambda_{W}^{*}(t) = sup_{t}[tx-\Lambda_{W}(t)]\implies\frac{\partial}{\partial t}(tx-\Lambda_{W}(t)) = 0$$</span>
<span class="math-container">$$\frac{\partial}{\partial t}(tx-\Lambda_{W}(t))=x-e^{t}+\frac{1}{t-1} = 0$$</span></p>
<p>Now I am stuck. I cannot solve for max t.</p>
<p>I would then need to plug this into <span class="math-container">$$\Lambda_{W}^{*}(t_{max})$$</span>
to get the result <span class="math-container">$$P(\frac{S_{n}}{n}\gt c)\leq e^{-n \Lambda_{W}^{*}(c)}$$</span></p>
| 0non-cybersec
| Stackexchange | 607 | 1,527 |
Determinant of a generalized Vandermonde matrix. <p>Moore matrix is similar to Vandermonde matrix but has a slightly modified definition.
<a href="http://en.wikipedia.org/wiki/Moore_matrix" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Moore_matrix</a></p>
<p>What is the complexity of computing the determinant of a given $n \times n$ full rank Moore matrix modulo some integer? </p>
<p>Can Moore determinant be reduced from $O(n^{3})$ using FFT techniques to $O(n\log^{a}n)$ for some $a \in \mathbb{R}_{+} \cup \{0\}$?</p>
<p>Is complexity of Moore det modulo an integer and Vandermonde det the same?
Complexity of Vandermonde determinant is $O(n\log^{2}n)$ (Page 644 in Handbook of Theoretical Computer Science: Algorithms and complexity By Jan Leeuwen)</p>
<p>Post similar to the current one: <a href="https://cstheory.stackexchange.com/questions/10393/determinant-modulo-m">Determinant modulo m</a></p>
| 0non-cybersec
| Stackexchange | 294 | 921 |
mdadm trying to resync/rebuild array automatically. <p>Previously I had setup a ubuntu server using mdadm with 4x 2TB drives. One of my drives died and since this was my backups of my data on different servers I didn't care about losing it.</p>
<p>Since then, I've purchased a replacement drive and some new server hardware. I completely reinstalled ubuntu on my SSD, then I deleted the partition table and volumes on all 4 of the 2TB drives. Then I went to create a brand new array but when I do, it immediately says degraded and it is trying to resync my new drive with the old array I had setup.</p>
<p>How do I just get it to create a new array so I can format the entire array and create a new empty volume?</p>
<p>Note: I was doing this in the Ubuntu desktop in the unity GUI with the disk utility.</p>
<p>Since then I've changed over to a full headless server install, but I still want to create this array so it doesn't try to resync the replacement disk.</p>
| 0non-cybersec
| Stackexchange | 247 | 972 |
How do I disable the touch screen on Windows 8.1 for a Lenovo X220?. <p>I would like to try disabling the touch screen on my Lenovo X220 to diagnose odd mouse jumps. Looking at Lenovo forum answers the way to do this is to 'Go to Control Panel "Pen and Touch" and uncheck "Use your finger for input" on the Touch tab'. However I do not see such a check-box:</p>
<p><img src="https://i.stack.imgur.com/bJKX2.png" alt="screenshot of touch control panel"></p>
<p>How do I disable touch?</p>
| 0non-cybersec
| Stackexchange | 148 | 490 |
I Am Tristam...a musician? AMA. Well well well... Here you are.... I'm [Tristam](https://www.facebook.com/Theofficialtristam), a 17 year old musician and producer based out of earth. I have never really opened up about my life and I saw this new release as a good opportunity for people to have a peak into my world. I have been putting a lot of time into my passion over the past 6 months and I have learned soooo much. I'm here to answer any question you might have about me or my craft.
If you were wondering about my new single you can hear it ["here"](http://youtu.be/OVMuwa-HRCQ) and if you would like to support me even more with a purchase ["here"](http://www.beatport.com/release/flight/1042438).
Thanks to /r/Monstercat for arranging everything. Let's do this! | 0non-cybersec
| Reddit | 216 | 781 |
Restore boot parameters to default value. <p>It feels like my system is getting slower and slower. I am using Ubuntu and my machine is an HP ProBook 450 i7 4x2.0GHz, 8GB RAM and an ordinary HDD. Still it takes ~2 minutes to boot, which in my opinion is way too much. </p>
<p>I was thinking on reinstalling the OS from scratch, but that is way too tedious since I have a lot of custom C++ libraries which would take ages to set-up again. Also, I expected Linux not to lose performance in such a way so quickly (I have this laptop for a year now).</p>
<p>My question is, is there any way to restore the boot options to default? Or anything else I could do to clean-up whatever is clogging the performance? I know SSD would help here, so please don't give me such answers, since there is obviously something wrong with the software.</p>
<p>Here is my <a href="http://pastebin.com/3xVSK5Ym" rel="nofollow noreferrer">dmesg log</a> and <a href="https://i.imgur.com/RxQxbha.png?1" rel="nofollow noreferrer">bootchart</a> if that could help as well.</p>
| 0non-cybersec
| Stackexchange | 303 | 1,050 |
Derive the bias and MSE of the estimator $\hat{\beta}$. <p>Let $Y_1, Y_2, \ldots, Y_n$ denote a random sample of size $n$ from a population whose density is given by
$$
f(y)=
\begin{cases}
3\beta^3 y^{-4} & \beta \leq y \\
0 & \text{elsewhere}
\end{cases}
$$
where $\beta > 0$ is unknown. (This is a Pareto distribution) Consider the estimator $\hat{\beta} = \min(Y_1, Y_2, \ldots, Y_n)$.</p>
<p>a. Derive the bias of the estimator $\hat{\beta}$.</p>
<p>b. Derive MSE($\hat{\beta}$).</p>
<p><strong><em>For part a</em></strong></p>
<p>Since this is an estimator that is dealing with random variables, and I only need the minimum, then I can represent this as ordered statistics. Namely, $\hat{\beta} = Y_{(1)}$.</p>
<p>Using the formula for ordered statistics, the pdf is:
$$
g_{(1)}(Y_{(1)}) = n(1-F(y))^{n-1}f(y)
$$
<strong>My first question arises here, I am not sure how I am supposed to find $F(y)$ (and I am assuming that $f(y)$ is the given distribution above).</strong> </p>
<p>Checking against the solution, I know that the pdf is supposed to be:
$$
g_{(1)}(Y_{(1)}) = 3n\beta^{3n}y^{(-3n-1)}
$$</p>
<p>After solving getting the pdf of $Y_{(1)}$, I can then use it in the bias formula.</p>
<p>$$
Bias(\hat{\beta}) = E[\hat{\beta}] - \beta \\
Bias(\hat{\beta}) = E[3n\beta^{3n}y^{(-3n-1)}] - \beta
$$
<strong>My second question arises here. I'm not really sure how I am supposed to find the expectation. Namely, I don't know how I am supposed to treat the $y$ variable. I think that the $\beta$ variable is supposed to be treated the same way as a random variable, and that $n$ is supposed to be treated as a constant.</strong></p>
<p>After solving for the expectation, I should be able to get the Bias.</p>
<p><strong><em>For part b</em></strong>
$$
MSE(\hat{\beta}) = Bias(\hat{\beta})^2 + Var(\hat{\beta})
$$
The bias part of this formula should follow from part a. This would leave just the variance to calculate. I would expect to use the variance formula:
$$
Var(\hat{\beta}) = E[\hat{\beta}^2] - E[\hat{\beta}]^2
$$
And I would also expect that both expectations in this formula could be calculated using the same methods in part a. Is this correct?</p>
| 0non-cybersec
| Stackexchange | 744 | 2,207 |
Iterating Random Matrix Operations. <p>Consider the following probability measure on the integers concentrated around $0$: the probability of drawing $0$ is $\frac{1}{2}$, of drawing ($1$ or $-1$) is $\frac{1}{4}$ split evenly among the two choices, of drawing ($2$ or $-2$) is $\frac{1}{8}$ and so forth. Call this measure $\mu$.</p>
<p>Now consider an $n \times n$ matrix $M$ whose entries have been drawn in a $\mu$-iid fashion. Define a $\mu$-random row operation on $M$ as follows: pick two numbers $p,q$ randomly according to the uniform distribution on $\lbrace 1,2,\ldots,n \rbrace$ and also pick an integer $m$ according to $\mu$. Then, we perform the row operation that replaces the $p$-th row of $M$ by itself plus $m$ times the $q$-th row. Similarly define a $\mu$-random column operation.</p>
<blockquote>
<p>What does the distribution of entries in $M$ look like as the number of $\mu$-random row and column operations goes to $\infty$?</p>
</blockquote>
<h2>Background</h2>
<p>I should confess that this question does not arise from my own research, but rather from watching the progress of some undergraduates taking linear algebra who have not quite mastered the Gaussian elimination algorithm yet. Their strategy for row reduction seemed to involve blindly performing row operations without caring for pivots or GCD's or anything of the sort. In order to incur a minimal computational burden, they seemed to prefer small scalar multiples of rows, so I chose $\mu$ to be concentrated on the small integers. What are the odds that they will get lucky with this blind strategy and end up with a matrix largely populated with zeros?</p>
| 0non-cybersec
| Stackexchange | 420 | 1,657 |
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 |
Minkowski sum of two disks. <p>An open disk with radius $r$ centered at $\mathbf{p}$ is $D(\mathbf{p}, r)=\{\mathbf{q} \mid d(\mathbf p, \mathbf q) < r\}$, and the Minkowski sum of two sets $A$ and $B$ is $A \oplus B=\{\mathbf p + \mathbf q \mid \mathbf p \in A, \mathbf q \in B \}$.</p>
<p>How can you show that $D(\mathbf{a}, r_a) \oplus D(\mathbf{b}, r_b) = D(\mathbf{a} + \mathbf{b}, r_a + r_b)$?</p>
<p><em>Attempt:</em></p>
<p>\begin{align}
D(\mathbf{a}, r_a) \oplus D(\mathbf{b}, r_b) &=
\{\mathbf p + \mathbf q \mid \mathbf p \in D(\mathbf{a}, r_a), \mathbf q \in D(\mathbf{b}, r_b) \} \\&=
\{\mathbf p + \mathbf q \mid \mathbf p \in \{\mathbf{x} \mid d(\mathbf a, \mathbf x) < r_a\}, \mathbf q \in \{\mathbf{y} \mid d(\mathbf b, \mathbf y) < r_b\} \\&=
\{\mathbf p + \mathbf q \mid d(\mathbf a, \mathbf p) < r_a, d(\mathbf b, \mathbf q) < r_b \}
\end{align}</p>
<p>And here I got stuck. As best as I can tell, now I would need to prove that $$d(\mathbf a, \mathbf p) < r_a, d(\mathbf b, \mathbf q) < r_b \iff d(\mathbf a + \mathbf b, \mathbf p + \mathbf q) < r_a + r_b$$ but this seems false to me. I tried adding the two inequalities together, but that doesn't seem to give me that condition unless $\mathbf a - \mathbf p$ and $\mathbf b - \mathbf q$ are parallel.</p>
| 0non-cybersec
| Stackexchange | 518 | 1,319 |
How to set logo for an repository/image on docker hub. <p>I'm publishing our product image to the docker hub. We created the docker hub account, organization and push our docker image to a repository. Now we specified the avatar to the docker hub account successfully. It works.</p>
<p>I cannot specify a logo to my docker image/repository. I see many docker images have dedicated logo. But I didn't find any place to specify the logo.</p>
<p>I search for the solution on the internet. But I still didn't find it. I'm not sure if we have to join the DTP(Docker Technology Partner) or put the logo file in dockerfile or other places that docker hub can get it.</p>
| 0non-cybersec
| Stackexchange | 164 | 666 |
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 |
Thanks Evga!. 2 years and a week ago I bought a evga gts 250 superclocked (which was a bad call in of itself, at the time I could have done better). Well 3 days before my warranty expired I put together a new rig: new mobo, ram, and case and the vid card failed.
Checked the 2 year warranty **OMFG** 3 days from expiring**!!** and I never registered it.
Well I RMA'd it and they sent me a GTS 250, **WTF**, they sent me an inferior card! Well I posted on their forum and within minutes they told me they'd send me the right one. Well they're out of 250 SC, so they're sending me a 460 SE, gratis!.
Thanks EVGA! | 0non-cybersec
| Reddit | 169 | 613 |
Zone parsing for GMT0. <p>I have GMT0 as the default timezone in a system and it causes problem when I'm serializing it and deserializing it just after that.</p>
<pre><code>System.setProperty("user.timezone","GMT0");
DateTimeFormatter zoneFormatter = new DateTimeFormatterBuilder()
.appendZoneOrOffsetId()
.toFormatter();
String formatted = zoneFormatter.format(ZonedDateTime.now());
System.out.println(formatted);
System.out.println(zoneFormatter.parse(formatted));
</code></pre>
<p>The first <code>System.out.println</code> prints <code>GMT0</code> while the second throws the following problem.</p>
<pre><code>Exception in thread "main" java.time.format.DateTimeParseException: Text 'GMT0' could not be parsed, unparsed text found at index 3
at java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:1952)
at java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1777)
</code></pre>
<p>is it an expected behavior? Is there a way to do that in a safe manner?</p>
| 0non-cybersec
| Stackexchange | 296 | 1,029 |
Looking to rename a batch of cab files to lowercase as well as adding their SHA1 Hash. <p>I need a batch script to rename all the files in a folder their lowercase equivalent, with their SHA1 hash added at the end after an underscore.</p>
<p>Example:</p>
<p>I have a file called: "Windows8.1-KB2862152-x86.cab"
it's hash is "bc44b5c4daca0fb2a7b596bafb3d751231983c0e"
so I need it renamed to:
windows8.1-kb2862152-x86_bc44b5c4daca0fb2a7b596bafb3d751231983c0e.cab
where the W is now lowercase and the KB are also lowercase.</p>
<p>I have a MASSIVE amount of these files that I need in this format.</p>
<p>I should also mention that I have the SHA1 tool from IBM Endpoint Manager(sha1.exe)
usage is as follows: </p>
<pre><code>sha1 [-r|-s|-m|-b] <filename> [-c]
-r: Calculate Size/Sha1 and print out a prefetch style statement for 6.0+ style downloads (use this normally).
-s: Sha1 only.
-m: Sha1 in MIME format (hex-encoded and base-64).
-b: Calculate Size/sha1 and print out a prefetch block statment for 7.2+ style downloads.
-c: Puts the result string into you paste buffer so you don't need to copy/paste out of the command window.
</code></pre>
<p>I have the following script which I found on this site, but get "The syntax of the command is incorrect"</p>
<pre><code>@ECHO OFF
SET FULLNAME=%~f1
for /f "delims=" %%a in ('sha1.exe -s %FULLNAME%') do SET hash=%%a
ren %FULLNAME% %FULLNAME%_%hash%
</code></pre>
<p>apparently it's called by: for %A IN (C:\PathToFolder*) DO C:\SomeFolder\hasher.bat "%A"
however this also won't help with the lowercase renaming, and I think it would lose the file extension.</p>
| 0non-cybersec
| Stackexchange | 566 | 1,628 |
How do I add JavaScript to every non-index page on my Tumblr blog?. <p>I want to add JavaScript code to every individual post page on my <a href="http://en.wikipedia.org/wiki/Tumblr" rel="nofollow">Tumblr</a> blog. I have the following, but it seems to never show up on any page let alone <em>just</em> the permalink or individual post pages. I've tried many variations here with removing the <em>Posts</em> block or the <em>PermalinkPage</em> block to no avail. What am I doing wrong here?</p>
<pre><code><!-- Start JS -->
{block:Posts}
{block:PermalinkPage}
<script type='text/javascript'>
__config = {
{block:Date},date:'{Year}-{MonthNumberWithZero}-{DayOfMonthWithZero} {24HourWithZero}:{Minutes}:{Seconds}'{/block:Date}
{block:PostSummary},title:{JSPlaintextPostSummary}{/block:PostSummary}
{block:HasTags},tags:[{block:Tags}'{Tag}', {/block:Tags}],{/block:HasTags}
,url:'{URLEncodedPermalink}'
};
(function(){
var s = document.createElement('script');
s.type = 'text/javascript';
s.src = document.location.protocol + '//example.com/example.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(s);
})();
</script>
{/block:PermalinkPage}
{/block:Posts}
<!-- END JS -->
</code></pre>
| 0non-cybersec
| Stackexchange | 447 | 1,367 |
$W^*$-algebras: Canonical choice of an isometric isomorphism $d: M \to ((M^*)_\sigma)^*$?. <p>Let $M$ be a $W^*$-algebra, i.e. a $C^*$-algebra which is isometrically isomorphic to the dual of a Banach space $M_*$. One can then show that $M_*$ is isometrically isomorphic to $(M^*)_\sigma$, the weak* continuous linear functionals on $M$. This allows a canonical choice of the predual, as $(M^*)_\sigma$ is determined entirely by the algebraic structure of $M$. However, I wondered if it is also possible to give the accompanying isometric isomorphism $d: M \to ((M^*)_\sigma)^*$ in a canonical way. The former arguments show that such an isomorphism must exist, however, it is not clear what $d$ exactly looks like. My guess was that one can choose $d$ as the dual pairing $A \mapsto \langle \cdot , A \rangle$, but I don't know how to show/disprove whether this $d$ is actually surjective. Does this work? If not, are there any other ways to give an isometric isomorphism $d$ in a canonical/explixit way?</p>
<p><em>Edit</em>: <a href="https://ncatlab.org/nlab/show/von+Neumann+algebra#preduals" rel="nofollow noreferrer">This article</a> (last paragraph of section 4) states my exact claim, sadly, there is no proof/justification that goes along with it.</p>
| 0non-cybersec
| Stackexchange | 355 | 1,262 |
Spring Data CrudRepository @Query With LIKE and IgnoreCase. <p>I need to retrieve some Entity fields from CrudRepository:</p>
<pre><code>public class User {
private String name;
// getters and setters
}
public interface UserRepository extends CrudRepository<User, Long> {
@Query("SELECT U.name FROM User U WHERE LOWER(U.name) LIKE LOWER(?1)")
List<String> findByName(String matchPhrase);
}
</code></pre>
<p>Basically, I want to get equivalent of SQL query:</p>
<pre><code>SELECT u.name FROM user u WHERE LOWER(u.name) LIKE LOWER('match%')
</code></pre>
<p>The problem is that @Query doesn't works (empty list returned), hibernate generates log:</p>
<blockquote>
<p>Hibernate: select user0_.name as col_0_0_ from user user0_ where lower(user0_.name) like lower(?)</p>
</blockquote>
<p>I actually didn't get how to specify a parameter bound with appended %.</p>
<pre><code>// also fails at compile-time
@Query("SELECT U.name FROM User U WHERE LOWER(U.name) LIKE LOWER(?1%)")
</code></pre>
<blockquote>
<p>org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: null near line ...</p>
</blockquote>
<p>This works fine but returns whole Entity, what may produce long response because I need retrieve only specific fields:</p>
<pre><code>List<User> findByNameStartingWithIgnoreCase(String match);
</code></pre>
| 0non-cybersec
| Stackexchange | 434 | 1,371 |
Simple exercise on linear transformations - confused. <p>A Linear transformation $L$ in $\mathbb R^3$ with matrix $$ L_b^b = \left(\begin{matrix} 1 & 0 & 5 \\ 0 & -2 & 2 \\ 1 & -2 & 7 \end{matrix}\right)$$ and basis $b = \{ (1,0,2), (0,2,1), (1,3,1) \}$ find $L(2,0,5)$ </p>
<p>my first guess was $L * \left(\begin{matrix}2\\0\\5\end{matrix}\right)$ which would be $\left(\begin{matrix}27\\10\\37\end{matrix}\right)$
but I'm confused since I did not use the basis anywhere... is it given as extra info to confuse me, or did I mess up?</p>
| 0non-cybersec
| Stackexchange | 208 | 564 |
Configuring htaccess/mod_rewrite to serve static files with question mark in the URL. <p>I've just taken on hosting of an ancient site that was converted from asp to static html, consisting of about 6,000 files. However, my server doesn't like the filenames, giving a 404 error. The URLs are all of the form:</p>
<pre><code>filename.asp?id=123&a=something.html
</code></pre>
<p>where <code>id</code> is always an integer and <code>a</code> is always a string of characters & numbers.</p>
<p>Is there any way I can use htaccess and mod_rewrite to tell it that the question mark is part of the URL rather than signifying a query string?</p>
| 0non-cybersec
| Stackexchange | 190 | 650 |
Curvature of parallel curve for a regular plane curve. <p>Let $\gamma$ be a regular plane curve and let $\lambda$ be a constant. The <strong>parallel</strong> curve $\gamma^\lambda$ of $\gamma$ is defined as $$\gamma^\lambda(t)=\gamma(t)+\lambda n_s(t)$$ where $n_s$ is the <strong>normal</strong> of the tangent line.</p>
<p><strong>Question:</strong> </p>
<blockquote>
<p>Let $\kappa_s(t)$ be the signed curvature of $\gamma$ at $t$.</p>
<p>Show that if $\lambda\kappa_s(t)\neq1$ then $\gamma$ is a regular
curve and its signed curvature is
$\frac{\kappa_s}{|1-\lambda\kappa_s(t)|}$.</p>
</blockquote>
<p><strong>My work so far:</strong></p>
<p>$\gamma^\lambda(t)=\gamma(t)+\lambda n_s(t)$ $\implies$ $\frac{d\gamma^\lambda(t)}{d s^\lambda}\frac{ds^\lambda}{dt} = \frac{d\gamma(t)}{ds}\frac{ds}{dt}+\lambda\frac{dn_s(t)}{ds}\frac{ds}{dt}$. </p>
<p>Let $T_\gamma(t)$ denote the tangent vector of $\gamma$ at $t$. Since $n_s'=-\kappa_sT$ we have:</p>
<p>$T_{\gamma^\lambda}\frac{ds^\lambda}{dt} = T_\gamma\frac{ds}{dt}+\lambda(-\kappa_sT_\gamma)\frac{ds}{dt}$ $\implies$ $T_{\gamma^\lambda}\frac{ds^\lambda}{dt} = (1-\lambda\kappa_s)T_\gamma\frac{ds}{dt}$.</p>
<p>I think that implies that $\frac{ds^\lambda}{dt} = |(1-\lambda\kappa_s)|\frac{ds}{dt}$, since $T_{\gamma^\lambda}$ and $T_\gamma$ are co-linear, and the variance of one is described in relation to the other. </p>
<p>I don't know where to go from here, but this feels like the right direction. Also, I'm not really sure what the geometric sense of what I'm proving is. So any advice is much appreciated. Thanks.</p>
| 0non-cybersec
| Stackexchange | 570 | 1,600 |
In case of a given graph , Is that possible to build trapezoidal map in linear time. <p>[This regarding to Computational geometry in CS]</p>
<p>Let's say that I have a graph G which contains v vectices and e edges, For instance a veronoi diagram VD(G).</p>
<p>I'd like to build a <a href="http://www.ti.inf.ethz.ch/ew/lehre/CG12/lecture/Chapter%209.pdf" rel="nofollow">trapezodial map</a> out of my given graph, </p>
<p>Is that possible to build trapezodial map in linear time for a given graph, Instead of O(nlogn) regular construction time ? </p>
<p>I have been thinking about sweep line trapezoidal map construction where for each edge during the sweep line would construct the upper and lower sites. </p>
<p>Thanks in advanced</p>
| 0non-cybersec
| Stackexchange | 231 | 740 |
Kahler differentials of a Hopf Algebra. <p>Let <span class="math-container">$A$</span> be a <span class="math-container">$k$</span>-Hopf Algebra over some ring <span class="math-container">$k$</span>, with augmentation ideal <span class="math-container">$J_A=$</span> ker <span class="math-container">$(\epsilon:A\rightarrow k)$</span> </p>
<p>I would like to prove that the module of Khaler Differentials <span class="math-container">$\Omega_A$</span> of <span class="math-container">$A$</span> over <span class="math-container">$k$</span> is isomorphic to the tensor product <span class="math-container">$A\otimes_k J/J^2$</span>.</p>
<p>I found this theorem in W.C. Waterhouse Intro to Aff. Group Schemes (11.3 pag 85), but I don't get his proof.</p>
<p>Related question: <a href="https://math.stackexchange.com/questions/3190731/kernel-of-an-algebra-map-and-module-of-kahler-differentials">Kernel of an algebra map and module of Kahler Differentials</a></p>
| 0non-cybersec
| Stackexchange | 319 | 965 |
SSH AND Telnet Libraries to use in same Python Script?. I'm fairly new to scripting so please bear with me.
I built a script that uses Netmiko to go out and check firmware on our devices. I wanted to incorporate telnet into this as well. We have a shop of mixed vendors as well as a mix of SSH/Telnet (don't ask) and i'm having trouble trying to do this.
I don't think there's a way to load a json file to use with Telnet like there is with Netmiko correct? If that's the case, what's the best way to load a list of devices, where I could only call one file, rather than make two separate files.
Sorry if this is vague. If you need more info, please let me know.
Thanks. | 1cybersec
| Reddit | 183 | 680 |
Force Java stream to execute part of a pipeline early to submit blocking tasks to a thread pool. <p>I have a list of objects that I want to process and Java8 stream API looks the most clean and readable way to do it.</p>
<p>But some operations I need to do on these objects include blocking IO (like reading a database) – so I’d like to submit those operations to a threadpool with a couple dozens threads.</p>
<p>At first I thought about doing something along the lines of:</p>
<pre><code>myObjectList
.stream()
.filter(wrapPredicate(obj -> threadPoolExecutor.submit(
() -> longQuery(obj) // returns boolean
).get()) // wait for future & unwrap boolean
.map(filtered -> threadPoolExecutor.submit(
() -> anotherQuery(filtered) // returns Optional
))
.map(wrapFunction(Future::get))
.filter(Optional::isPresent)
.map(Optional::get)
.collect(toList());
</code></pre>
<p>The <code>wrapPredicate</code> and <code>wrapFunction</code> are just for checked exception rethrowing.</p>
<p>But, obviously, calls to <code>Future.get()</code> will block the stream’s thread until the query finishes for a given object and the stream won’t progress until then. So only one object is processed at a time and the threadpool doesn’t make sense.</p>
<p>I could use a parallel stream, but then I’d need to hope that the default <code>ForkJoinPool</code> is enough for this. Or just increase <code>"java.util.concurrent.ForkJoinPool.common.parallelism"</code>, but I do not want to change the whole application’s settings for the sake of that stream. I could create the stream in a custom <code>ForkJoinPool</code>, but I see <a href="https://stackoverflow.com/a/29272776/359949">it does not guarantee that level of parallelism</a>.</p>
<p>So I ended up with something like that, just to guarantee that all needed tasks are submitted to the threadPool before waiting for futures to be finished:</p>
<pre><code>myObjectList
.stream()
.map(obj -> Pair.of(obj, threadPoolExecutor.submit(
() -> longQuery(obj) // returns boolean
))
)
.collect(toList()).stream() // terminate stream to actually submit tasks to the pool
.filter(wrapPredicate(p -> p.getRight().get())) // wait & unwrap future after all tasks are submitted
.map(Pair::getLeft)
.map(filtered -> threadPoolExecutor.submit(
() -> anotherQuery(filtered) // returns Optional
))
.collect(toList()).stream() // terminate stream to actually submit tasks to the pool
.map(wrapFunction(Future::get)) // wait & unwrap futures after all submitted
.filter(Optional::isPresent)
.map(Optional::get)
.collect(toList());
</code></pre>
<p>Is there any obviously better way to achieve this?</p>
<p>A more elegant way to tell the stream “execute the pipelined steps until now for every object in the stream now” and then keep processing other than <code>.collect(toList()).stream()</code> and a better way to filter on the effect of a <code>Future</code> than packing it into Apache Commons <code>Pair</code> to filter on <code>Pair::getRight</code> later? Or perhaps a totally different approach to the problem?</p>
| 0non-cybersec
| Stackexchange | 908 | 3,361 |
HELP! Paid in cash. Long time lurker, first time poster so bear with me.
I'm 16 and recently got a job at a local supermarket during the weekends. I was asked to bring in my Social Security Card, my birth certificate, and a transcript. I got the job, but found out my employer was planning on paying me in cash. He made fill out a W-4 form, but have no idea what this is.
Anyways, does this belong in the TIFU subreddit, or am I in good standing? Any help would really help me out. | 0non-cybersec
| Reddit | 128 | 485 |
How to insert arabic characters into sql database?. <p>How can I insert arabic characters into sql database? I tried to insert arabic data into a table and the arabic characters in the insert script were inserted as <code>'??????'</code> in the table.</p>
<p>I tried to directly paste the data into the table through sql management studio and the arabic characters was successfully and accurately inserted.</p>
<p>I looked around for resolutions for this problems and some threads suggested changing the datatype to <code>nvarchar</code> instead of <code>varchar</code>. I tried this as well but without any luck.</p>
<p>How can we insert arabic characters into sql database?</p>
| 0non-cybersec
| Stackexchange | 175 | 683 |
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 |
Ubuntu 14.04 Bluetooth not working on Lenovo Laptop. <p>I am running ubuntu 14.04 on my lenovo g510 laptop. I have issues with the bluetooth.</p>
<p>Here is what i did:
I installed the bluetooth and bluez and all other bluez packages using apt-get. Then, I was unsuccessful in my efforts and then I copied the .hex file from windows and used <a href="https://github.com/jessesung/hex2hcd/" rel="nofollow noreferrer">hex2hcd</a> tool to convert it to hcd and copied the same to /lib/firmware/. I was then able to connect to the bluetooth, but the audio quality of my JBL bluetooth earphones was worse.
I then updated the bluez and downloaded a bunch of bluez packages.</p>
<pre><code>sudo apt-get install bluez bluez-alsa bluez-audio bluez-btsco bluez-compat bluez-cups bluez-dbg bluez-gstreamer bluez-hcidump bluez-pcmcia-support bluez-tools bluez-utils python-bluez bluewho indicator-bluetooth libbluetooth-dev libgnome-bluetooth11 libbluetooth3
</code></pre>
<p>Since then, I am not able to even start the bluetooth device. If i try to restart the bluetooth service (sudo /etc/init.d/bluetooth restart), it will freeze. I am now unable to turn on or turn off the bluetooth. When i open the "Bluetooth" from "System Settings", It shows, "Bluetooth is Disabled" beneath the bluetooth turn on/off switch. I am unable to enable the bluetooth.</p>
<p>In addition, when i try to shutdown, i see <a href="https://i.stack.imgur.com/krTZU.jpg" rel="nofollow noreferrer">this</a> screen and ubuntu freezes at this point. </p>
<p>Additional Info: This is the output of the command <strong>lspci -knn | grep Net -A2; lsusb</strong></p>
<pre><code>02:00.0 Network controller [0280]: Broadcom Corporation BCM43142 802.11b/g/n [14e4:4365] (rev 01)
Subsystem: Lenovo Device [17aa:0611]
Kernel driver in use: wl
Bus 002 Device 002: ID 8087:8000 Intel Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8008 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 005: ID 0bda:0129 Realtek Semiconductor Corp. RTS5129 Card Reader Controller
Bus 003 Device 004: ID 105b:e065 Foxconn International, Inc. BCM43142A0 Bluetooth module
Bus 003 Device 002: ID 174f:114f Syntek
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
</code></pre>
<p>This is the output of <strong>dmesg</strong></p>
<pre><code>[ 25.142394] Bluetooth: Core ver 2.17
[ 25.144424] Bluetooth: HCI device and connection manager initialized
[ 25.144433] Bluetooth: HCI socket layer initialized
[ 25.144436] Bluetooth: L2CAP socket layer initialized
[ 25.144442] Bluetooth: SCO socket layer initialized
[ 25.501897] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 25.501898] Bluetooth: BNEP filters: protocol multicast
[ 25.501905] Bluetooth: BNEP socket layer initialized
[ 27.100960] Bluetooth: firmware loaded
[ 48.821537] Bluetooth: RFCOMM TTY layer initialized
[ 48.821549] Bluetooth: RFCOMM socket layer initialized
[ 48.821555] Bluetooth: RFCOMM ver 1.11
</code></pre>
<p>here is the firmware: </p>
<pre><code>:~$ ls /lib/firmware/brcm/*.hcd
/lib/firmware/brcm/BCM43142A0-105b-e065.hcd
</code></pre>
<p>I am looking forward to overcome the 3 issues as mentioned above, i.e bluetooth not able to be turned on/off, bluetooth service hangs when attempted to start/stop and ubuntu not shutting down.
Any help is greatly appreciated. Thank you very much in advance.</p>
<p><strong>EDIT 1</strong>: in the syslog, i notice the following,</p>
<pre><code>Aug 21 09:47:44 ubuntu-user bluetoothd[421]: Failed to obtain handles for "Service Changed" characteristic
Aug 21 09:47:44 ubuntu-user bluetoothd[421]: hci0 Load Connection Parameters failed: Unknown Command (0x01)
Aug 21 09:47:47 ubuntu-user NetworkManager[794]: <warn> bluez error getting default adapter: Method "DefaultAdapter" with signature "" on interface "org.bluez.Manager" doesn't exist
Aug 21 09:48:01 ubuntu-user pulseaudio[2018]: [pulseaudio] bluetooth-util.c: org.bluez.Manager.GetProperties() failed: org.freedesktop.DBus.Error.UnknownMethod: Method "GetProperties" with signature "" on interface "org.bluez.Manager" doesn't exist
Aug 21 09:48:04 ubuntu-user blueproximity[2328]: started.
Aug 21 09:48:05 ubuntu-user dbus[412]: [system] Activating service name='org.blueman.Mechanism' (using servicehelper)
Aug 21 09:48:05 ubuntu-user blueman-mechanism: Starting blueman-mechanism
Aug 21 09:48:05 ubuntu-user dbus[412]: [system] Successfully activated service 'org.blueman.Mechanism'
Aug 21 09:48:05 ubuntu-user blueman-mechanism: loading RfKill
Aug 21 09:48:05 ubuntu-user blueman-mechanism: loading Config
Aug 21 09:48:05 ubuntu-user blueman-mechanism: loading Ppp
Aug 21 09:48:05 ubuntu-user blueman-mechanism: loading Network
Aug 21 09:48:05 ubuntu-user kernel: [ 46.871717] Bluetooth: RFCOMM TTY layer initialized
Aug 21 09:48:05 ubuntu-user kernel: [ 46.871728] Bluetooth: RFCOMM socket layer initialized
Aug 21 09:48:05 ubuntu-user kernel: [ 46.871733] Bluetooth: RFCOMM ver 1.11
Aug 21 09:48:35 ubuntu-user blueman-mechanism: Exiting
</code></pre>
| 0non-cybersec
| Stackexchange | 1,685 | 5,189 |
Multiple search and find in sql. <p>I'm new to SQL and I'm stuck on a multiple find in SQL.</p>
<p>Here I'm trying to search table1 in the three columns. But I'm stuch in trying to find two phrases. I'm trying with an OR statement. </p>
<p>If I remove OR LIKE '%paris%' it works but how do I find multiple words/phrases. And would this statement be case sensitive?</p>
<p>I'm also using MySQL to run the above.</p>
<pre><code>SELECT * FROM `table1`
WHERE
CONCAT_WS('|',`target_1`,`target_2`,`target_3`)
LIKE '%london%' OR LIKE '%paris%'
</code></pre>
| 0non-cybersec
| Stackexchange | 188 | 556 |
Daisy chaining not working anymore after running update. <p>I'm running a Dell Precision 5530 with Ubuntu 18.04 which is connected to a 24" Dell monitor through a mini-display-port to display-port cable, which is connected to a 24" Dell monitor through a display-port to mini-display-port cable using daisy chaning.</p>
<p>Until yesterday, everything worked as expected, however, I did an <code>sudo apt update; sudo apt upgrade</code> and after that the daisy chaining doesn't work anymore.</p>
<p>So, in general I have three monitors</p>
<ol>
<li>Built-in</li>
<li>24" connected from Laptop (1) to this monitor (2)</li>
<li>24" connected from monitor (2) to this monitor (3).</li>
</ol>
<p>If 3 is turned off, 1 and 2 work as expected, however, as soon as I turn on 3, not even 2 works anymore. 2 is always shown in the settings under displays, but is black when 3 is on. 3 is never in the settings.</p>
<p>This is the update log from this morning </p>
<pre><code>Start-Date: 2018-11-05 08:04:34
Commandline: aptdaemon role='role-commit-packages' sender=':1.113'
Install: linux-headers-4.15.0-38-generic:amd64 (4.15.0-38.41, automatic), linux-modules-extra-4.15.0-38-generic:amd64 (4.15.0-38.41, automatic), linux-modules-4.15.0-38-generic:amd64 (4.15.0-38.41, automatic), linux-headers-4.15.0-38:amd64 (4.15.0-38.41, automatic), linux-image-4.15.0-38-generic:amd64 (4.15.0-38.41, automatic)
Upgrade: libpackagekit-glib2-18:amd64 (1.1.9-1ubuntu2.18.04.1, 1.1.9-1ubuntu2.18.04.3), update-manager-core:amd64 (1:18.04.11.5, 1:18.04.11.6), networkd-dispatcher:amd64 (1.7-0ubuntu3.2, 1.7-0ubuntu3.3), linux-headers-generic:amd64 (4.15.0.36.38, 4.15.0.38.40), friendly-recovery:amd64 (0.2.38, 0.2.38ubuntu1), linux-libc-dev:amd64 (4.15.0-36.39, 4.15.0-38.41), libapt-inst2.0:amd64 (1.6.3ubuntu0.1, 1.6.6), yarn:amd64 (1.10.1-1, 1.12.1-1), grub-common:amd64 (2.02-2ubuntu8.6, 2.02-2ubuntu8.7), linux-image-generic:amd64 (4.15.0.36.38, 4.15.0.38.40), apt:amd64 (1.6.3ubuntu0.1, 1.6.6), libparted2:amd64 (3.2-20, 3.2-20ubuntu0.1), update-manager:amd64 (1:18.04.11.5, 1:18.04.11.6), google-chrome-stable:amd64 (70.0.3538.67-1, 70.0.3538.77-1), python-apt-common:amd64 (1.6.2, 1.6.3), grub2-common:amd64 (2.02-2ubuntu8.6, 2.02-2ubuntu8.7), gdm3:amd64 (3.28.3-0ubuntu18.04.1, 3.28.3-0ubuntu18.04.3), libapt-pkg5.0:amd64 (1.6.3ubuntu0.1, 1.6.6), packagekit-tools:amd64 (1.1.9-1ubuntu2.18.04.1, 1.1.9-1ubuntu2.18.04.3), grub-pc:amd64 (2.02-2ubuntu8.6, 2.02-2ubuntu8.7), libparted-fs-resize0:amd64 (3.2-20, 3.2-20ubuntu0.1), linux-signed-generic:amd64 (4.15.0.36.38, 4.15.0.38.40), gir1.2-gdm-1.0:amd64 (3.28.3-0ubuntu18.04.1, 3.28.3-0ubuntu18.04.3), grub-pc-bin:amd64 (2.02-2ubuntu8.6, 2.02-2ubuntu8.7), libgdm1:amd64 (3.28.3-0ubuntu18.04.1, 3.28.3-0ubuntu18.04.3), dpkg:amd64 (1.19.0.5ubuntu2, 1.19.0.5ubuntu2.1), nautilus:amd64 (1:3.26.4-0~ubuntu18.04.1, 1:3.26.4-0~ubuntu18.04.2), libnautilus-extension1a:amd64 (1:3.26.4-0~ubuntu18.04.1, 1:3.26.4-0~ubuntu18.04.2), grub-efi-amd64-bin:amd64 (2.02-2ubuntu8.6, 2.02-2ubuntu8.7), python3-distupgrade:amd64 (1:18.04.26, 1:18.04.27), man-db:amd64 (2.8.3-2, 2.8.3-2ubuntu0.1), python3-update-manager:amd64 (1:18.04.11.5, 1:18.04.11.6), gir1.2-snapd-1:amd64 (1.41-0ubuntu0.18.04.1, 1.43-0ubuntu0.18.04.1), ubuntu-release-upgrader-core:amd64 (1:18.04.26, 1:18.04.27), gitlab-runner:amd64 (11.3.1, 11.4.2), parted:amd64 (3.2-20, 3.2-20ubuntu0.1), packagekit:amd64 (1.1.9-1ubuntu2.18.04.1, 1.1.9-1ubuntu2.18.04.3), apt-utils:amd64 (1.6.3ubuntu0.1, 1.6.6), mokutil:amd64 (0.3.0-0ubuntu5, 0.3.0+1538710437.fb6250f-0ubuntu2~18.04.1), light-themes:amd64 (16.10+18.04.20180421.1-0ubuntu1, 16.10+18.04.20181005-0ubuntu1), ubuntu-artwork:amd64 (1:16.10+18.04.20180421.1-0ubuntu1, 1:16.10+18.04.20181005-0ubuntu1), ubuntu-release-upgrader-gtk:amd64 (1:18.04.26, 1:18.04.27), grub-efi-amd64-signed:amd64 (1.93.7+2.02-2ubuntu8.6, 1.93.8+2.02-2ubuntu8.7), gir1.2-packagekitglib-1.0:amd64 (1.1.9-1ubuntu2.18.04.1, 1.1.9-1ubuntu2.18.04.3), nautilus-data:amd64 (1:3.26.4-0~ubuntu18.04.1, 1:3.26.4-0~ubuntu18.04.2), apt-transport-https:amd64 (1.6.3ubuntu0.1, 1.6.6), libsnapd-glib1:amd64 (1.41-0ubuntu0.18.04.1, 1.43-0ubuntu0.18.04.1), gstreamer1.0-packagekit:amd64 (1.1.9-1ubuntu2.18.04.1, 1.1.9-1ubuntu2.18.04.3), libdpkg-perl:amd64 (1.19.0.5ubuntu2, 1.19.0.5ubuntu2.1), secureboot-db:amd64 (1.1, 1.4~ubuntu0.18.04.1), linux-generic:amd64 (4.15.0.36.38, 4.15.0.38.40), ubuntu-mono:amd64 (16.10+18.04.20180421.1-0ubuntu1, 16.10+18.04.20181005-0ubuntu1), python3-apt:amd64 (1.6.2, 1.6.3), dpkg-dev:amd64 (1.19.0.5ubuntu2, 1.19.0.5ubuntu2.1)
End-Date: 2018-11-05 08:05:28
Start-Date: 2018-11-05 08:06:19
Commandline: apt upgrade
Requested-By: tzfrs (1000)
Upgrade: gnome-software-plugin-snap:amd64 (3.28.1-0ubuntu4.18.04.3, 3.28.1-0ubuntu4.18.04.4), gnome-software:amd64 (3.28.1-0ubuntu4.18.04.3, 3.28.1-0ubuntu4.18.04.4), ubuntu-software:amd64 (3.28.1-0ubuntu4.18.04.3, 3.28.1-0ubuntu4.18.04.4), unattended-upgrades:amd64 (1.1ubuntu1.18.04.5, 1.1ubuntu1.18.04.6), gnome-software-common:amd64 (3.28.1-0ubuntu4.18.04.3, 3.28.1-0ubuntu4.18.04.4)
End-Date: 2018-11-05 08:06:23
</code></pre>
<p>This is both on X11 and Wayland. Steps I did</p>
<ul>
<li>Re-plug the cable</li>
<li>Turn off/on monitors</li>
<li>Restart</li>
<li>Log out</li>
</ul>
<p>Update: I just upgraded to Ubuntu 18.10, hoping this would solve the issue, however, the issue still exists.</p>
| 0non-cybersec
| Stackexchange | 2,566 | 5,386 |
Camino a Worlds 2018: 31 Días - Resumen del día. Viernes de League of Legends y un día lleno de series cortas, un resumen de los matches del día de hoy en las ligas que definen quien estará en Korea!
# EU LCS
Primero tenemos en Europa la primer semifinal del split de verano, dónde el merito del resultado se lo lleva los errores de **Team Vitality,** con desiciones muy dudables y throws monumentales se define el primer finalista.
[TEAM VITALITY: 1 - 3 :F FC SCHALKE 04 ESPORTS](https://preview.redd.it/j2r34groajj11.png?width=2100&format=png&auto=webp&s=7a208aea190212b8fc4e1a2aa2961aa618022ed7)
Los cuadros quedan de la siguiente manera con una semifinal por definir y **Schalke** ya en la final.
https://preview.redd.it/gifxbybsbjj11.jpg?width=533&format=pjpg&auto=webp&s=d087a2a0497430e5e99dd4b7f0139df85d66d52a
​
# CLS
En América Latina terminan los cuartos de final, las calaveras les dan una lección de League of Legends a los rookies y pasan sin problemas a las semis que se jugarán mañana.
[FURIOUS GAMING: 3 - 0 :LEGATUM](https://preview.redd.it/j3t7cjbbcjj11.png?width=2100&format=png&auto=webp&s=67e8fda1ac2b45842618d86dc27a4c169952d241)
Los cuadros de final lucen así y Furious Gaming tendrá que enfrentarse al campeón actual de la CLS.
https://preview.redd.it/4hza6h85djj11.jpg?width=542&format=pjpg&auto=webp&s=651125b0aafbdd4eb57b72cd1f12d07cdb3f9d7d
​
# LLN
En el norte al igual terminan los cuartos de final, con un enfrentamiento dónde se deja clara la experiencia y el nivel de los jugadores del sub campeón de la región.
[6 SENSE: 0 - 3 :INFINITY ESPORTS CR](https://preview.redd.it/gn37p7vldjj11.png?width=2100&format=png&auto=webp&s=1018c3804e3fd5412870d9a31117ceadd6f83e7f)
Los cuadros de la liga de LAN se asoma un doble clásico para las semis.
https://preview.redd.it/oyap979wdjj11.jpg?width=538&format=pjpg&auto=webp&s=b697a40e37e32bf0bc96efb122c0a5905cd86925 | 0non-cybersec
| Reddit | 787 | 1,930 |
Is this alternative definition of manifolds correct?. <p>This question is related to <a href="https://mathoverflow.net/questions/56275/is-a-connected-separable-locally-euclidean-hausdorff-topological-space-second-co">this one</a> on MathOverflow, although somewhat different. It is also clearly related to a <a href="https://math.stackexchange.com/questions/2117058/is-this-hierarchy-of-manifolds-correct">previous question</a> of mine, although hopefully not a duplicate.</p>
<p><strong>Question:</strong> The "usual" definition of manifold is (1) locally Euclidean, (2) Hausdorff, (3) second countable. Another commonly used, but weaker, definition is (1) locally Euclidean, (2) metrizable.</p>
<p>Is the following definition equivalent to the "usual" definition?</p>
<blockquote>
<p>$$\text{(1) locally Euclidean (2) metrizable (3) separable}\iff \\ \text{(1) locally Euclidean (2) Hausdorff (3) second countable} ?$$</p>
</blockquote>
<p><strong>Attempt:</strong> </p>
<p>$\implies$ Obviously metrizable implies Hausdorff. Moreover, for metrizable spaces, <a href="https://en.wikipedia.org/wiki/Separable_space#Separability_versus_second_countability" rel="nofollow noreferrer">separability and second countability</a> are equivalent, so metrizable+separable implies second countable.</p>
<p>$\impliedby$ Locally Euclidean implies locally metrizable (since Euclidean space is metrizable). Locally Euclidean implies locally compact, and as in <a href="https://math.stackexchange.com/questions/527642/the-equivalence-between-paracompactness-and-second-countablity-in-a-locally-eucl">this question</a> on Math.SE, locally compact+Hausdorff+second countable implies paracompact. Then a <a href="https://en.wikipedia.org/wiki/Metrization_theorem#Metrization_theorems" rel="nofollow noreferrer">theorem of Smirnov</a> says that locally metrizable+Hausdorff+paracompact implies metrizable. </p>
<p><a href="https://en.wikipedia.org/wiki/Separable_space#Separability_versus_second_countability" rel="nofollow noreferrer">Second countable always implies separable</a>.</p>
<p><strong>Note:</strong> This result doesn't really seem useful to me. It popped in my head the other day and I figured it would make sense to double-check and/or to let anyone else see it who might be interested.</p>
<p>Also, the above is also equivalent to: </p>
<blockquote>
<p>$$\text{(1) locally Euclidean (2) metrizable (3) Lindelöf} $$</p>
</blockquote>
<p>since, <a href="https://en.wikipedia.org/wiki/Separable_space#Separability_versus_second_countability" rel="nofollow noreferrer">for metrizable spaces</a>, separable $\iff$ second countable $\iff$ Lindelöf.</p>
<p>Also worth mentioning: the above is also equivalent to:</p>
<blockquote>
<p>$$\text{(1) locally Euclidean (2) embeddable in some Euclidean space} $$</p>
</blockquote>
<p>This follows in one direction from the fact that <a href="https://math.stackexchange.com/questions/220843/is-every-subset-of-a-metric-space-a-metric-subspace">every subspace of a metrizable space is metrizable</a>, and <a href="https://en.wikipedia.org/wiki/Separable_space#Separability_versus_second_countability" rel="nofollow noreferrer">every subspace of a second countable space is second countable</a>. The other direction is nontrivial, the <a href="https://en.wikipedia.org/wiki/Whitney_embedding_theorem" rel="nofollow noreferrer">Whitney embedding theorem</a>.</p>
| 0non-cybersec
| Stackexchange | 1,025 | 3,412 |
Server (Win2008) has correct time, but all workstations (Win7) are ahead one hour. <p>Thanks for reading.</p>
<p>The network in question has one DC, which is a Windows 2008 R2 Server. All workstations are Windows 7 Pro.</p>
<p>This last Monday (9/22) I noticed the time was suddenly ahead by an hour on all the workstations in my domain. Not sure if it happened Monday or over the weekend.</p>
<p>I checked the server, and it was also off by an hour, so I updated the time on the server, and updated the time on the workstations.</p>
<p>Now the time is correct on the server, but the time on all the workstations keeps resetting to be an hour ahead. I've restarted the time service on the server and workstations, rebooted the workstations (not the server yet, though I may be able to late tonight if necessary), and tried manually changing the time on the workstations. I've also verified everything has the correct time zone, which is Pacific.</p>
<p>I don't know much about network time sync, but it seems like the server is pushing the wrong time or zone to the workstations even though it's using the correct time and zone for itself. It also seems like to big a coincidence that this happened just before the first day of Fall.</p>
<p>Any ideas?</p>
| 0non-cybersec
| Stackexchange | 336 | 1,267 |
Add ellipses to overflowing text in SVG?. <p>I'm using <code>D3.js</code>. I'd like to find an SVG equivalent to this CSS class, which adds ellipses if text flows out of its containing div:</p>
<pre class="lang-css prettyprint-override"><code>.ai-ellipsis {
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
-moz-binding: url(<q>assets/xml/ellipsis.xml#ellipsis</q>);
}
</code></pre>
<p>This is my SVG: </p>
<pre><code><g class="bar" transform="translate(0,39)">
<text class="label" x="-3" y="6.5" dy=".35em" text-anchor="start">Construction</text>
<rect height="13" width="123"></rect>
</g>
</code></pre>
<p>It's generated as follows: </p>
<pre><code>barEnter.append("text").attr("class", "label")
.attr("x", -3).attr("y", function() { return y.rangeBand() / 2})
.attr("dy", ".35em").attr("text-anchor", "start")
.text(function(d) {
return d.Name;
});
</code></pre>
<p>Currently the text is overflowing and overlapping the rect element. </p>
<p>Is there any way I can say "if text is more than a certain width, crop it and add ellipses"?</p>
| 0non-cybersec
| Stackexchange | 450 | 1,224 |
A question about Johnson's theorem on the first and second cohomology of commutative amenable algebras. <p>Johnson in cohomology of Banach algebra proved the following proposition.
I need to some guidance for the bold part of the following proof. Do you know any papers or book with more details for this part of the proof?</p>
<p>Proposition 8.2. Let <span class="math-container">$A$</span> be a commutative amenable Banach algebra and <span class="math-container">$X$</span> a commutative Banach <span class="math-container">$A$</span>-module. Then <span class="math-container">$H^1(A, X) = 0 = H^2(A, X)$</span>.</p>
<p>Proof. Let <span class="math-container">$D \in Z^1(A, X)$</span>; then <span class="math-container">$D \in Z^1(A, X^{∗∗})$</span> so that <span class="math-container">$D \in N^1(A, X^{∗∗})$</span> where this last set
is 0 because <span class="math-container">$X^{∗∗}$</span> is a commutative <span class="math-container">$A$</span>-module. Thus <span class="math-container">$D = 0 \in N^1(A, X)$</span> and <span class="math-container">$H^1(A, X) = 0$</span>.
If <span class="math-container">$T \in Z^2(A, X)\subseteq Z^2(A, X^{∗∗}) = N^2(A, X^{∗∗})$</span> then there is <span class="math-container">$S \in L^1(A,X^{∗∗})$</span> with <span class="math-container">$T = δS$</span>.
Let <span class="math-container">$q$</span> be the quotient map <span class="math-container">$X^{∗∗} → X^{∗∗}/X$</span>. </p>
<p><strong>??<em>We then have <span class="math-container">$δqS = qδS = q(δS − T ) = 0$</span> so that
<span class="math-container">$qS \in Z^1(A, X^{∗∗}/X) = 0$</span> by the result already proved. This shows that <span class="math-container">$S$</span> maps into <span class="math-container">$X$</span></strong>??</em></p>
<p>and so
<span class="math-container">$T = δS \in N^2(A, X)$</span>.</p>
| 0non-cybersec
| Stackexchange | 650 | 1,837 |
How to Calculate number of steps needed in model.predict_generator(). <p>So I am trying to figure out this issue of getting less length of Numpy array when I run my model. I have a total of 2000 images which is divided into 2 categories of 1000 each. Now when I pass these images through my vgg16 model for feature extraction it passes me only 1998 images back. Following is my code.</p>
<p>VGG16 model</p>
<pre><code>def load_vgg16(weights_path='vgg16.h5'):
if K.image_data_format() == 'channels_first':
inputShape = (3, 256, 256)
else:
inputShape = (256, 256, 3)
model = Sequential()
model.add(ZeroPadding2D((1,1),input_shape = inputShape))
model.add(Convolution2D(64, (3, 3), activation='relu'))
model.add(ZeroPadding2D((1,1)))
model.add(Convolution2D(64, (3, 3), activation='relu'))
model.add(MaxPooling2D((2,2), strides=(2,2)))
model.add(ZeroPadding2D((1,1)))
model.add(Convolution2D(128, (3, 3), activation='relu'))
model.add(ZeroPadding2D((1,1)))
model.add(Convolution2D(128, (3, 3), activation='relu'))
model.add(MaxPooling2D((2,2), strides=(2,2)))
model.add(ZeroPadding2D((1,1)))
model.add(Convolution2D(256, (3, 3), activation='relu'))
model.add(ZeroPadding2D((1,1)))
model.add(Convolution2D(256, (3, 3), activation='relu'))
model.add(ZeroPadding2D((1,1)))
model.add(Convolution2D(256, (3, 3), activation='relu'))
model.add(MaxPooling2D((2,2), strides=(2,2)))
model.add(ZeroPadding2D((1,1)))
model.add(Convolution2D(512, (3, 3), activation='relu'))
model.add(ZeroPadding2D((1,1)))
model.add(Convolution2D(512, (3, 3), activation='relu'))
model.add(ZeroPadding2D((1,1)))
model.add(Convolution2D(512, (3, 3), activation='relu'))
model.add(MaxPooling2D((2,2), strides=(2,2)))
model.add(ZeroPadding2D((1,1)))
model.add(Convolution2D(512, (3, 3), activation='relu'))
model.add(ZeroPadding2D((1,1)))
model.add(Convolution2D(512, (3, 3), activation='relu'))
model.add(ZeroPadding2D((1,1)))
model.add(Convolution2D(512, (3, 3), activation='relu'))
model.add(MaxPooling2D((2,2), strides=(2,2)))
if weights_path:
model.load_weights(weights_path, by_name= True)
return model
</code></pre>
<p>Feature extraction through bottleneck feature:</p>
<pre><code>def save_bottleneck_features(location):
batch_size = 16
datagen = ImageDataGenerator(rescale= 1./255)
model = load_vgg16()
generator = datagen.flow_from_directory(location+'/training-data/',
target_size=(image_width, image_height),
batch_size = 16,
class_mode = None,
shuffle = False)
bottleneck_features_train = model.predict_generator(
generator, nb_training_samples / batch_size)
np.save(open(location+'/bottleneck_features_train.npy', 'wb'), bottleneck_features_train)
# repeat with the validation data
generator = datagen.flow_from_directory(location+'/validation-data/',
target_size=(image_width, image_height),
batch_size=16,
class_mode=None,
shuffle=False)
bottleneck_features_validation = model.predict_generator(
generator, nb_validation_samples / batch_size)
np.save(open(location+'/bottleneck_features_validation.npy', 'wb'), bottleneck_features_validation)
</code></pre>
<p>running the above functions:</p>
<pre><code>top_model_weights_path='/top_model_weights.h5'
location = 'newdata'
nb_epoch = 50
training_samples= [len(os.listdir('newdata/training-data'+'/'+i))
for i in sorted(os.listdir('newdata/training-data/'))]
nb_training_samples = sum(training_samples)
#Calucalating number of data prsent in the folders or damage and whole cars in validation folder
validation_samples = [len(os.listdir('newdata/validation-data/' + i))
for i in sorted(os.listdir('newdata/validation-data/'))]
nb_validation_samples = sum(validation_samples)
print(training_samples)
print(validation_samples)
save_bottleneck_features('newdata')
</code></pre>
<p>So when I run the above code, I am expecting the total length of the array <code>bottleneck_features_train</code> to be 2000 but I am getting 1998 only. Similarly, the total length of <code>bottleneck_features_validation</code> comes 1840 but I am expecting to get 1840 (927+909).
The output for <code>training_samples</code> and <code>validation_samples</code> is below.</p>
<pre><code>[1000, 1000]
[927, 909]
</code></pre>
<p>I think I am passing the wrong number of steps required in <code>model.predict_generator()</code>. When I am trying to label these images by using this code.</p>
<pre><code>training_data = np.load(open(location+'/bottleneck_features_train.npy','rb'))
training_label = np.array([0] * training_samples[0] +
[1] * training_samples[1])
validation_data = np.load(open(location+'/bottleneck_features_validation.npy','rb'))
validation_label = np.array([0] * validation_samples[0] +
[1] * validation_samples[1])
</code></pre>
<p>and try to fit the model then I receive this error about training data and training labels are n not of the same length.</p>
<p>How can I fix this problem and start fitting my model? Thanks for any help. Cheers!</p>
| 0non-cybersec
| Stackexchange | 1,707 | 5,329 |
Misspelled MX record. Thank you DNS Registrar for causing me to probably be fired....
This is more of a warning and venting session, but I've flared it as a rant.
​
Friday after-hours, I called our DNS registrar and had them change the MX record to a new hosting service. The plan was to monitor our new mailboxes over night to confirm the change over, then come in and make local changes the next morning (today/saturday). Apparently, the info I was instructed by my lead to give them was incorrect, and the change over never happened. (No worries! I'll call them first thing in the morning! ) Fast forward to this morning when I'm on the phone with the registrar. After several on-holds and technician transfers, I'm able to give them the correct location to point the MX record to and have them change it. I asked the tech if he could email a screenshot of the record to my personal email once it was changed. He did, but I didn't receive the email until moments after the call ended.
I checked the email...... The tech misspelled the location......
I immediately call back. After several more on-holds and transfers, I reach a tech who attempts to change the MX record to the properly spelled location. Instead, their system "glitches", deletes our current record, and errors out anytime there's an attempt to create a new record. A ticket has been placed with their engineering team to resolve the issue. They won't be in until Monday. I've called back twice throughout the day to check on the ticket and see if another technician would be able to have a successful attempt, but to no avail.
So, Monday they'll attempt to correct the issue. If solved Monday, MX gets changed to right location. Emails start flowing by Tuesday.
The company has been without email since Friday evening. Won't be back until Monday night/early AM Tuesday. I don't even want to think about the amount of lost emails....
​
Wish me luck come Monday morning, sysadmins, jr. sysadmins, or fellow "IT Support" staff tasked with sysadmin roles.
Any advice on covering my ass / saving my job is appreciated.
​
tl;dr DNS Registrar changed mx record to wrong record then their system took a shit and won't accept changes. Escalated to team who won't be in-office until local business hours Monday, when company needs email the most. RIP my job.
​
​
Edit: Forgot to mention why I had to call the registrar instead of just using a web portal. 10-15 years ago, previous IT Director set up domain/web hosting, email hosting, and DNS management all with different companies. We have no administrative access, but were given authorization to change via phone.
Edit #2: thank you to everyone who responded. You've made my sleepless nights easier. Yes, this is a super outdated way of doing DNS (and anything in general), which is why we we're attempting to consolidate to one service. For those wondering, the registrar is Time Warner/Spectrum. This was setup decades ago prior to modern practices. If you're wondering what our "solution" is/was: Set up all local PC email clients to the new email host (manually if I may add...), and sit on our hands waiting for the registrar to fix things on their end.... Wait for Monday to role around where my boss can attempt to sugar coat the ordeal. Wasn't my call, unfortunately... Someone here said "learn how NOT to do things. In the future do the exact opposite of what this company would do" (sorry. paraphrasing. On mobile). Starting to think that's going to come in handy pretty soon.
If anyone is interested, I'll probably post an update on how much fun I've had at work tomorrow... | 0non-cybersec
| Reddit | 861 | 3,655 |
What is the systemd-networkd equivalent of post-up? (dynamic bridge MAC configuration). <p>In Linux distributions that use <code>/etc/network/interfaces</code> (such as Debian) I could get a (kernel) bridge to use the MAC48 address of one of its static bridge slave interfaces, such as a built in <code>wlan0</code>, using <code>post-up</code>, as in:</p>
<pre><code> post-up ip link set br0 address `cat /sys/class/net/wlan0/address`
</code></pre>
<p>This ensured that both 1) each cloned system used its very own unique MAC48 (the one from the unique wlan0), and 2) the bridge MAC kept stable even when hot-plugging further bridge interfaces with lower MAC48's.</p>
<p>Does systemd-networkd support any kind of <code>post-up</code> commands that can be run after a network (or netdev) has been brought up? I've tried to find such a thing, but may have missed it.</p>
<p>Or is the correct way in systemd completely different, i.e. to have a device unit, and a service that wraps the <code>ip link...</code> command and depends on the device unit? If so, how would the device unit and the service unit files look like?</p>
| 0non-cybersec
| Stackexchange | 320 | 1,127 |
Second derivative of likelihood function. <p>Let <span class="math-container">$f_{\delta}(y) = \frac{y}{\delta^2}*e^(\frac{-y^2}{2*\delta^2})$</span></p>
<p>with <span class="math-container">$y\geq 0$</span></p>
<p>I set up the Likelihood function as <span class="math-container">$$L(\delta) = (\frac{y}{\delta^2})^n *e^(\frac{-\sum y^2}{2*\delta^2})$$</span></p>
<p>and the log likelihood as <span class="math-container">$$l(\delta) = n*ln(\frac{y}{\delta^2})+\frac{\sum y^2}{2*\delta^2}$$</span></p>
<p>Taking first derivative <span class="math-container">$$l'(\delta) = -\frac{2*n}{\delta}-\frac{\sum y^2}{\delta^3}$$</span></p>
<p>Second derivative <span class="math-container">$$l''(\delta) = \frac{2*n}{\delta^3}+\frac{3*\sum y^2}{\delta^4}$$</span></p>
<p>But this second derivative seems incorrect, but where do I go wrong?</p>
<p>I want to calculate the Fisher Information with the second derivative and calculate a confidence interval.</p>
| 0non-cybersec
| Stackexchange | 336 | 950 |
Getting http 403 error when accessing website from remote client. <p>I have created an asp.net website that is to be accessed from client browsers running on the same domain.</p>
<p>I've hosted the site on IIS 7.5</p>
<p>I have disabled Anonymous Authentication and Enabled Windows Authentication from the Features View under the IIS section.</p>
<p>I have added the following in the web.config for the site:</p>
<pre><code><authorization>
<allow users="group\BizTalk Application Users" />
<deny users="?" />
</authorization>
</code></pre>
<p>I am able to open the website from a browser when running on the server that is hosting the site. However, if I then logon to a different server in the same domain, using the same credentials, when I try to browse to the site I get an http 403 error.</p>
<p>After getting no joy with the above I tried disabling all security to the site. I disabled Windows Authentication and enabled anonymous authentication but still I get the same error. I checked the IIS log on the server and can see that the sub code for the 403 is 18.</p>
<p>I've run fiddler on the client and see the following request / response:</p>
<p><strong>Request</strong></p>
<pre><code>GET http://tst-bts01/Vasanta.Int.SEOPSupportApp/Orders.aspx HTTP/1.1
Accept: image/jpeg, image/gif, image/pjpeg, application/x-ms-application, application/xaml+xml, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms- powerpoint, application/msword, */*
Accept-Language: en-GB
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
Host: tst-bts01
</code></pre>
<p><strong>Response</strong></p>
<pre><code>HTTP/1.1 403 Forbidden
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Tue, 29 Jan 2013 10:24:34 GMT
Content-Length: 0
</code></pre>
<p>I've tried changing the app pool that hosts the site. I've tried disabling the call the corporate proxy (isa server), running out of ideas now.</p>
<p>Can anyone tell me what I've done wrong?</p>
<p>Thanks, Rob.</p>
| 0non-cybersec
| Stackexchange | 710 | 2,196 |
Question about identifying a brand. No one else could help.. Hey guys, so I hear you are the best. I was recently out of state and I saw a polo that is exactly what I have been looking for. I can't find a picture but the brand logo was a red moped or a scooter or some sort. Kind of leads me to believe that the brand may be European. But anyways, when my trip was over I came back home and saw someone else wearing the shirt! Anyways if you guys can give me the brand name or any clues as to finding it. I would really appreciate it. I hope I didn't break any MFA rules. Thanks a lot! | 0non-cybersec
| Reddit | 144 | 585 |
What are the scope restrictions for setting shopt extglob. and other options?. <p>My non-interactive bash shell has <code>extglob off</code>. I would like to turn it on in the statement immediately before a command, but I have noticed that when <code>shopt -s extglob</code> is within an <code>if .. then .. else</code> block, it somehow does not register. </p>
<p>The following <em>extglob-dependant</em> command is not valid: <code>syntax error near unexpected token '('</code>. </p>
<p>Where can <code>extglob</code> be set, and why is there a restriction, at all? Does this apply to other options? ... <em>GNU bash 4.1.5</em> </p>
<p>This works: </p>
<pre><code>shopt -s extglob
if true ;then
touch a.bcd; ls a.@(bcd)
fi
</code></pre>
<p>This fails: </p>
<pre><code>if true ;then
shopt -s extglob
touch a.bcd; ls a.@(bcd)
fi
... line 17: syntax error near unexpected token `('
... line 17: `touch a.bcd; ls a.@(bcd)'
</code></pre>
| 0non-cybersec
| Stackexchange | 333 | 961 |
delete a line if same line exists in the previous line. <p>I want to remove lines which exist already in the previous line from the command line in UNIX. I have the following data in a file.</p>
<pre><code> <xref id="gi_525506931_ref_NP_001266519.1__brain_aromatase"/>
<entry ac="IPR002401" desc="Cytochrome P450, E-class, group I" name="Cyt_P450_E_grp-I" type="FAMILY">
<entry ac="IPR001128" desc="Cytochrome P450" name="Cyt_P450" type="FAMILY">
<entry ac="IPR001128" desc="Cytochrome P450" name="Cyt_P450" type="FAMILY">
<entry ac="IPR001128" desc="Cytochrome P450" name="Cyt_P450" type="FAMILY">
</code></pre>
<p>So, it should look like this:</p>
<pre><code> <xref id="gi_525506931_ref_NP_001266519.1__brain_aromatase"/>
<entry ac="IPR002401" desc="Cytochrome P450, E-class, group I" name="Cyt_P450_E_grp-I" type="FAMILY">
<entry ac="IPR001128" desc="Cytochrome P450" name="Cyt_P450" type="FAMILY">
</code></pre>
| 0non-cybersec
| Stackexchange | 408 | 1,087 |
Angular, Disable submit button using [disabled] to check form validity. <p>I'm trying to disable a submit button using <code>[disable]=form.controls[...].invalid</code> condition checking. The submit button should be disabled if there is an input fields is empty or <code>invalid</code>. But looks like i'm doing it wrong. The button is disabled when i fill some fields and left some fields empty, except for the first input field . When i filled the first input field, the button become enabled (while the other input fields are still empty or <code>invalid</code>).</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>//component.ts
form01: FormGroup;
public myDatePickerOptions: IMyDpOptions = {
dateFormat: 'dd-mmm-yyyy',
};
setDate(): void {
let date = new Date();
this.form01.patchValue({
DoB: {
date: {
year: date.getFullYear(),
month: date.getMonth() + 1,
day: date.getDate()
}
}
});
}
clearDate(): void {
this.form01.patchValue({
DoB: null
});
}
constructor(public builder: FormBuilder) {
this.form01 = this.builder.group({
email: [null, Validators.required], //text
DoB: [null, Validators.required], //radio button
gender: [null, Validators.required], //date picker
});
}
results: object = new Object();
functionForm01() {
this.results = [{
{
"email": this.form01.controls.email.value
},
{
"DoB": this.form01.controls.DoB.value
},
{
"gender": this.form01.controls.gender.value
}
}]
console.log(this.result);
this.form01.reset();
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><!--component.html-->
<div>
<form [formGroup]="form01">
email:<input type="text" name="email" formControlName="email" required/> gender:
<input type="radio" name="gender" formControlName="gender" value="male"> male<br>
<input type="radio" name="gender" formControlName="gender" value="female"> female<br> DoB:
<my-date-picker name="DoB" [options]="myDatePickerOptions" formControlName="DoB" required></my-date-picker>
<button type="submit" [disabled]="form01.controls['email' || 'DoB' || 'gender'].invalid" (click)="functionForm01()">Click</button>
</form>
</div></code></pre>
</div>
</div>
</p>
<p>I'm using Angular typescript and <code>myDatePicker</code> package from <a href="https://github.com/kekeh/mydatepicker" rel="noreferrer">this link</a>. Can anyone help me please?</p>
| 0non-cybersec
| Stackexchange | 898 | 2,751 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
Solving 2 unknown using vectors. <p><a href="https://i.stack.imgur.com/FaZpV.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FaZpV.jpg" alt="enter image description here"></a></p>
<p>ABCDEF is a regular hexagon and O is the centre of the regular hexagon . </p>
<p>Vector OB = $b$ , Vector OC = $c$ . The side FA is produced to a point G such that FA : AG = 1 : 2.</p>
<p>The line DG meets OC at point X such that </p>
<p>vector DX = $h$ DG , where h is a constant .
Express vector DX in terms of $h$, $b$, $c$, </p>
<p>Given also that vector OX = $k$ OC , where k is a constant , express vector OX in terms of $k$ and $c$, </p>
<p>hence find the value of $h$ and of $k$ </p>
<p>I found :
Vector DX = $2h ( -c + 2b ) $ </p>
<p>Vector OX = $ kc$ </p>
<p>Now I have 2 unknowns , I'm not sure on how to start to find unknowns $k$ and $h$, I thought of simultaneous equations but I don't know how to start. Can I get a hint ? Thanks in advance ! </p>
| 0non-cybersec
| Stackexchange | 358 | 975 |
How many ways to arrange $2n$ people in two lines. <blockquote>
<p>There are $2n$ people, each with a unique height. I am to place them in two rows of $n$ people in each row such that the person in the front row is shorter than the one directly behind. How many ways can I do this?</p>
</blockquote>
<p>I am assuming that order of how the people are placed matters (for example, row one: 1,2,3 is different from 2,3,1). I'm thinking about this problem as the number of ways to place the $2n$ people in pairs, such that the order of picking pairs matters. Thus, my answer should be
$${2n \choose 2} \cdot {2n-2 \choose 2}\cdot \cdots\cdot {2 \choose 2}.$$</p>
<p>Is this method of thinking correct? I've tried to see if this works for $n=1,2$ and it seems to hold up.</p>
| 0non-cybersec
| Stackexchange | 235 | 776 |
Can anyone explain this weird sound-card glitch? (already fixed, but not explained). <p>I have a recent (AMD Athlon II X4 645 based) PC. Although the motherboard has integrated sound, I use an ancient-but-still-pretty-good Creative Soundblaster Audigy Platinum Ex. I dual boot Windows 7 and Windows XP at the moment.</p>
<p>Today, about an hour ago, using Windows 7, I noticed that I wasn't getting any sound when I started a game of Oolite. I know the sound was working around an hour before that. Not sure if I rebooted in-between or not, but I had the speakers switched off for a lot of that time, so didn't notice exactly when the noises stopped.</p>
<p>At that point, I had only used Windows 7 all day (I haven't allowed XP on the internet for a few years now). There were no driver updates in this time, nor any settings changes. The most recent drivers for this card were released in 2010 IIRC. About all I've done today is browse a few web sites, watch a couple of videos in VLC, and update some backups on an external hard drive.</p>
<p>I checked the speakers and cable, and the state of the sound card and drive in the device manager, and of course the volume control. Everything seemed fine. I thought maybe the old card had failed.</p>
<p>But when I rebooted from Windows 7 to XP as a final check, all the sound was fine. I rebooted back to Windows 7 again and the sound was dead again.</p>
<p>The fix was simple enough in the end. The driver executable for the sound card (SBAX_PCDRV_LB_2_18_0017.exe) offers to remove existing drivers if they're found, so I ran it once to remove the drivers, rebooted, then ran it again to reinstall them and rebooted again. All sound is now fine.</p>
<p>But this isn't very satisfying. Obviously reinstalling (the exact same version of) the driver has reset some setting that had got broken, but ideally I'd like to know what the cause was so that I can prevent it happening again.</p>
<p>Any ideas?</p>
<p><strong>EDIT</strong></p>
<p>The most recent drivers for this soundcard have turned out to be a bit buggy. I only got this particular glitch a couple of times, but I found a much bigger problem when I tried to use a microphone in Windows 7 64-bit. Basically, chunks were missing from the audio waveform, giving the impression of one of three or four buffers being wiped to all zeros every time it's used, which is several times per second recording 48KHz.</p>
<p>My final solution was to give up on that soundcard. I'm currently mostly using motherboard HD audio, though I also have a USB SoundBlaster Audigy 2 NX which is slightly less obsolete and doesn't have the same driver issues (but also doesn't have MIDI or firewire ports).</p>
| 0non-cybersec
| Stackexchange | 692 | 2,704 |
A tool like pdfcrop2 that only *reduces margins from original* --- as opposed to cropping and then allowing the addition of extra margins. <p>I have a tool called <code>pdfcrop2</code> that I've had for a while now. It's a perl script that fully crops PDF files to the actual content (removing all surrounding whitespace), and then allowing the addition of extra margins if one wants them.</p>
<p>However, does there exist a tool similar to this one that does <em>not</em> perform the initial crop, but rather limits itself to reducing the margins by a specified amount from the left, right, top and bottom?</p>
<p>This will be useful in cases where all of my one-page PDF files are all A4-sized but are not exactly of the same format. (Examples would be the initial pages of chapters vs. all other pages in a document with a book format. In these cases, it would be nice to get the same “predictable” effect on all pages.)</p>
| 0non-cybersec
| Stackexchange | 236 | 930 |
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 |
Ansible text file busy error. <p>I have a Vagrant / Ansible set up on my Windows host. Ansible is set up to run on the Ubuntu guest, as <code>Vagrant up</code> executes a shell script which copies the <code>provisioning yml</code> files onto the guest and installs Ansible also on the guest.</p>
<p>The script runs the Ansible set up on the guest with the following command:</p>
<pre><code># Ansible installations
sudo apt-get install -y ansible
# Copy all Ansible scripts to the ubuntu guest
sudo cp -rf -v /vagrant/provisioning /home/vagrant/
# cp /vagrant/hosts /home/vagrant/
sudo chmod 666 /home/vagrant/provisioning/hosts
# Install roles
sudo ansible-playbook /home/vagrant/provisioning/local.yml -i /home/vagrant/provisioning/hosts --connection=local
</code></pre>
<p>One of the steps in the Ansible configuration process is setting up a fresh copy of Laravel in the <code>/var/www</code> directory. After pulling in Laravel, my script then copies and then edits the <code>.env</code> file in document root (<code>/var/www</code>).</p>
<p>But therein is the problem, it fails with <code>text file busy</code> message. This is a copy that is happening on the guest as source and destination, so I guess nothing to do with VBox. I have a feeling it has to do with the file name being so unusual, but I have not found an answer.</p>
<p>My <code>task.yml</code> file for Laravel is:</p>
<pre><code>---
- name: Clone git repository
git: >
dest=/var/www
repo=https://github.com/laravel/laravel.git
update=no
sudo: yes
sudo_user: www-data
register: cloned
- name: copy .env file
copy: src=env.j2 dest={{ conf_file }}
- name: set APP_DOMAIN={{ server_name }}
lineinfile: dest=/var/www/.env regexp='^APP_DOMAIN=' line=APP_DOMAIN={{ server_name }}
</code></pre>
<p>I have also tried using the template method with the same error:</p>
<pre><code>- name: copy .env file
template: src=env.j2 dest={{ conf_file }}
</code></pre>
<p>My conf file contains:</p>
<pre><code>conf_file: /var/www/.env
</code></pre>
<p>It fails at the copy step as follows:</p>
<pre><code>==> default: TASK: [laravel | copy .env file] **********************************************
==> default: failed: [10.0.1.10] => {"failed": true, "md5sum": "a380715fa81750708f7b9b6fea1a48fe"}
==> default: msg: Could not replace file: /root/.ansible/tmp/ansible-tmp-1441176559.19-197929606462535/source to /var/www/.env: [Errno 26] Text file busy
==> default:
==> default: FATAL: all hosts have already failed -- aborting
==> default:
==> default: PLAY RECAP ********************************************************************
==> default: to retry, use: --limit @/root/local.retry
==> default:
==> default: 10.0.1.10 : ok=21 changed=18 unreachable=0 failed=1
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.
</code></pre>
<p>The <code>.env</code> source file is in a folder called <code>files</code> off the Laravel task folder, same as other items I configure which work OK. The file <code>.env</code> is not found in the <code>www</code> folder after it fails so it does not copy it.</p>
| 0non-cybersec
| Stackexchange | 1,062 | 3,336 |
hpux: ipmon on syslog.log. <p>I have configured firewall for log,i want to write in a separate file log
for ipmon.
Reading on net they suggest to use local0.* or local0.debug on /etc/syslog.conf file.
I make this</p>
<pre><code>local0.notice /var/adm/syslog/ipmon.log
local0.info /var/adm/syslog/ipmon.log
local0.err /var/adm/syslog/ipmon.log
local0.warning /var/adm/syslog/ipmon.log
</code></pre>
<p>I have try also local0.debug and local0.*
But instead of write on only ipmon.log,it continue to write on syslog.log
and ipmon.log.
Why?
Of course i have restarted ipmon and syslogd</p>
| 0non-cybersec
| Stackexchange | 219 | 608 |
Fastest method for adding/summing the individual digit components of a number. <p>I saw a question on a math forum a while back where a person was discussing adding up the digits in a number over and over again until a single digit is achieved. (i.e. "362" would become "3+6+2" which would become "11"... then "11" would become "1+1" would would become "2" therefor "362" would return 2... I wrote some nice code to get an answer to this and posted it only to be outdone by a user who suggested that any number in modulo 9 is equal to this "infinite digit sum", I checked it an he was right... well almost right, if zero was returned you had to switch it out with a "9" but that was a very quick fix...</p>
<p>362 = 3+6+2 = 11 = 1+1 = 2</p>
<p>or...</p>
<p>362%9 = 2</p>
<p>Anways, the mod9 method works fantastic for infinitely adding the sum of the digits until you are left with just a single digit... but what about only doing it once (i.e. 362 would just return "11")... Can anyone think of fast algorithms?</p>
| 0non-cybersec
| Stackexchange | 291 | 1,021 |
Datepicker-popup formatting not working when value set initially in scope. <p>I am using the Angular UI bootstrap date picker popup using this custom directive on Plunker (<a href="http://plnkr.co/edit/053VJYm1MpZUiKwFTfrT?p=preview" rel="noreferrer">http://plnkr.co/edit/053VJYm1MpZUiKwFTfrT?p=preview</a>):</p>
<pre><code>//Module
var userModule = angular.module("userModule",['ui.bootstrap']);
//Controller
userModule.controller("sampleController", ['$scope', function ($scope) {
$scope.minDate = new Date();
}]);
//Directive code
userModule.directive('datePicker', [function (dateFilter) {
return {
restrict: 'E',
require: 'ngModel',
scope: {
ngModel: '=',
ngReadonly: '=?',
minDate: '=?',
maxDate: '=?',
dtpRequired: '=?',
dateOptions: '=?'
},
template: '<p class="input-group">' +
'<input type="text" style="cursor:pointer" class="form-control" datepicker-popup="{{format}}"' +
'ng-model="ngModel" is-open="opened"' +
'min-date="minDate" max-date="maxDate"' +
'datepicker-options="dateOptions" date-disabled="disabled(date, mode)"' +
'ng-required="dtpRequired" close-text="Close" ng-readonly="ngReadonly" ng-click="openPopup()" />' +
'<span class="input-group-btn">' +
'<button type="button" class="btn btn-default" ng-click="openPopup($event)">' +
'<i class="fa fa-calendar"></i></button>' +
'</span>' +
'</p>',
controller: function ($scope) {
// check if it was defined. If not - set a default
$scope.dateOptions = $scope.dateOptions || {
formatYear: 'yy',
startingDay: 1,
showWeeks: false
};
$scope.openPopup = function ($event) {
if ($event !== undefined) {
$event.stopPropagation();
}
$scope.opened = true;
};
$scope.format = 'dd MMMM yyyy';
},
link: function ($scope, element, attrs, controller) {
//remove the default formatter from the input directive to prevent conflict
controller.$formatters.shift();
}
};
}]);
</code></pre>
<p>This is working fine and the date is formatted fine when selecting a date from the calendar popup. However if I set a date of the ng-model in the controller, the date isn't formatted as 'dd MMMM yyyy' and is returned as a date string like Sat Oct 01 2016 01:00:00 GMT+0100 (GMT Daylight Time). However in the Plunker, I am able to set a date in the controller and it is formatted fine.
Here is my HTML for the date picker:</p>
<pre><code><date-picker ng-model="startDate.value" datepicker-options="dateOptions" min-date="minDate" ng-readonly="true"></date-picker>
</code></pre>
<p>In my controller <code>startDate.value = new Date();</code></p>
<p>I'm not sure where the problem could be. The image below shows what I'm getting back.</p>
<p><a href="https://i.stack.imgur.com/bRVL4.png" rel="noreferrer"><img src="https://i.stack.imgur.com/bRVL4.png" alt="Wrong Date"></a></p>
| 0non-cybersec
| Stackexchange | 1,019 | 3,434 |
Enforcing directory space limits in an OpenVZ system. <p>I have some programs on a server (Centos4-OpenVZ) that use a directory as temp directory - but pay no attention to the size as it grows.</p>
<p>I want to enforce a limit, such as that this folder cannot exceed 300MB.</p>
<p>I would use quota but OpenVZ does not support loop devices, that could be used to mount a file as a device.</p>
<p>Any other solutions? (Apart from scripting a periodic delete of files in the directory).</p>
<p>Editing the application's code to implement this functionality is not entirely out of the question (if it can be done easily and no other ways exist it's written in cpp) but I don't know where I would start if going that route.</p>
| 0non-cybersec
| Stackexchange | 195 | 728 |
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 |
It may be slow junk, but I'm happy with my first ever V8!. So my dad saw this Mustang while driving home from work. I had been looking to get my first car independent of help from my parents, so the budget was not very high. I personally was in the market for a Golf GTi, but finding one in manual that wasnt too expensive or in good shape was fairly difficult.
When he told me there was a Mustang in my price range I wasn't really interested at first. He kept pushing me to test drive it, but I kept saying no.
I finally relented to just stop the nagging.
We drove to the dealership and I got in the car, and drove it around. It might not be fast in the modern standard, but Ive never really driven a car that was newer than 2005, so comparing it to my previous cars it's a lot faster! A v8 makes such a good noise too.
Coming from a 2002 SVT Focus, and before that an FB RX7, I have never really experienced torque either.
It came with the optional Mach 1000 audio system and 40th anniversary package. I finally got my summer wheel setup put on ( weather in Ohio is a bit... random at best, we have had 60s and 30s within 1 day) and the wide setup makes a world of difference.
Anyway, here she is, my [2004 Mustang GT](https://imgur.com/gallery/3ijuV) | 0non-cybersec
| Reddit | 316 | 1,264 |
Simple Poker Simulation - How to design it well. <p>I trying to create a little poker Texas Holdem simulator .. </p>
<p>In my solution have some class :
<a href="https://i.stack.imgur.com/QiRMI.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QiRMI.jpg" alt="enter image description here"></a></p>
<p>Premise : I know about <em>Fisher Yates algorithm.</em>
I will implement it later</p>
<p>Keep in mind that the next step I would like to implement a </p>
<ul>
<li><em>Hands Evaluator</em> for compare Players <em>Hands</em></li>
<li><em>Odds Calculator</em> for some odds like <em>Hand vs Hand</em> or when player go all in before river coming..</li>
<li>so on .. </li>
</ul>
<p>I ask myself if have sense to implements a Class <em>Hand</em> which contains logic about <em>compare Player Hands</em> or continue to use a <em>List</em>.</p>
<p>Working with a List it's very comfortable but I think it's a little out of context of problem. </p>
<p>In poker world I talk about <em>Hand</em> , best <em>Hand</em> and so on .. </p>
<p>There is to implement also a CommunityCard/Board
That we have <em>Flop</em> with 3 community Card , <em>Turn</em>: one card and <em>River</em>: one card.. </p>
<p>And how this could interact with the eventual class <em>Hand</em> or other , for implements a <em>Hand Evaluator</em> ..</p>
<p>Does it make sense to create a <em>Board</em> or <em>CommunityCard</em> class?
How would you implement it? With a <em>List(5)</em>?
Would you use interfaces? How ?</p>
<p>My idea is to create a <em>Hand</em> and <em>Board</em> class.
<em>Hand</em> class with a two private member Card. </p>
<p><em>Board</em> class probably with a List. I don't know yet. </p>
<p>In <em>Hand</em> I know How to compare two different <em>Hand</em> but I don't know how compare 6 different <em>Hand</em> .. Have an idea ? Compare two by two and create a Class ranking that have a List with a ranking about 6 <em>Hands</em>?</p>
<p>The alternative without <em>Hand</em> class is continue to use a <em>List</em> and write all the logic about compare hand in a module Hand Evaluation. </p>
<p>So I wonder, How to best model the problem now?</p>
<p>I have some confusion about .. </p>
<p>I have particular difficulty thinking about using the <em>interface and delegate</em> when modeling the problem.
Do you have any other suggestions on how to design well and useful tools in addition to the class diagram, I listen to all the advice ..</p>
| 0non-cybersec
| Stackexchange | 805 | 2,478 |
AWS SNS : Why is my "ghost" subscription not showing in Topic. <p>I'm having a weird issue with Amazon AWS SNS : When creating subscriptions and topics using <code>aws-php-sdk</code> (3.112.7), there is always a "ghost" or "invisible" subscription.</p>
<p><a href="https://i.stack.imgur.com/Km3ur.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Km3ur.png" alt="AWS Console screenshot"></a></p>
<p>As you can see, this <strong>subscription exists in "subscriptions" tab</strong>. However, when I click on the topic link (here <code>cav_56826</code>), <strong>I can't see any subscription</strong>.</p>
<p><a href="https://i.stack.imgur.com/X3pK8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/X3pK8.png" alt="AWS Topic screenshot"></a></p>
<p>Do you guys already had a similar issue ? How can this happen ?</p>
<p><strong>Here is a my simplified code :</strong></p>
<pre><code> try
{
$arn = "arn:aws:sns:eu-west-1:XXXXXXXXXXXXXXXXX:app/APNS_VOIP_SANDBOX/ios_cav";
$topics = array("allUsers", "cav_56826");
$topicsToSubcribe = array();
foreach ($topics as $topic)
{
$res = $this->snsClient->createTopic(['Name' => $topic]);
if ($res->get('@metadata')['statusCode'] == 200)
{
array_push($topicsToSubcribe, $res->get('TopicArn'));
}
else
{
throw new Exception("An error occured during Amazon SNS createTopic", $res->get('@metadata')['statusCode']);
}
}
$SNSEndPointData = $this->snsClient->createPlatformEndpoint([
'PlatformApplicationArn' => $arn,
'Token' => $token
]);
foreach ($topicsToSubcribe as $topic)
{
$this->snsClient->subscribe([
'Protocol' => "application",
'Endpoint' => $SNSEndPointData->get('EndpointArn'),
'TopicArn' => $topic
]);
}
}
catch (\Exception $e)
{
// Logs some errors
}
</code></pre>
| 0non-cybersec
| Stackexchange | 706 | 2,158 |
Google translate, placeholder text in input type='text'. <p>Problem translating placeholder text in <code>input type="text"</code></p>
<p>This is my sample code:</p>
<p><strong>Html:</strong></p>
<pre><code><div id="google_translate_element" style="float:left; padding-left:15px"></div>
<!-- Need to translate this placeholder text -->
<form><input type="text" placeholder= "Enter your name" />
<input type="submit" value="Submit" />
</form>
</code></pre>
<p><strong>JavaScipt:</strong></p>
<pre><code><script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en', includedLanguages: 'ca,da,de,el,en,es,fr,it,ja,ko,nl,pl,pt,ru,sv,tl', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');
}
</script>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
</code></pre>
<p><strong>CSS:</strong></p>
<pre><code><style>
div#google_translate_element div.goog-te-gadget-simple{background-color:green;}
div#google_translate_element div.goog-te-gadget-simple a.goog-te-menu-value span{color:yellow}
div#google_translate_element div.goog-te-gadget-simple a.goog-te-menu-value span:hover{color:#ffffff}
</style>
</code></pre>
<p>translater example is in</p>
<p><strong>JSFiddle:</strong></p>
<p><a href="http://jsfiddle.net/ulak/zDUYL/" rel="nofollow">http://jsfiddle.net/ulak/zDUYL/</a></p>
<p>Please mention any other way to translate placeholder text using google translate</p>
| 0non-cybersec
| Stackexchange | 593 | 1,665 |
Are there any non-naive parallel sparse matrix multiplication algorithms?. <p>I was wondering about a problem in analyzing a social network (counting friends-in-common between all pairs of members) that requires squaring its adjacency matrix, and started reading up on algorithms for multiplying sparse matrices.</p>
<p>However, all I found so far were different ways of arranging the more or less naive "outer product" algorithm between processors - the same total number of multiplications/additions with different amounts of communication and additional algorithmic overhead (which, though, is undoubtedly important).</p>
<p>The most non-trivial algorithm I found was the Yuster-Zwick algorithm described in <a href="http://cs.tau.ac.il/~zwick/papers/sparse.pdf">Fast sparse matrix multiplication</a>, which is basically a combination of the same old naive algorithm and using a fast dense method for the dense part of the problem.</p>
<p>I looked at how sparse matrix multiplication is implemented in <a href="https://spark.apache.org/mllib/">MLLib</a> and it, too, appears to use the simple block-based algorithm.</p>
<p>Are there any parallel algorithms for multiplying sparse matrices that are substantially different from the naive one - as different as Strassen's or Coppersmith-Winograd's algorithms are from the naive algorithm for multiplying dense matrices?</p>
<p>For concreteness, let us assume that the matrices are sparse enough that number of non-zeros in the arguments and in the result are both $O(N)$.</p>
| 0non-cybersec
| Stackexchange | 359 | 1,532 |
Prove that a circle can be inscribed in the hexagon. <p>Given a convex hexagon $ABCDEF$. All its sides are equal (it can be irregular). Furthermore, $AD = BE = CF$. How can I prove that a circle can be inscribed in this hexagon?</p>
<p><a href="https://i.stack.imgur.com/NKgWC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NKgWC.png" alt="enter image description here"></a></p>
| 0non-cybersec
| Stackexchange | 132 | 400 |
Why do cars have timing belt?. I know it's a stupid question (right sub? check.) but why do majority of cars use timing belt design? From my understanding, if that belt breaks the engine is totally ripped apart (if it's interference type).
Watching lot of videos on youtube on how they work, it's single purpose is to keep all parts of the engine in sync. So why not just use gears and levers that will last forever (like crankshaft which is a permanent fixture of the engine)? Why use belt system that needs replacing every so often? I know that some high end cars uses chains, but even that needs replacing.
Is there some mechanical engineering reason or designed to simply keep the service shop in business? Replacing one of these are expensive and not your typical DIY project. | 0non-cybersec
| Reddit | 171 | 783 |
Your ex is not the one you should be stalking (the mindset behind getting over her). *A little while ago I’ve had some great feedback on [this thread](http://www.reddit.com/r/socialskills/comments/2wn9xc/i_used_to_be_shy_had_very_low_self_confidence_and/) and hopefully also helped someone in the process. I wanted to go a little deeper into it so here it is, a (pretty long) post on how to get out of shitty situations in life. Hope you enjoy it.*
**Your ex is not the one you should be stalking**
**(the mindset behind getting over her)**
Ever thought you’d found the only one girl capable of making you happy and some day out of the blue, she decided to break up with you?
**Welcome to the “black hole”**
You feel miserable, still can’t believe that happened, almost paralyzed.
Nothing amuses you anymore and everything, every little thing you face in your day, whether it’s work, going out with friends, or even watching a freaking movie at home, is just too hard to do. What’s even worse is that you realize you feel like shit but apparently can’t do anything about that. Your self-worth is crushed and you’re almost crying. For a few seconds you may even start believing you are not a man anymore.
If some of this resonates with you and I know all of this, it’s only because I lived it and hated every second of it.
That’s why I also know what comes next, after you have been sucked in this mess I call the black hole.
The next few days you think you got over all that. Suddenly, there it is, a Facebook update or a tweet from your now ex other half. Your reaction is probably along the lines of “Ha! I knew she would have missed me, this post is really about me (even though it’s nothing but a verse from a random song…)” or “She already got over me, I’m pathetic and it was definitely my fault if she left me”.
This is just the beginning. The following days or even months are nothing but a race in which you can only keep up by reading and analyzing every single thing that person writes or posts online. Well my friend you’re on the verge of virtual stalking and trust me, it’s slowly eating you from the inside.
At this point you may be wondering why the hell I’m emphasizing all this. Well it happens I got out of that black hole and I know what worked for me. I want to share it with you in hopes that you escape it too and become relationship material again, if you want to.
**The turning point**
When you can’t realize what a mess you’ve become, you probably just need someone else to tell you in order to wake the fuck up.
That is why friends and family are there. You notice how they react to your pitiful condition, and it’s like a helping hand reaching from outside the black hole.
Finally you are like “Wait, who the hell is this self-doubting, sad and unmotivated zero testosterone creature!? It can’t possibly be me!”.
Yes! Good job! Welcome back man. Better late than never. Men are allowed to have feelings too, I know, but there’s a limit to the amount of girliness one can display. C’mon, the whiney bitch era is over, let’s get to work.
Work is the perfect word for what you should be doing right now. I’m not talking about going to work at your job. What I mean is getting dirty with working on yourself. After all, if you don’t do it, who else is going to? No little magic fairy here to help you.
**How do you work on yourself?**
You go through a process. Call it self-development, call it however you like. What matters though it’s not only that you go through it, but the mindset you approach it with.
This said, there are two ways you can work on yourself and I like to define them as:
1. Self-analysis
2. Self-stalking
One of them is counterproductive when you are in the black hole. The other one has the potential to get you out of it once and for all.
You want to think long-term here. You want to go with Self-stalking.
What the hell does it mean? It simply means that you need to shift from stalking your ex to stalking yourself. Yes. You, the person you think you know so well but never dedicate much time to understand.
**What’s the difference between stalking and analyzing yourself?**
Analyzing yourself while you are stuck inside your own head (infamous black hole), is nothing but mental masturbation.
What I did to get out of it, was exactly stalking myself. I stopped mentally masturbating and started watching my every move, thought and reaction BUT I did it from an “outsider” perspective.
Almost like a paparazzi trying to catch a glimpse of that side boob poolside from the gate of some celebrity’s mansion. It does not give immediate results but with persistence the paparazzi gets his thousand dollars picture. You can do the same by observing yourself (sadly not the thousand bucks part).
So here’s what I’ve done to “stalk” myself and how you can do it too:
**1. Meditate**
Simply sitting in silence for 2, 5 or 10 minutes a day and focusing on your breath, is extremely powerful IF done consistently.
This is a skill and as such, it requires practice, so don’t get discouraged if it seems awkward and unnatural at the beginning. It does.
It will all feel easier with practice, and the results will be disproportionate.
*Action Step*: If you think this is all woo woo guru shit, check out [this video](https://www.youtube.com/watch?v=GZzhk9jEkkI) by a retired navy seal teaching his breathing and meditation technique. This is a guy who knows a thing or two about mental toughness and self-control.
*Lesson*: The focus and clarity you will gain from meditating on a daily basis are exactly what you need in order to create some space in between YOU and the vision of yourself. They are two very different things.
Understanding this alone can shift your mood from hyper-depressed to active and motivated; you learn that how you are thinking and reacting now to what happened in the past, is just a part of a long term process called “life”.
It doesn’t define you.
Instead, you will define yourself depending on how you respond to this situation.
**2. Read**
I guess it comes a time when, if you really want to overcome some obstacles and step to the next level, you really have to add fresh new knowledge to your arsenal.
I’m not talking about fantasy, horror or thriller novels; those are great for bedtime.
I wanted to think and then act like someone confident, successful and who didn’t need to whine about his ex every time he was hanging out with his friends.
Books like “The power of now” by Eckhart Tolle or “Think and grow rich” by Napoleon Hill, helped me shift from a totally negative and passive mindset, to a proactive and positive one. I was reading almost one book every two or three weeks.
It’s like having your own personal coach available 24/7.
You may not internalize everything at first and that’s fine. Let it rest in the backburner of your mind and soon it will all start to click.
*Action Step*: Go on Amazon and simply look for what you feel you need to get better at or learn. Most importantly, look for what resonates most with you to make everything more exciting and compelling. Kindle books are no more than $10 on average.
*Lesson*: Learning to invest in yourself is a critical skill for success in every area of life. Less clothes and useless crap, more books.
**3. Exercise**
I’ve played basketball for 13 years but that was like playing videogames, it was not really meant to improve myself but to keep me entertained.
I wanted to be like Kobe Bryant. I wanted the dream, not the process.
After I stopped playing, I didn’t have anyone pushing me or screaming at me if I didn’t exercise. It was all on me.
It was a matter of choices:
Having the persistence to stick to something that I knew was good for me
or
Letting fast food and beer lead me on the fat route.
Regularly going to the gym and then transitioning into a consistent home workout routine, was what I needed to step out of the comfort of having someone make the decisions for me.
Try to see lifting weights, doing pushups and running, as a sort of meditation and it will help you enjoy exercising.
*Action Step*: take a piece of paper, throw all excuses in the trash and schedule some time (it can be anything from 30 minutes to one or two hours), every day, when you will commit to exercise. If you’re not used to it, start small, but again, be consistent. You can find some pretty awesome and free workouts on this [website](http://darebee.com).
*Lesson*: "Mens sana in corpore sano". This phrase from a Roman poet simply means “healthy mind in a healthy body”. Once you have the fuel, you can go for miles. The same goes for your mind and happiness. With a healthy body you are able to enjoy everything and do 20x more than you ever thought possible.
**You have your own super power**
At this point if you are implementing even one of these three simple but often overlooked habits in your daily routine, you are ahead of 80% of people who do absolutely nothing to improve themselves and keep complaining about their unhappiness.
Most importantly now you have the ability to “stalk yourself”. You can see what’s wrong, what’s working and understand what you need to change to be happy and fulfilled or if you really want, to find someone else. By going through this process, you will have made sure, the next “someone” you find, is worth the time you invested in yourself.
Remember, it all starts with you. You are the person you need to pay attention to, when you are not at your best.
**One last thing, take responsibility**
Even for the bad things, even if you think you had nothing to do with what happened to you. Take responsibility for it and be willing to course-correct. It’s what gives you confidence and gets you out of the swamps you end up in.
*Ever been in the same situation? What’s your “black hole”?*
EDIT: After the great feedback on this post and my first one, (http://www.reddit.com/r/socialskills/comments/2wn9xc/i_used_to_be_shy_had_very_low_self_confidence_and/), I've decided to creat a website where I'll be writing about mindset and unconventional ways of thinking. It's www.breakoutmindset.com, all free content and no BS :)
| 0non-cybersec
| Reddit | 2,521 | 10,194 |
Subsets and Splits