text
stringlengths 36
35k
| label
class label 2
classes | source
stringclasses 3
values | tokens_length
int64 128
4.1k
| text_length
int64 36
35k
|
---|---|---|---|---|
blackletter1 and yfrak. <p>A follow-up to my earlier <a href="https://tex.stackexchange.com/questions/196728/text-fraktur-at-8pt">question</a>. I have implemented <code>\textfraktone</code> using the <code>blackletter1</code> fonts and the T1 encoding, but I get different results to that from using the <code>\textfrak</code> from the <code>yfonts</code> package: specifically the final "s".
I think <code>\textfraktone</code> is correct (as one should not use a "medial s" at the end of a word), is this a bug in <code>\textfrak</code>? A minimal example:</p>
<pre><code>\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{yfonts}
\newcommand{\textfraktone}[1]{{\fontfamily{yfrak}\selectfont #1}}
\begin{document}
With \verb|\textfrak|: \textfrak{Greis},
with \verb|\textfraktone|: \textfraktone{Greis}.
\end{document}
</code></pre>
| 0non-cybersec
| Stackexchange | 278 | 848 |
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 |
Structuring HSA/Roth/Traditional/Brokerage. I am fortunate enough to have worked up to a point where I'm pretty well through the Prime Directive. But now I have all of these different accounts, all with different advantages and disadvantages; Traditional IRA/401K, Roth 401K/IRA a brokerage account and an emergency savings account. (I included HSA in the title, but don't currently have access to a HDHP to utilize an HSA)
I'm wondering about guidance as to what type of investments should be in each account.
I have cash, short-term treasuries, long-term treasuries, individual stocks, US and International ETFs, REITs and Precious Metals.
Some categories are self-explanatory (cash in my savings account), but should a Roth IRA have different investments than a traditional 401K? What should be in a brokerage as opposed to the Roth? | 0non-cybersec
| Reddit | 204 | 839 |
[Help Request] KitchenAid Ensemble Superba electric dryer - no power. Hi,
I've a KitchenAid Ensemble Electric Dryer (model #YKEHS01PMT2). The last time I tried to turn it on, nothing happened, no lights or anything. I checked the vent outside the house and that was blocked up, so I cleaned it out and still nothing. I read about the thermal fuse blowing in instances like these, so I ordered and replaced the part---again nothing.
I've pulled it away from the wall and checked the plug / outlet. I've a tiny volt sensor, and can detect power going to the machine.
If it helps, I've found a pdf of the internals and "how to's", but I'm not sure what to try next--the webpage for it is here: https://www.scribd.com/document/258939241/4317356-KAL-5-KitchenAid-Ensemble-Front-Loading-Gas-and-Electric-Dryers
Any help / suggestions before I call a repair person would be really helpful, especially since we're expecting our first in just under a month!
Thanks!!
**Edit:** Thanks to the help and suggestions those that posted, I took everything apart, dusted it off, couldn't find anything wrong, put it together, and somehow it worked. I'm cautiously optimistic, but it's lasted for 2 loads so far. Thanks again, all! | 0non-cybersec
| Reddit | 330 | 1,232 |
Linker Double Redirect (IAR EWARM). <p>I have an IAR STM32 project where I am need to wrap a library function with some custom logic. I do not have the ability to recompile the library itself, so what I would like to do is create a function <code>libfunction_shim</code> that calls into the original <code>libfunction</code>. Using the <code>--redirect</code> linker option (<code>--redirect libfunction=libfunction_shim</code>), I can redirect calls to the original function to the shim, including calls inside the library itself. However, I need to call the original function from the shim.</p>
<p>If I add another redirect (<code>--redirect libfunction_original=libfunction</code>), it ends up redirecting <code>libfunction_original</code> to <code>libfunction_shim</code>, rather than the original <code>libfunction</code>. I've tried reordering the redirects, but it does the same thing regardless of order.</p>
<p>The linker log demonstrates this:</p>
<pre><code>Symbol Redirected to Reason
------------- ------ ------
...
libfunction libfunction_shim command line
libfunction_original libfunction_shim command line
</code></pre>
<p>What I would like this:</p>
<pre><code>Symbol Redirected to Reason
------------- ------ ------
...
libfunction libfunction_shim command line
libfunction_original libfunction command line
</code></pre>
<p>Is it possible to do this using the linker?</p>
| 0non-cybersec
| Stackexchange | 391 | 1,604 |
DDD Request Validation Handling. <p>I stuck somewhere that I can't find a solution! There are plenty of validation questions here, but as far as I see, most of them were asking about entity validation. But what about request validation? </p>
<p>I'm developing a service for web application. Basically I have 3 modules which are Web, Domain and Repo. A request for Web project has dependencies to other technologies(JAX-WS auto generated classes) and they are not suitable to be used in domain. So I convert them to new request class to make more suitable for domain service. I also add <strong>defaults()</strong> and <strong>validate()</strong> methods to the new request class. So some part of request validation is handled in <strong>validate()</strong> method. I call them at first line of corresponding method in domain service. So before starting the operation, I know whether request is valid or not. Later on, I have kind-of-validation codes. At this point, I'm not very ensure that which part of the validation truly belongs request validation and which part of it belongs domain service as business logic. I believe every piece of code belongs where it has to be! But sometimes it is hard do decide:D For instance when you need to use repository while you are validating. Let me explain with example.</p>
<p>Let's say you need to do implement a method where customers can be added or deleted from account. Aside null control(validation-phase1), you might check either the customer is valid or not. You need repository. Then you check either account is open or not. You need repository. Boom! Then you do check either customer in request has been already added or you try to delete the customer who doesn't belong to account and so on... May be you think that those situations are not validation, but business logic. I think they are validation, because first, you check customers and account, then do other stuff. What do you think about using repository from validation method, what is your edge for validation? Do you consider above situation I mentioned as a validation? Thanks in advance.</p>
| 0non-cybersec
| Stackexchange | 454 | 2,109 |
Howto: command/tool ability check. <p>When developing a shell script that should run on various unix/linux derivates, i sometimes have the problem that some tools have to be called in a different way compared to other systems. For example if the arguments are different. I wonder what's the best way to solve this.</p>
<p>Should i use <code>uname</code> to check for the operating system name and rely on this to execute the tool in different ways or are there any "better" ways, some kind of "ability" check for shell commands and tools?</p>
<p>The systems in question are for example Linux, Mac OS X, Solaris and Irix -- all quite different when it comes to abilities of tools and shell commands.</p>
| 0non-cybersec
| Stackexchange | 173 | 705 |
How to check if integer value is less or more then 3. <p>We have two values</p>
<pre><code>$a
$b
</code></pre>
<p>we need to compare the $a value with $b value</p>
<p>in case $b value is less than ($a - 3) or more than ($a + 3), then it will print fail.</p>
<p>example:</p>
<pre><code>a=10
b=14
</code></pre>
<p>then it should fail.</p>
<p>For:</p>
<pre><code>a=10
b=11
</code></pre>
<p>then it's ok.</p>
<p>For:</p>
<pre><code>a=23
b=6
</code></pre>
<p>then it should fail.</p>
| 0non-cybersec
| Stackexchange | 221 | 492 |
Creating a ClassLoader to load a JAR file from a byte array. <p>I'm looking to write a custom class loader that will load a <code>JAR</code> file from across a custom network. In the end, all I have to work with is a byte array of the <code>JAR</code> file.<br></p>
<p>I cannot dump the byte array onto the file system and use a <code>URLClassLoader</code>.<br>
My first plan was to create a <code>JarFile</code> object from a stream or byte array, but it only supports a <code>File</code> object.</p>
<p>I've already written up something that uses a <code>JarInputStream</code>:</p>
<pre><code>public class RemoteClassLoader extends ClassLoader {
private final byte[] jarBytes;
public RemoteClassLoader(byte[] jarBytes) {
this.jarBytes = jarBytes;
}
@Override
public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
Class<?> clazz = findLoadedClass(name);
if (clazz == null) {
try {
InputStream in = getResourceAsStream(name.replace('.', '/') + ".class");
ByteArrayOutputStream out = new ByteArrayOutputStream();
StreamUtils.writeTo(in, out);
byte[] bytes = out.toByteArray();
clazz = defineClass(name, bytes, 0, bytes.length);
if (resolve) {
resolveClass(clazz);
}
} catch (Exception e) {
clazz = super.loadClass(name, resolve);
}
}
return clazz;
}
@Override
public URL getResource(String name) {
return null;
}
@Override
public InputStream getResourceAsStream(String name) {
try (JarInputStream jis = new JarInputStream(new ByteArrayInputStream(jarBytes))) {
JarEntry entry;
while ((entry = jis.getNextJarEntry()) != null) {
if (entry.getName().equals(name)) {
return jis;
}
}
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}
</code></pre>
<p>This may work fine for small <code>JAR</code> files, but I tried loading up a <code>2.7MB</code> jar file with almost <code>2000</code> classes and it was taking around <code>160 ms</code> just to iterate through all the entries let alone load the class it found.<br></p>
<p>If anyone knows a solution that's faster than iterating through a <code>JarInputStream</code>'s entries each time a class is loaded, please share!<br></p>
| 0non-cybersec
| Stackexchange | 694 | 2,559 |
Singleton pattern in nodejs - is it needed?. <p>I recently came across <a href="http://simplapi.wordpress.com/2012/05/14/node-js-singleton-structure/" rel="noreferrer">this article</a> on how to write a singleton in Node.js. I know the documentation of <code>require</code> <a href="http://nodejs.org/api/modules.html#modules_loading_from_node_modules_folders" rel="noreferrer">states</a> that:</p>
<blockquote>
<p>Modules are cached after the first time they are loaded. Multiple calls to <code>require('foo')</code> may not cause the module code to be executed multiple times.</p>
</blockquote>
<p>So it seems that every required module can be easily used as a singleton without the singleton boilerplate-code.</p>
<p><strong>Question:</strong></p>
<p>Does the above article provide a round about solution to creating a singleton?</p>
| 0non-cybersec
| Stackexchange | 246 | 843 |
AEAD and nonces explained in layman's terms (Symmetric encryption example using Libsodium). <p>After almost 4 days of work, I've finally gotten <a href="https://download.libsodium.org/doc/" rel="nofollow noreferrer">Libsodium</a> <code>crypto_aead_xchacha20poly1305_ietf_encrypt</code> to work and produce the same result in <a href="https://github.com/jedisct1/libsodium.js" rel="nofollow noreferrer">JavaScript</a> and <a href="https://github.com/jedisct1/libsodium-php" rel="nofollow noreferrer">PHP</a>.</p>
<p>But I'm confused.</p>
<p>The PHPDoc describes the parameters as:</p>
<pre><code>* @param string $plaintext Message to be encrypted
* @param string $assocData Authenticated Associated Data (unencrypted)
* @param string $nonce Number to be used only Once
* @param string $key Encryption key
* @return string
</code></pre>
<p>While JSDoc asks for these parameters:</p>
<pre><code>/**
* @param {string | Uint8Array} message
* @param {string | Uint8Array} additional_data
* @param {string | Uint8Array} secret_nonce
* @param {Uint8Array} public_nonce
* @param {Uint8Array} key
* @param {uint8array} outputFormat
* @returns {Uint8Array}
*/
</code></pre>
<h2>My questions:</h2>
<ol>
<li>It seems like a nonce is a type of salt of a specific size that can only be used once because otherwise replay attacks can happen. Can you help me understand this further? Wikipedia and other sites got too complicated.</li>
<li>To a layman, how would you describe AEAD and how to use the "Authenticated Associated Data (unencrypted)" parameter?</li>
<li>In the PHP function (which I copied from <a href="https://paragonie.com/b/kIqqEWlp3VUOpRD7" rel="nofollow noreferrer">https://paragonie.com/b/kIqqEWlp3VUOpRD7</a>), does using the nonce not just as a nonce but also as the "Authenticated Associated Data" reduce the security compared to some other approach where the sender would add some value here and communicate offline to the receiver what the receiver should expect this value to be?</li>
<li>Why would the JavaScript version accept different parameters? JS asks for a secret_nonce separate from a public_nonce, and in order for the results to match PHP's function, I need to supply identical values for secret_nonce and public_nonce. So what's the point?</li>
</ol>
<hr>
<p>P.S. Here are the functions:</p>
<p>JavaScript: </p>
<pre><code>/**
* @param {string} message
* @param {Uint8Array} key
* @returns {Uint8Array}
*/
function encryptAndPrependNonce(message, key) {
let nonce = sodium.randombytes_buf(nonceBytes);
var encrypted = sodium.crypto_aead_xchacha20poly1305_ietf_encrypt(message, nonce, nonce, nonce, key);
var nonce_and_ciphertext = concatTypedArray(Uint8Array, nonce, encrypted);
return nonce_and_ciphertext;
}
</code></pre>
<p>PHP:</p>
<pre><code>/**
* @link https://paragonie.com/b/kIqqEWlp3VUOpRD7 (from the `simpleEncrypt` function)
* @param string $message
* @param string $keyAsBinary
* @return string
*/
public static function encryptAndPrependNonce($message, $keyAsBinary) {
$nonce = random_bytes(self::NONCE_BYTES); // NONCE = Number to be used ONCE, for each message
$encrypted = ParagonIE_Sodium_Compat::crypto_aead_xchacha20poly1305_ietf_encrypt($message, $nonce, $nonce, $keyAsBinary);
return $nonce . $encrypted;
}
</code></pre>
| 0non-cybersec
| Stackexchange | 1,080 | 3,332 |
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 |
An idempotent operator $P$ is an orthogonal projection iff it is self adjoint. <p>$V$ is a finitte dimension vector space. If for some $P\in End(V)$ we have $P=P^2$ then $P$ is an orthogonal projection $\iff$ $P$ is self-adjoint.</p>
<p>I can show that since $P$ is idempotent then $V=ker(P)\oplus Im(P)$ and $P$ is the projection on its image parallel to its kernel. If $P$ is also self-adjoint I easily get that $ker(P)$ is orthogonal to $Im(P)$ and therefore $P$ is an orthogonal projection. </p>
<p>I'm not quite sure how to proceed in the other direction, thoughts?</p>
<p>Edit - Answer (Thanks to Verdruss)</p>
<p>As shown above $\forall v,v'\in V$ we have a unique decomposition $v=u+w,\ v'=u'+w'$ $\ \ u,u'\in U;\ \ w,w'\in W$ where $U$ and $W$ are orthogonal.</p>
<p>$\left\langle P(v)\mid v'\right\rangle =\left\langle P(u+w)\mid u'+w'\right\rangle =\left\langle u\mid u'+w'\right\rangle =\left\langle u\mid u'\right\rangle +\left\langle u\mid w'\right\rangle =\left\langle u\mid u'\right\rangle $</p>
<p>$\left\langle v\mid P(v')\right\rangle =\left\langle u+w\mid P(u'+w')\right\rangle =\left\langle u+w\mid u'\right\rangle =\left\langle u\mid u'\right\rangle +\left\langle w\mid u'\right\rangle =\left\langle u\mid u'\right\rangle
$</p>
<p>And therefore we can conclude $P$ is self-adjoint</p>
| 0non-cybersec
| Stackexchange | 469 | 1,318 |
How to read a JCR Node's properties BEFORE it's deleted in Adobe Experience Manager?. <p>I need to audit properties of a JCR Node before the OTB deleted workflow physically deletes the node. </p>
<p>AEM provides a few ways to listen to deleted events. I've tried both the EventListener and a ResourceChangeListner. Both scenarios alert my code when a delete is triggered. However, I receive a "does not exist" when performing a session.getNode on the onChange path.</p>
<p>To validate I'm using the correct session/user/etc, I tested that I <strong>AM</strong> able to retrieve the node's parent. So, this proves I have the correct permissions and my listener is being informed after the node is already gone. Also, I have seen this work at least once so this is, obviously, a race condition. Sometimes I am alerted before the node is gone sometimes I am not.</p>
<p>So, how do I <strong><em>guarantee</em></strong> my code will be called <strong>before</strong> the JCR Node is actually gone?</p>
<p>Before you reference <a href="https://stackoverflow.com/questions/32770058">this post</a>, I am applying solutions #2 and #3. Both have the same race condition result. #1 doesn't describe how to tie into the existing OTB AEM 'delete' 'workflow', is that possible?</p>
| 0non-cybersec
| Stackexchange | 342 | 1,281 |
How do I tell when a request is a forward in preHandle using Spring MVC?. <p>I have the following...</p>
<pre><code>@GetMapping("signup")
public String get(){
return "forward:/";
}
@Override
public boolean preHandle(HttpServletRequest request,
HttpServletResponse response,
Object handler) throws IOException {
...
if(!per.isPresent() && !request.getRequestURL().toString().contains("signup")){
response.sendRedirect("/signup");
return false;
}
}
</code></pre>
<p>The problem here is when the forward comes it isn't signup so I redirect back. However, I also want to intercept requests that go directly to the root. </p>
<p>Is there any way to tell if a request is a forward and what the original url was?</p>
| 0non-cybersec
| Stackexchange | 215 | 816 |
Shell Function: Sequence of Pipelines as Argument. <p>I have a shell function (in .bashrc) which creates a temp file, executes the arguments (including all sequence of pipelines), redirects it to a temp file and then open it in VS Code.</p>
<p>I invoke the shell function as</p>
<pre class="lang-bsh prettyprint-override"><code>Temp "ls | nl"
</code></pre>
<p>In the follwoing code, I tried to make it work.
I break the entire string with IFS as a space, store it in an array. Now I want to execute the entire sequence of pipelines and redirect the final stdout to the temp file. How can I achieve this.? I know that for loop won't work here. But I want to print the entire array. </p>
<pre class="lang-bsh prettyprint-override"><code>Temp() {
a="$(mktemp --suffix=.md "/tmp/$1-$(GetFilename "$2")-XXX")"
IFS=' ' read -r -a Array <<< "$1"
nArray=${#Array[@]} # Size of array
for ((i=0; i<nArray; i=i+1)); do
done
#"${@}" > "$a"
code -r "$a"
}
</code></pre>
<hr>
<p>In the interactive terminal session the following works:</p>
<pre class="lang-bsh prettyprint-override"><code>cat <<EOF
$(ls | nl)
EOF
</code></pre>
<p>So, I tried Heredoc, instead of the for loop inside the function</p>
<pre><code>cat > "$a" <<EOF
$($1)
EOF
</code></pre>
<p>But this puts quotes around <code>|</code> and thus fails.</p>
<p>The above would work, if we could remove the quotes somehow.</p>
<hr>
<p>This also doesn't work</p>
<pre class="lang-bsh prettyprint-override"><code>cat > "$a" <<EOF
$(echo $1 | sed "s/'//g")
EOF
</code></pre>
| 0non-cybersec
| Stackexchange | 556 | 1,599 |
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 |
Directing messages to consumers. <p>My client is attempting to send messages to the receiver. However I noticed that the receiver sometimes does not receive all the messages sent by the client thus missing a few messages (not sure where the problem is ? Client or the receiver).
Any suggestions on why that might be happening. This is what I am currently doing</p>
<p>On the receiver side this is what I am doing. </p>
<p>This is the Event Processor</p>
<pre><code> async Task IEventProcessor.ProcessEventsAsync(PartitionContext context, IEnumerable<EventData> messages)
{
foreach (var eventData in messages)
{
var data = Encoding.UTF8.GetString(eventData.Body.Array, eventData.Body.Offset, eventData.Body.Count);
}
}
</code></pre>
<p>This is how the client connects to the event hub</p>
<pre><code>var StrBuilder = new EventHubsConnectionStringBuilder(eventHubConnectionString)
{
EntityPath = eventHubName,
};
this.eventHubClient = EventHubClient.CreateFromConnectionString(StrBuilder.ToString());
</code></pre>
<p>How do I direct my messages to specific consumers</p>
| 0non-cybersec
| Stackexchange | 307 | 1,159 |
Where is lighttpd.conf? Mybook world 2 whitelight webserver. <p>I'm attempting to get my Roku streaming box with a channel called Roksbox to stream content off my MyBook World 2 whitelight. I want a directory listing of a certain folder of a share, Media. It's 2012 and this should be way easier.</p>
<p>I've tried the basic instructions for installing apache here <a href="http://roksbox.com/home/index.php?option=com_content&view=article&id=73&Itemid=73" rel="nofollow noreferrer" title="roksbox site">http://roksbox.com/home/index.php?option=com_content&view=article&id=73&Itemid=73</a>, and seemingly got apache running, but couldn't get past a 403 error. Knowing that the admin app is already running as a webserver I've decided to get away from the apache route.</p>
<p>I've found this article. <a href="http://martin.hinner.info/mybook/lighttpd.php" rel="nofollow noreferrer" title="some dude's site">http://martin.hinner.info/mybook/lighttpd.php</a> The problem is that I don't even see a lighttpd directory in /etc. Is this a hidden directory or file? How can I be sure that lighttpd is what server is actually running?</p>
<p>Any hints are welcome. I can provide more info like firmware and whatnot if necessary.</p>
| 0non-cybersec
| Stackexchange | 382 | 1,258 |
Google Chrome background tabs don't load/build until selected. <p>When browsing, I tend to middle-click things I want to read so they load in a new tab in the background. That way they're ready to read when I finish the current page.</p>
<p>Recently the behavior changed in Google Chrome. Now when I select a background-loaded tab, my disk chugs for a long time instead of switching instantly. It doesn't actually build the background tab until I select it. And it takes longer for it to foreground it than it would have to just load it. (Note, I believe the page was downloaded from the internet, just not "imaged", since the disk chugs like it was paged out and it's not displaying the usual progress in the status bar at the bottom.)</p>
<p>What changed? How do I get the old behavior back?</p>
<p>Google Chrome: 35.0.1916.153 (Official Build 274914) m</p>
<p>OS: Windows </p>
<p>(I've googled for chrome, background tab, lazy load, delayed load, etc... no luck with any search terms after about an hour.)</p>
<p>EDIT: This recently stopped happening on all my computers within a one-week period. It looks to me that it was a change implemented in Chrome, again.</p>
| 0non-cybersec
| Stackexchange | 319 | 1,187 |
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 |
PDF of discrete fourier transform of a sequence of gaussian random variables. <p>I have a set of numbers drawn from iid gaussian random variables:</p>
<p>$P(d_0, ..., d_{N-1}) = (\sigma \sqrt{2 \pi})^{-N} exp\left(\frac{-1}{2\sigma^2} (d_0^2 + ... + d_{N-1}^2)\right)$</p>
<p>What is the pdf for the discrete fourier transform $f_0, ... f_{N-1}$ of the $d_k$?</p>
<p>It seems like this should be a fairly strightforward calculation but I'm getting bogged down. One thing that seems to make it tricky is the periodicity property of the $f_k$ means that you need to choose N particular real numbers to work with. I'd actually be happy with an answer that marginalizes over the phase angles, but a full answer would be great.</p>
<p>Is there a good text that addresses this type of question?</p>
| 0non-cybersec
| Stackexchange | 247 | 797 |
PHP: is it possible to jump from one case to another inside a switch?. <p>I have a switch where in very rare occasions I might need to jump to another case, I am looking for something like these:</p>
<pre><code>switch($var){
case: 'a'
if($otherVar != 0){ // Any conditional, it is irrelevant
//Go to case y;
}else{
//case a
}
break;
case 'b':
//case b code
break;
case 'c':
if($otherVar2 != 0){ // Any conditional, it is irrelevant
//Go to case y;
}else{
//case c
}
break;
.
.
.
case 'x':
//case x code
break;
case 'y':
//case y code
break;
default:
// more code
break;
}
</code></pre>
<p>Is there any GOTO option, I red somewhere about it but can't find it, or maybe another solution? Thanks.</p>
| 0non-cybersec
| Stackexchange | 265 | 795 |
kde5: Note widget disappeared. How can I get it back?. <p>My computer freezed and after a restart, all my notes are gone. The notes are still in the folder <code>/.local/share/plasma_notes</code></p>
<p>When I try to add a new widget, I don't find the note widget in the widget panel anymore. Where is it gone? And how can I get it back?</p>
<p>For example: I can't find the note widget in this panel widget anymore.
<a href="https://i.stack.imgur.com/h972m.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/h972m.png" alt="enter image description here"></a></p>
| 0non-cybersec
| Stackexchange | 187 | 582 |
TIFU By surprising her in the shower.. This didn't actually happen today but a little while ago while we still lived in our apartment.
My girlfriend was in the shower and I decided it would be a good idea to sneak into the bathroom and peek around the curtain and surprise her a little. I grabbed the shower curtain while she was facing away and wrapped it around myself in such a way that only my head was showing and I put on a ridiculous grin.
As it turns out my GF has a legit fear of being murdered in the shower. When she turned around as I was trying my best not to giggle like a little girl, she let just stared at me like this O_O for a FULL second before she let out the most earth shattering scream I have ever heard in my life. This was my "oh shit" moment and I started to pull back away from the curtain, but not before she unleashed the fist of fucking god on me. She let loose a right hook that went through the shower curtain and ripped it off the hooks and hit me right in the face. Turns out she is strong enough to give me a black eye when she feels her life is in danger. That was fun to explain to my *all male* workplace that my GF beat the shit out of me in one hit.
**Tl;dr**: GF thought I was a murderer and gave me a black eye.
**Edit:** A few people have asked what happened afterwards and I'm afraid its nothing too exciting. So after I got bopped in the face she immediately started to cry and I can't blame her. I don't think she realized how hard she had managed to hit me at first as I was kind of ignoring it desperately apologizing to her. Nothing feels worse than when you legit scare the fuck out of your SO and it ends badly. After the tears were wiped away we both had a good laugh about hard she managed to hit me. I think she was even proud of herself.
**Edit 2:** [Link to /u/BlessingOfChaos' story](http://www.reddit.com/r/tifu/comments/279tsk/tifu_by_punching_my_girlfriend_whilst_in_the/) | 0non-cybersec
| Reddit | 477 | 1,940 |
ONEIROMANCY- PATIENT RECORD MP1913330.
__________
**PATIENT NAME:** Madison, Patricia
**AGE:** 28
**TEST RESULTS:** [Oneiromancy](https://imgur.com/a/sxss31a), aka divination by means of dreams
__________
*The following dream journal was procured by Agent Watkins on April 3, it has been transcripted and modified from its original format to protect the parties connected to Incident 19 as cataloged in journal 13.*
*March 3*
I’ve started having those dreams again. The ones about my sister. My therapist Doctor Rudy says that I need to keep track of what happens in the dreams because it could help me cope with her departure. I don’t see how having to relive an imaginary trauma over and over again is going to help me, but it’s whatever. I hate this stupid project this stupid magenta folder and these stupid dreams. The sooner I can get done with therapy and move on with my life, the better.
The dream is always the same really, I see Brittany standing on a beach. I think she might be in Norway? It looks so peaceful, not like any of the trashy beaches we have here. She is standing in a white satin dress and staring toward the ocean and the moon. At first the dream is quiet, even the lapping of the waves can’t be heard. But then she starts to whistle. And the waves mimic her tune.
The tune she whistles was something I couldn’t quite place at first, but after a few times hearing it I think it’s telling me that it’s a funeral march. Given what happens next in the dream, I know that it’s likely a correct assumption.
The stars begin to glow, and then they swirl. They are moving toward the ocean almost like streaks of light. Each one of them going out and surrounding Britt with darkness.
This is the part that always scares me, when my sister turns around and stares at me with wide empty eyes. Hordes of tentacles pour out of her mouth and show me a beastly monster pushing out of her intestines.
My therapist tells me that these are all manifestations of my anxiety involved since she has left. But this doesn’t ever feel like that. It feels like a cold and distant throbbing pain, like the kind you might get when you lose a limb.
I think that’s enough for today. This is bull shit. All this is doing is scaring me and I need to call Britt to make sure she is ok.
*March 10*
A whole week passed without the dreams. I think talking to Britt helped. But now I’ve had a lot of restless nights. Like I can’t sleep at all. It’s starting to mess with my mind. I keep seeing things that aren’t there. Strange shadows that linger in my house or whispers from an air vent.
Doctor Rudy wants me to get on sleeping pills. He says that it won’t make the dreams come back, just help me to resume a healthy sleep cycle. But I think being asleep is more frightening. I can survive on power naps. And the shadows are just shadows, can’t hurt me.
*March 14*
I think someone broke into my house last night and drugged me. I had almost 10 hours worth of sleep and I can’t explain it. I’ve been taking 5 hour energy drinks to keep myself awake and even some herbal stuff designed to give me a boost. I just can’t sleep. Every time I do the dreams get more vivid. This time it was worse than ever before and it seemed like I could feel everything the monster was doing to Britt. It was coming from the stars that fell in the ocean. It’s trapped her and for the entire Dream it attacked her and played with her body the way a cat would a ball of yarn.
It was Scratching open Britt’s body and trying to… I think infect her with itself? Impregnate maybe? It released this strange black substance into her screaming mouth that looked like little chocolate eggs like the kind you get at Easter.
I tried to wake up and stop it from happening but I felt like I had fallen into a deep hole and I couldn’t claw out. I kept screaming for Britt to fight back and slashing aimlessly into the air to fight off this monster, but it didn’t do any good. I was paralyzed and frozen with fear. I couldn’t get away until the dream let me. It felt like coming up for air from drowning.
I don’t have any proof that I was drugged but I have taken heavy meds before. Once tried to OD because of these stupid dreams and it felt like this numbing blackness that covered everything.
This was the exact same sensation. In fact it felt ten times worse. Just an endless feeling of being strangled.
*March 20*
Doctor Rudy has scheduled a sleep study for me in a week. The dreams have gotten worse and I keep sleeping for longer and longer periods of time.
I told him my suspicions of someone drugging me but he insisted that there would be no reason for any individual or organization to attempt to induce these nightmares.
“They are just Dreams after all,” he told me. I didn’t like how he was making my concerns seem insignificant so I decided to install some security cameras in my house. Maybe I’m wrong about everything and it so then the cameras can give me peace of mind.
*March 25*
I’m writing this here as evidence against Doctor Rudy and his staff. I installed the cameras discovered that they are the ones drugging me. The footage shows they would use my porch sliding door to sneak in my house and dose my water while I’m at work.
I think they want these dreams to keep happening. And now I’m in the hospital about to undergo the sleep study Rudy scheduled. I don’t think I can trust anyone here. The guards are watching all the exits and the stuff that the staff is giving me just makes me feel paranoid. Fuck. I probably sound like a crazy person.
Listen to me though. You have to! When you get this journal you have to check those tapes cause I think I saw something else in them too. Something deadly.
When I fall asleep and I experienced the dreams about Brittany, there is this… I guess you could call it presence. It’s inside my house. Like a mist. Glowing and red and causing all sorts of chaos. At first I thought it was a ghost but I don’t think that’s true anymore. This is something far more evil and ancient. And it feels directly connected to the creatures I saw rising from the beach.
I hope you can make sense of all this Brittany cause I get the feeling that I will not be around much longer to do so.
________
*external notes by Doctor Rudy Watkins*
*Subject MP1913330 exhibited signs of being aware of Paths for approximately 33% of the test. As a result we were able to determine that subject was actually forming a mental connection to the entity we detected.*
*During the study, we were contacted by Agents 7 and 18 who were monitoring the subject's sister in Norway, who informed us that something strange was occurring near their location. About one hour into the REM sleep of the subject, a creature was spotted rising from the waves near their location. The creature proceeded to mutilate the subject’s sister in the exact same manner that she has described in her journals. Adjusted Path awareness to 57%.*
*in an attempt to capture the creature, it was decided upon to keep the subject sedated. It has been determined that as long as the subject is in REM sleep, the creature remains in our dimension. Proper arrangements have been made to inform family that the subject was terminated.*
*journal entries have been [archived](https://www.reddit.com/r/TheSkinnerFoundation) for further analysis*
[330](https://www.reddit.com/r/KyleHarrisonwrites/?utm_source=share&utm_medium=ios_app) | 0non-cybersec
| Reddit | 1,783 | 7,460 |
Multi User login authentication | React Redux. <p>I have an application with multi user login functionality. Now, I created the redux store for the login function. If User logged in, based on their type, it will redirect to the particular dashboard. If student user logged in, he should be able to only access student dashboard, he should not able to access other dashboards. Same applies for others. But, now, if any user logged in, they can able to access other user dashboards. How can i prevent them to use only their dashboards. </p>
<p>Updated With Proper Code</p>
<pre><code>/***AppRouter***/
import React, {Component} from 'react';
import { BrowserRouter, Route, Switch } from 'react-router-dom';
import StuDashboard from '../views/ed/dashboard/Dashboard.js';
import AdminDashboard from '../views/biz/dashboard/Dashboard.js';
import OrgDashboard from '../views/org/dashboard/Dashboard.js';
import SupAdDashboard from '../views/me/dashboard/Dashboard.js';
import UserLogin from '../views/loginUser/Login.js';
import history from '../history/history.js';
import { PrivateRoute } from './PrivateRoute.js';
import NotFoundPage from '../views/NotFoundPage.js';
import Authorization from './Authorization';
class AppRouter extends Component {
render () {
return(
<BrowserRouter history={history}>
<Switch>
<Route path="/" component={Landing} exact />
<Route path="/confirmation" component={EmailCon}/>
<PrivateRoute path="/student/dashboard" component={Authorization(StuDashboard),["Student"]}/>
<PrivateRoute path="/admin/dashboard" component={Authorization(AdminDashboard),["Admin"}/>
<PrivateRoute path="/org/dashboard" component={Authorization(OrgDashboard),["Org"]}/>
<PrivateRoute path="/SuperAdmin/dashboard" component={Authorization(SupAdDashboard),["SuperAdmin"]}/>
<Route path="/login" component={UserLogin}/>
<Route path="" component={NotFoundPage} />
</Switch>
</BrowserRouter>
);
}
}
export default AppRouter;
/***PrivateRoute***/
import React from 'react';
import { Route, Redirect } from 'react-router-dom';
export const PrivateRoute = ({ component: Component, ...rest }) => (
<Route {...rest} render={props => (
localStorage.getItem('token')
? <Component {...props} />
: <Redirect to={{ pathname: '/login', state: { from: props.location } }} />
)} />
)
/***Authorization***/
import React, { Component } from 'react';
import { connect } from "react-redux";
const Authorization = (WrappedComponent, allowedRoles) =>{
class WithAuthorization extends Component {
render() {
const userType = this.props.user
if (allowedRoles.includes(userType)) {
return <WrappedComponent {...this.props} />
} else {
return <h1>You are not allowed to view this page!</h1>
}
}
}
const mapStateToProps = state => ({ user: state.login.userName, userType: state.login.userType })
return connect(mapStateToProps)(WithAuthorization);
}
export default Authorization;
/***Action.js***/
import axios from "axios";
import { LOGIN_PENDING, LOGIN_COMPLETED, LOGIN_ERROR, LOGOUT } from "./types";
import ApiUrl from "../../constants/ApiUrl.js";
import qs from "qs";
import history from '../../history/history.js';
const startLogin = () => {
return {
type: LOGIN_PENDING
};
};
const loginComplete = data => ({
type: LOGIN_COMPLETED,
data
});
const loginError = err => ({
type: LOGIN_ERROR,
err
});
export const loginUser = (email, password) => {
return dispatch => {
dispatch(startLogin());
let headers = {
"Content-Type": "application/x-www-form-urlencoded"
};
const data = qs.stringify({
grant_type: "password",
username: email,
password: password,
});
axios
.post(`${ApiUrl}/Token`, data, {
headers: headers
})
.then(function (resp) {
dispatch(loginComplete(resp.data));
localStorage.setItem("token", resp.data.access_token);
switch (resp.data.userType) {
case 'Admin': {
history.push('/admin/dashboard');
break;
}
case 'Student': {
history.push('/student/dashboard');
break;
}
case 'Organization': {
history.push('/org/dashboard');
break;
}
case 'SuperAdmin': {
history.push('/SuperAdmin/dashboard');
break;
}
default:
history.push('/');
}
window.location.reload();
return;
})
.catch(err => dispatch(loginError(err)));
};
};
export const logOut = () => {
localStorage.clear();
return {
type: LOGOUT,
};
}
</code></pre>
| 0non-cybersec
| Stackexchange | 1,481 | 5,030 |
Why is fzf failing in this case. <p>I've found <a href="https://github.com/junegunn/fzf" rel="nofollow noreferrer"><code>fzf</code></a> to be a very useful utility, but for some reason it is failing me in this one particular instance.</p>
<pre><code>$ brew outdated | fzf -m --tac | brew upgrade
</code></pre>
<p>Instead of letting me choose which items to upgrade, it displays a menu for a moment, and then proceeds to upgrade <em>everything</em>. I've never had it behave this way before. What am I overlooking?</p>
| 0non-cybersec
| Stackexchange | 162 | 522 |
cygwin basic command trouble. <p>I'm using Cygwin to simulate Linux environment on my Windows 7 machine for learning some basic commands and functions. Right now, I am just practicing moving through directories and different file pathways I've created. I have read that I can move backward (or upward) in my file path by typing <code>cd . .</code>, but this is not working. For example, my pwd: <code>/home/temp/stuff/things</code>, but when I type in <code>cd . .</code> on the next command it reads the same pwd. Am I doing something wrong or am I misunderstanding the <code>cd . .</code> command?</p>
| 0non-cybersec
| Stackexchange | 156 | 604 |
Customize Chrome auto-completion in address bar?. <p>is there a way to customize Chrome's auto-completion? For instance it doesn't show past urls correctly:</p>
<p>Here some examples of very often visited urls:</p>
<ol>
<li><p>it shows visited url thepiratebay.se/browse/201/0/9/0 for sequence '201' but its not showing thepiratebay.am/browse/201/0/9/0</p></li>
<li><p>it shows foo.com/A/B for sequence 'foo' but it doesn't show foo.com:4000/something else. It also doesn't offer it for the sequence '4000'</p></li>
</ol>
<p>That are just a few examples but its obvious to me that something is wrong. </p>
<p>I guess I have to tweak the sources of Chromium, right. Because I can't find in the settings. To no surprise, Firefox doesn't have problems with this at all.</p>
<p>well, thank you for any hint!
g</p>
| 0non-cybersec
| Stackexchange | 262 | 815 |
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 |
classifying map of associated bundles. <p>Let $G\leq GL(\mathbb{R}^n)$ be a group and $\xi$ be a principal $G$-bundle over a space $X$. </p>
<p>Let $\eta=\xi[\mathbb{R}^n]$ be the associated vector bundle of $\xi$.</p>
<p>Let $f_\xi: X\to BG$ be the classifying map of $\xi$. </p>
<p>Let $f_\eta:X\to G_n(\mathbb{R}^\infty)$ be the classifying map of $\eta$. </p>
<p>Let $i_*: BG\to G_n(\mathbb{R}^\infty)$ the induced map by inclusion $i:G\to GL(\mathbb{R}^n)$.</p>
<p>Are $i_*\circ f_\xi\simeq f_\eta$ homotopy equivalent?</p>
| 0non-cybersec
| Stackexchange | 213 | 536 |
$\lim\limits_{t\rightarrow\infty}\int\limits_{E}\phi(x+t)dx=0$. <p>Suppose <span class="math-container">$E\subset\mathbb{R}$</span> has finite Lebesgue measure and <span class="math-container">$\varphi\in L^1(\mathbb{R})$</span>. Show that <span class="math-container">$\lim\limits_{t\rightarrow\infty}\int\limits_{E}\varphi(x+t)dx=0$</span>.</p>
<p>I guess first I have to show <span class="math-container">$\lim\limits_{t\rightarrow\infty}\varphi(x+t)=0$</span> for <span class="math-container">$x\in\mathbb{R}$</span> and use the Lebesgue Dominated Convergence Theorem but I am not sure.</p>
| 0non-cybersec
| Stackexchange | 209 | 596 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
Is "constexpr if" better than switch statement?. <p>C++17 introduces "constexpr if" that is instantiated depending on a compile-time condition.</p>
<p>Does it mean that it's better to use "constexpr if" in template functions rather than switch statement?</p>
<p>For example:</p>
<pre><code>template<int val> void func()
{
if constexpr(val == 0) {} else
if constexpr(val == 1) {} else
...
if constexpr(val == k) {} else {}
}
// vs
template<int val> void func()
{
switch (val)
{
case 0:
break;
case 1:
break;
...
case k:
break;
default:
break;
}
}
</code></pre>
| 0non-cybersec
| Stackexchange | 220 | 701 |
why dataset.output_shapes returns demension(none) after batching. <p>I'm using the Dataset API for input pipelines in TensorFlow (version: r1.2). I built my dataset and batched it with a batch size of 128. The dataset fed into the RNN.</p>
<p>Unfortunately, the <em><code>dataset.output_shape</code></em> returns dimension(none) in the first dimension, so the RNN raises an error:</p>
<pre><code>Traceback (most recent call last):
File "untitled1.py", line 188, in <module>
tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
File "/home/harold/anaconda2/envs/tensorflow_py2.7/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "untitled1.py", line 121, in main
run_training()
File "untitled1.py", line 57, in run_training
is_training=True)
File "/home/harold/huawei/ConvLSTM/ConvLSTM.py", line 216, in inference
initial_state=initial_state)
File "/home/harold/anaconda2/envs/tensorflow_py2.7/lib/python2.7/site-packages/tensorflow/python/ops/rnn.py", line 566, in dynamic_rnn
dtype=dtype)
File "/home/harold/anaconda2/envs/tensorflow_py2.7/lib/python2.7/site-packages/tensorflow/python/ops/rnn.py", line 636, in _dynamic_rnn_loop
"Input size (depth of inputs) must be accessible via shape inference,"
ValueError: Input size (depth of inputs) must be accessible via shape inference, but saw value None.
</code></pre>
<p>I think this error is caused by the shape of input, the first dimension should be batch size but not none. </p>
<p>here is the code:</p>
<pre><code>origin_dataset = Dataset.BetweenS_Dataset(FLAGS.data_path)
train_dataset = origin_dataset.train_dataset
test_dataset = origin_dataset.test_dataset
shuffle_train_dataset = train_dataset.shuffle(buffer_size=10000)
shuffle_batch_train_dataset = shuffle_train_dataset.batch(128)
batch_test_dataset = test_dataset.batch(FLAGS.batch_size)
iterator = tf.contrib.data.Iterator.from_structure(
shuffle_batch_train_dataset.output_types,
shuffle_batch_train_dataset.output_shapes)
(images, labels) = iterator.get_next()
training_init_op = iterator.make_initializer(shuffle_batch_train_dataset)
test_init_op = iterator.make_initializer(batch_test_dataset)
print(shuffle_batch_train_dataset.output_shapes)
</code></pre>
<p>I print <code>output_shapes</code> and it gives:</p>
<pre><code>(TensorShape([Dimension(None), Dimension(36), Dimension(100)]), TensorShape([Dimension(None)]))
</code></pre>
<p>I suppose that it should be 128, because I have batched dataset:</p>
<pre><code>(TensorShape([Dimension(128), Dimension(36), Dimension(100)]), TensorShape([Dimension(128)]))
</code></pre>
| 0non-cybersec
| Stackexchange | 912 | 2,745 |
Windows 8 isn't available for download. <p>Just downloaded the <code>Windows 8 Upgrade Assistant</code> and only got the following message:</p>
<p>"Windows 8 isn't available for download", "Sorry, Windows 8 isn't available for online purchase in the country/region you're in."</p>
<p>I which region is then a download available?</p>
<p><img src="https://i.stack.imgur.com/2KuX1.jpg" alt="enter image description here"></p>
| 0non-cybersec
| Stackexchange | 128 | 430 |
getchar/putchar returns boxes with question marks when printing inputted characters. <p>Playing around with code examples from K&R in Codeblocks on Windows 10 (Danish language). The following example works as expected:</p>
<pre><code>#include <stdio.h>
int main() {
char c = 'a';
putchar(c);
}
</code></pre>
<p>However, the following prints a series of boxes with question marks, the same number as the number of characters I type:</p>
<pre><code>#include <stdio.h>
int main() {
char c;
while (c = getchar() != '\n') {
putchar(c);
}
}
</code></pre>
<p>So it looks like an encoding issue. When run, a command prompt opens with "C:\Users\username\Desktop\filename.exe" in the header, and my username contains the Danish character "å" which is replaced by a "Õ". The command prompt uses the CP 850 character set.</p>
<p>(By the way, I'm not checking if the character equals <code>EOF</code>, since that produces odd results. Pressing enter prints the expected number of boxes, plus one for <code>\n</code>, but it doesn't end the program.)</p>
| 0non-cybersec
| Stackexchange | 322 | 1,093 |
mod_rewrite and VirtualHosts: how to redirect 1 site, but keep the others?. <p>I host 4 virtual hosts at a dedicated CentOS 5.6 server:</p>
<pre><code># rpm -qa|grep http
httpd-2.2.3-45.el5.centos.1
</code></pre>
<p>One of them is my Drupal 7.2 site and another was holding static texts and fotos belonging to my wife - here is the excerpt from httpd.conf:</p>
<pre><code><VirtualHost 85.214.19.116:80>
DocumentRoot /var/www/html/preferans.de
ServerName preferans.de
ServerAlias preferans.de *.preferans.de
ErrorLog logs/preferans.de/error_log
CustomLog logs/preferans.de/access_log common
<IfModule mod_rewrite.c>
<Directory "/var/www/html/preferans.de">
RewriteEngine on
# needed by Drupal 7 for "clean URLs"
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]
</Directory>
</IfModule>
</VirtualHost>
<VirtualHost 85.214.19.116:80>
DocumentRoot /var/www/html/larissa-farber.de
ServerName larissa-farber.de
ServerAlias larissa-farber.de *.larissa-farber.de
ErrorLog logs/larissa-farber.de/error_log
CustomLog logs/larissa-farber.de/access_log common
</VirtualHost>
</code></pre>
<p>Now my wife has decided to move her files to Tumblr blog service.</p>
<p>As a quick measure I've put the following index.php into her dir:</p>
<pre><code># cat /var/www/html/larissa-farber.de/index.php
<?php
header('Location: http://larissa-farber.tumblr.com/');
?>
</code></pre>
<p>This works ok, but I'd rather use the mod_rewrite to do the redirect (that is - until I figure out how to transfer her web address to Tumblr completely, which should be possible too).</p>
<p>From reading the docs I understand, that I need something like:</p>
<pre><code>RewriteRule ^(.*)$ http://larissa-farber.tumblr.com/$1 [R=301,L]
</code></pre>
<p>But where to put it and how to keep my other 3 virtual sites working?</p>
<p>Thank you!
Alex</p>
<p>(This is not a promotion of any of the sites above, I'm just too lazy to use fake addresses here and don't see a reason for that).</p>
| 0non-cybersec
| Stackexchange | 766 | 2,247 |
Run Java in Firefox on Linux. <p>It is my first time using Linux. What I would like is to run an app called SiteScope that requires Java.</p>
<p>I have already installed Java on my Linux, however when I open the browser I still get the message "A plugin is needed to display this content".</p>
<p>Any help to make it work, using the Oracle JRE (not OpenJDK's Iced Tea), will be appreciated.</p>
<p><a href="https://i.stack.imgur.com/LD9ui.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LD9ui.png" alt="enter image description here"></a></p>
| 0non-cybersec
| Stackexchange | 174 | 564 |
Toshiba satellite can't boot. <p>I've a Toshiba satellite laptop and I tried to get Ubuntu along with the windows. There was a black out after the Ubuntu installation was complete so I forced off my laptop but when I restarted, dual boot was working and I chose Ubuntu, but my touchpad didn't work properly, so I went to windows, deleted Ubuntu partition and started afresh. </p>
<p>But this time Ubuntu installation couldn't be completed as it said there was some problem with GRUB. So I went back to windows, tried to repair the boot problems with easy BCD there I learned it was in EFI mode, so I went back to boot menu, changed it to CSM and when I saved the settings and exit, my laptop wouldn't restart.The only thing I see is a black screen (power on), not even the Toshiba logo, no keys working and it wont boot from an Ubuntu pendrive either. </p>
<p>What is happening?</p>
| 0non-cybersec
| Stackexchange | 227 | 889 |
Is there a C project Default Directory Layout?. <p>I've always wanted to know if there is a default directory layout for C projects. You know, which folders should i put which files and such.</p>
<p>So I've downloaded lots of project's source codes on <a href="http://sourceforge.net/" rel="noreferrer">SourceForge</a> and they were all different than each other.
Generally, I found more or less this structure:</p>
<pre><code> /project (root project folder, has project name)
|
|____/bin (the final executable file)
|
|
|____/doc (project documentation)
| |
| |____/html (documentation on html)
| |
| |____/latex (documentation on latex)
|
|
|____/src (every source file, .c and .c)
| |
| |____/test (unit testing files)
|
|
|____/obj (where the generated .o files will be)
|
|
|____/lib (any library dependences)
|
|
|____BUGS (known bugs)
|
|____ChangeLog (list of changes and such)
|
|____COPYING (project license and warranty info)
|
|____Doxyfile (Doxygen instructions file)
|
|____INSTALL (install instructions)
| |
|____Makefile (make instructions file)
|
|____README (general readme of the project)
|
|____TODO (todo list)
</code></pre>
<p>Is there a default standard somewhere?</p>
<p>Edit: Sorry, really. I realised there are numerous similar questions for recommended C project directory files. But I've seen people say what they think is best. I'm looking for a standard, something that people usually follow.</p>
<p>Related Questions:</p>
<p><a href="https://stackoverflow.com/questions/2410243/c-starting-a-big-project-file-directory-structure-and-names-good-example-req">C - Starting a big project. File/Directory structure and names. Good example required</a></p>
<p><a href="https://stackoverflow.com/questions/1451086/folder-structure-for-a-c-project">Folder structure for a C project</a></p>
<p><a href="https://stackoverflow.com/questions/2407668/file-and-folder-structure-of-a-app-project-based-in-c">File and Folder structure of a App/Project based in C</a></p>
<p><a href="https://stackoverflow.com/questions/742391/project-organization-in-c-best-practices">Project Organization in C Best Practices</a></p>
| 0non-cybersec
| Stackexchange | 719 | 2,396 |
After editing and saving gedit(29705), I get warnings. alerts below. <p>** (gedit: 30499): WARNING **: 17: 09: 35.099: Document metadata could not be set: Attribute metadata :: gedit-spell-language assignment not supported</p>
<p>** (gedit: 30499): WARNING **: 17: 09: 35.099: Setting document metadata failed: Attribute metadata :: gedit-encoding assignment not supported</p>
<p>** (gedit: 30499): WARNING **: 17: 09: 39.106: Setting document metadata failed: Attribute metadata :: gedit-position assignment not supported</p>
| 0non-cybersec
| Stackexchange | 152 | 529 |
Why tuples are not enumerable in Elixir?. <p>I need an efficient structure for array of thousands of elements of the same type with ability to do random access.</p>
<p>While list is most efficient on iteration and prepending, it is too slow on random access, so it does not fit my needs.</p>
<p>Map works better. Howerver it causes some overheads because it is intended for key-value pairs where key may be anything, while I need an array with indexes from 0 to N. As a result my app worked too slow with maps. I think this is not acceptable overhead for such a simple task like handling ordered lists with random access.</p>
<p>I've found that tuple is most efficient structure in Elixir for my task. When comparing to map on my machine it is faster</p>
<ol>
<li>on iteration - 1.02x for 1_000, 1.13x for 1_000_000 elements</li>
<li>on random access - 1.68x for 1_000, 2.48x for 1_000_000</li>
<li>and on copying - 2.82x for 1_000, 6.37x for 1_000_000.</li>
</ol>
<p>As a result, my code on tuples is 5x faster than the same code on maps. It probably does not need explanation why tuple is more efficient than map. The goal is achieved, but everybody tells "don't use tuples for a list of similar elements", and nobody can explain this rule (example of such cases <a href="https://stackoverflow.com/a/31193180/5796559">https://stackoverflow.com/a/31193180/5796559</a>).</p>
<p>Btw, there are tuples in Python. They are also immutable, but still iterable.</p>
<p>So,</p>
<p><strong>1. Why</strong> tuples are not enumerable in Elixir? Is there any technical or logical limitation?</p>
<p><strong>2.</strong> And <strong>why</strong> should not I use them as lists of similar elements? Is there any downsides?</p>
<p><strong>Please note:</strong> the questions is "why", not "how". The explanation above is just an example where tuples works better than lists and maps.</p>
| 0non-cybersec
| Stackexchange | 557 | 1,884 |
Is this proof for $(\mathbb{Z},+) \ncong (\mathbb{Q},+)$ valid?. <p>In an introductory cryptography course, our teacher demonstrated a proof for $(\mathbb{Z},+) \ncong (\mathbb{Q},+)$. I'm not convinced, even though the statement may be correct (I don't know).</p>
<p>Earlier in the course, we had seen the isomorphism of the Klein-4 group as $(\{0,1\}^2,+)$ and the 2D symmetry group of a rectangle not being a square (using identity, vertical reflection, horizontal reflection and 180 degree rotation). </p>
<p>Now, our teacher made a list of different equations and whether or not they could be solved in the sets $\mathbb{Z}^+, \mathbb{Z}, \mathbb{Q}$ and $\mathbb{R}$. This to show that some equations can be solved in certain sets but not in others (like $x=3$ being solvable in all four sets, but $3x=5$ only in the latter two and $x^2=-1$ in none of the considered sets). </p>
<p>Then, she stated that if we have some equation using an operation $\odot$ that is solvable in $A$ but not in $B$, then $(A,\odot) \ncong (B,\odot)$ (supposing of course that $(A,\odot)$ and $(B,\odot)$ are groups). This already is a rather vague description, isn't it? </p>
<p>She then proposed the equation $x+x=3$ which is solvable in $\mathbb{Q}$ but not in $\mathbb{Z}$. While that is obviously correct, I'm not sure if this argument is sound and if it actually proves the two groups not being isomorph.</p>
<p>I have difficulties to express my concerns. Somehow, I would expect the constant $3$ in that equation to be some number from the particular set instead of some constant. I'm not convinced by the argument because if we'd map all odd numbers from $\mathbb{Q}$ to even numbers in $\mathbb{Z}$, the equation would in fact be solvable in $\mathbb{Z}$. </p>
<p>What I'd like to know is:</p>
<ul>
<li>Is the proof given by my teacher valid (and why)?</li>
<li>If not, are these groups still isomorph (out of curiosity)?</li>
</ul>
| 0non-cybersec
| Stackexchange | 548 | 1,934 |
Why 'continue' doesn't work within an angular foreach?. <p>I have an angular app as the following and I have a angular.forEach function where I want to skip some values with the <code>continue</code> keyword but I can't.</p>
<pre><code><div ng-app="app">
<div ng-controller="test">
test
{{printPairs()}}
</div>
</div>
angular.module("app", [])
.controller("test", function($scope){
var array = [1,2,3,4,5,6];
$scope.printPairs = function(){
angular.forEach(array, function (elem) {
if(elem % 2 === 1){
continue;
}
//More logic below...
})
};
});
</code></pre>
<p>Someone knows why is this happening?</p>
| 0non-cybersec
| Stackexchange | 245 | 784 |
Problem downloading Oracle JDK 7. <p>I'm using Ubuntu 12.04 LTS. I'm trying to install Oracle JDK 7. When I tried to directly download the jdk-7u51-linux-x64.tar.gz from the official website, the download started and after downloading couple of MBs it stopped (you can try it as well, worked the same way for a friend).
Using a guide.</p>
<p>led me to </p>
<pre><code>Oracle JDK 7 is NOT installed.
dpkg: error processing oracle-java7-installer (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
oracle-java7-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)
</code></pre>
<p>which is normal, as it is downloading from the same link. Exact report <a href="http://postimg.org/image/gdbym90bf/" rel="nofollow">here</a></p>
<p>I tried to download and install the .rpm file. I converted it to deb and installed it. It appears as installed in the Software center, but could not find it via terminal (java -version returns suggestions for installing packages). Image from the Software center <a href="http://postimg.org/image/780kh9lq3/" rel="nofollow">here</a></p>
<p>I tried everything here.</p>
<p>and could not find anything on the internet. </p>
| 0non-cybersec
| Stackexchange | 363 | 1,250 |
How to add Text for some duration of video in iOS SDK. <p>I have video having duration 4:00. Now I want to add text in video file as per the frames of video. Say for example from 00:30 to 1:50 duration I want to add text "Welcome". Now from 3:00 to 4:00 duration of video I want to add text "Awesome". How to achieve this functionality. I have referred below tutorial. It adds text in whole video not for some duration of video.
<a href="https://www.raywenderlich.com/30200/avfoundation-tutorial-adding-overlays-and-animations-to-videos" rel="noreferrer">https://www.raywenderlich.com/30200/avfoundation-tutorial-adding-overlays-and-animations-to-videos</a></p>
<p>Any help will be appriciated.</p>
<p>I am adding lines of code for add text on whole video:</p>
<pre><code>- (void)applyVideoEffectsToComposition:(AVMutableVideoComposition *)composition size:(CGSize)size
{
// 1 - Set up the text layer
CATextLayer *subtitle1Text = [[CATextLayer alloc] init];
[subtitle1Text setFont:@"Helvetica-Bold"];
[subtitle1Text setFontSize:36];
[subtitle1Text setFrame:CGRectMake(0, 0, size.width, 100)];
[subtitle1Text setString:_subTitle1.text];
[subtitle1Text setAlignmentMode:kCAAlignmentCenter];
[subtitle1Text setForegroundColor:[[UIColor whiteColor] CGColor]];
// 2 - The usual overlay
CALayer *overlayLayer = [CALayer layer];
[overlayLayer addSublayer:subtitle1Text];
overlayLayer.frame = CGRectMake(0, 0, size.width, size.height);
[overlayLayer setMasksToBounds:YES];
CALayer *parentLayer = [CALayer layer];
CALayer *videoLayer = [CALayer layer];
parentLayer.frame = CGRectMake(0, 0, size.width, size.height);
videoLayer.frame = CGRectMake(0, 0, size.width, size.height);
[parentLayer addSublayer:videoLayer];
[parentLayer addSublayer:overlayLayer];
composition.animationTool = [AVVideoCompositionCoreAnimationTool
videoCompositionCoreAnimationToolWithPostProcessingAsVideoLayer:videoLayer inLayer:parentLayer];
}
</code></pre>
| 0non-cybersec
| Stackexchange | 623 | 2,048 |
Prove summations are equal. <p>Prove that:</p>
<p>$$\sum_{r=1}^{p^n} \frac{p^n}{gcd(p^n,r)} = \sum_{k=0}^{2n} (-1)^k p^{2n-k} = p^{2n} - p^ {2n-1} + p^{2n-2} - ... + p^{2n-2n}$$</p>
<p>I'm not exactly sure how to do this unless I can say:</p>
<p><em>Assume</em> $\sum_{r=1}^{p^n} \frac{p^n}{gcd(p^n,r)}$ = $\sum_{k=0}^{2n} (-1)^k p^{2n-k}$</p>
<p>and show by induction that the sums equal each other and show the inductive step that you can take the expanded sum part with $n+1$ and get to $\sum_{k=0}^{2n+1} (-1)^k p^{2(n+1)-k}$</p>
<p>However, I'm not even sure that I am allowed to do this.. Any suggestion in how to prove this? I'm not looking for a whole proof just a push in the direction of how to solve this.</p>
| 0non-cybersec
| Stackexchange | 314 | 730 |
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 |
Android Navigation Component has lag when navigating through NavigationDrawer. <p>I am updating my app to Navigation Architecture Components and I see that it has a lag replacing fragments which is visible in the NavigationDrawer that does not close smoothly.</p>
<p>Until now, I was following this approach:</p>
<p><a href="https://vikrammnit.wordpress.com/2016/03/28/facing-navigation-drawer-item-onclick-lag/" rel="noreferrer">https://vikrammnit.wordpress.com/2016/03/28/facing-navigation-drawer-item-onclick-lag/</a></p>
<p>So I navigate in <code>onDrawerClosed</code> instead than in <code>onNavigationItemSelected</code> to avoid the glitch.</p>
<p>This has been a very common issue, but it is back again. Using the Navigation Component, it is laggy again and I don't see a way to have it implemented in <code>onDrawerClosed</code>.</p>
<p>These are some older answers prior to Navigation Component</p>
<p><a href="https://stackoverflow.com/questions/25534806/navigation-drawer-lag-on-android">Navigation Drawer lag on Android</a></p>
<p><a href="https://stackoverflow.com/questions/17491557/drawerlayouts-item-click-when-is-the-right-time-to-replace-fragment?noredirect=1&lq=1">DrawerLayout's item click - When is the right time to replace fragment?</a></p>
<p>Thank you very much.</p>
| 0non-cybersec
| Stackexchange | 401 | 1,309 |
Explain proof for strategy to write a cycle as transpositions. <p>My group theory book teaches a strategy how to write a cycle as a series of transpositions. Although the strategy is not hard to understand, I appreciate that they included a proof that this strategy actually works. However I wasn't able to follow it until the end, so I would appreciate if someone could help me out. </p>
<p>The strategy and the proof as follows:</p>
<blockquote>
<p><strong>Theorem:</strong> If <span class="math-container">$a_1, a_2,..., a_r$</span> are symbols (where <span class="math-container">$r \ge 2$</span>), then the composite of transpositions:</p>
<p><span class="math-container">$$
\begin{pmatrix}a_1 &a_r \end{pmatrix} \circ
\begin{pmatrix}a_1 &a_{r-1} \end{pmatrix} \circ
\text{...}\circ
\begin{pmatrix}a_1 &a_3 \end{pmatrix} \circ
\begin{pmatrix}a_1 &a_2 \end{pmatrix}
$$</span></p>
<p>is equal to the cycle</p>
<p><span class="math-container">$$
\begin{pmatrix}a_1 & a_2 & ... & a_r \end{pmatrix}
$$</span></p>
<p><strong>Proof:</strong></p>
<p>First we consider the symbol <span class="math-container">$a_1$</span>. The first transposition <span class="math-container">$\begin{pmatrix}a_1 &a_2 \end{pmatrix}$</span> maps <span class="math-container">$a_1$</span> to <span class="math-container">$a_2$</span> and the remaining transpositions map <span class="math-container">$a_2$</span> to itself, so the composite maps <span class="math-container">$a_1$</span> to <span class="math-container">$a_2$</span>.</p>
<p>Now we consider any symbol <span class="math-container">$a_s$</span>, where <span class="math-container">$2 \le s \le r-1$</span>. We see that:</p>
<ul>
<li>Each of the transpositions
<span class="math-container">$$
\begin{pmatrix}a_1 &a_2 \end{pmatrix},
\begin{pmatrix}a_1 &a_3 \end{pmatrix},
...,
\begin{pmatrix}a_1 &a_{s-1} \end{pmatrix}
$$</span>
maps <span class="math-container">$a_2$</span> to itself. </li>
</ul>
</blockquote>
<p>Here I'm already getting some doubts. If we let <span class="math-container">$s=2$</span> then the transposition <span class="math-container">$\begin{pmatrix}a_1 &a_2 \end{pmatrix}$</span> certainly doesn't map <span class="math-container">$a_s = a_2$</span> to itself, it maps it to <span class="math-container">$a_1$</span>. Or am I misunderstanding what they are saying?</p>
<p>The proof continues:</p>
<blockquote>
<ul>
<li>the next transposition <span class="math-container">$\begin{pmatrix}a_1 &a_s \end{pmatrix}$</span> maps <span class="math-container">$a_s$</span> to <span class="math-container">$a_1$</span>. </li>
<li>then the next transposition <span class="math-container">$\begin{pmatrix}a_1 &a_{s+1} \end{pmatrix}$</span> maps <span class="math-container">$a_1$</span> to <span class="math-container">$a_{s+1}$</span></li>
<li>and each of the remaining transpositions
<span class="math-container">$$
\begin{pmatrix}a_1 &a_{s+2} \end{pmatrix},
...,
\begin{pmatrix}a_1 &a_r \end{pmatrix}
$$</span>
maps <span class="math-container">$a_{s+1}$</span> to itself. Hence the composite maps <span class="math-container">$a_s$</span> to <span class="math-container">$a_{s+1}$</span>. It remains to find the image of <span class="math-container">$a_r$</span>. [...]</li>
</ul>
</blockquote>
<p>I left out the last part because that is actually clear to me. I'm not following the line of reasoning that tries to show the composite maps <span class="math-container">$a_s$</span> to <span class="math-container">$a_{s+1}$</span>. </p>
| 0non-cybersec
| Stackexchange | 1,276 | 3,627 |
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 |
BWF Daily Discussion and Beginner/RR Questions Thread for 2018-07-02. **Welcome to the /r/bodyweightfitness daily discussion thread!**
* Feel free to post beginner questions or just about anything that's on your mind related to fitness!
**Reminders:**
* Read the [FAQ](http://www.reddit.com/r/bodyweightfitness/wiki/faq) as your question may be answered there already.
* If you're unsure how to start training, check out our [Recommended Routine](https://www.reddit.com/r/bodyweightfitness/wiki/kb/recommended_routine), or our more skills based routine: [Move](https://www.reddit.com/r/bodyweightfitness/wiki/move).
* Even though the rules are relaxed here, asking for medical advice is still not allowed.
**For your reference we also have these weekly threads:**
* [Motivation Mondays](http://www.reddit.com/r/bodyweightfitness/search?q=motivation+monday+author%3Aautomoderator&restrict_sr=on&sort=new&t=all)
* [Training Tuesdays](http://www.reddit.com/r/bodyweightfitness/search?q=training+tuesday+author%3Am092+OR+author%3Aautomoderator&sort=new&restrict_sr=on)
* [Concept Wednesdays](http://www.reddit.com/r/bodyweightfitness/wiki/weekly/conceptwednesday)
* [Technique Thursdays](http://www.reddit.com/r/bodyweightfitness/wiki/weekly/techniquethursday)
* [Form Check Fridays](https://www.reddit.com/r/bodyweightfitness/search?q=form+check+friday+author%3Am092+OR+author%3Aautomoderator&restrict_sr=on&sort=new&t=all)
* [Slip Up Saturdays](http://www.reddit.com/r/bodyweightfitness/search?q=I+SUCK+SATURDAY+author%3Asolfire&sort=new&restrict_sr=on&t=all)
* [Progress Sundays](http://www.reddit.com/r/bodyweightfitness/search?q=progress+sunday+author%3Am092+OR+author%3Asolfire&sort=new&restrict_sr=on)
Feel free to join us on Discord! You can find the web client by clicking this link, [here](https://discord.gg/TsD9zeH).
If you'd like to look at previous Discussion threads, [click here.](https://www.reddit.com/r/bodyweightfitness/search?q=Daily+Discussion+and+Beginner&sort=new&restrict_sr=on)
| 0non-cybersec
| Reddit | 682 | 2,009 |
Why do we specify the length of a VARCHAR in MySQL?. <p>I'm designing a MySQL table that will contain a row which contains a subject title of variable length, but probably between 40-100 characters. VARCHAR is the obvious choice, but I'm not clear on how to balance efficiency with ensuring that I capture all data. I can declare it as VARCHAR(256) and be very safe, or I can declare it as VARCHAR(512) and be crazy safe. From what I understand, VARCHAR only stores what you put in it, so why don't we just use VARCHAR(max) all the time? Is it just to protect against running over the 65,535 byte row size limit, which includes all columns in the row? What's the best design practice when you have a general idea about the upper limit of a string's length like this?</p>
<p>Some people don't understand the question. I'm asking what the reason is to specify a limit on VARCHAR that isn't max. I know what a VARCHAR is, what max is, etc.</p>
| 0non-cybersec
| Stackexchange | 226 | 942 |
Let's Encrypt SSL Certificate Auto Renew with Certbot on Amazon Lightsail Server running Ubuntu 16.04.03 LTS. <p>I'm trying to set up SSL Certificate auto renewal on my boss's Amazon LightSail server. It was previously set up by a past contractor who isn't being a lot of help. I am very unfamiliar with Let's Encrypt so I searched for an article. I found <a href="https://www.onepagezen.com/letsencrypt-auto-renew-certbot-apache/" rel="nofollow noreferrer">this</a> guide on how to renew it. I followed the steps up to step 4 but the script that it says to add to my crontab file is for apache. When I checked the conf file in the renewal folder, it shows that the installer used was nginx and that the authenticator is standalone. In this case, how would I be able to modify the script to set an auto renewal for the SSL certificate. </p>
<p>Here's the script: 45 2 * * 6 cd /etc/letsencrypt/ && ./certbot-auto renew && /etc/init.d/apache2 restart</p>
| 0non-cybersec
| Stackexchange | 271 | 975 |
When should Q_OBJECT be used?. <p>The documentation states that: </p>
<blockquote>
<p>The Q_OBJECT macro must appear in the
private section of a class definition
that declares its own signals and
slots or that uses other services
provided by Qt's meta-object system.</p>
</blockquote>
<p>But <em>exactly</em> what does that mean? On which QObject-derived classes can I safely omit it? Will problems arise if you omit Q_OBJECT on a QObject-derived class, and then inherit from that one? Basically I would like a little more information on when I can omit it from my Qt classes.</p>
| 0non-cybersec
| Stackexchange | 162 | 593 |
Explain why this homotopy works?. <p><a href="http://www.math.cornell.edu/~hatcher/AT/AT.pdf" rel="nofollow noreferrer">http://www.math.cornell.edu/~hatcher/AT/AT.pdf</a> </p>
<p>It's page 351, but I'm having trouble with the line highlighted.
<img src="https://i.stack.imgur.com/jhzHW.png" alt="enter image description here"></p>
<p>The highlighted part makes no sense to me. I can see why $f_0=f$ as you would do this $f_0=(1-0)f+0g=f$, but then how do you get $f_1|K_1=g|K_1$. I was thinking that $f_1|K_1=(1-\varphi)f+\varphi g$?</p>
<p>So how do you get that to be equal to g. I know g and f agree on vertices. But, I don't see how you get it. The before this bit is fine, but then this bit confuses me. </p>
| 0non-cybersec
| Stackexchange | 270 | 718 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
Why isn't my monitor's native resolution appearing as an option?. <p>I'm on a clean install of Ubuntu 10.04 LTS. My monitor's native resolution is 1280x1024. However, in the Monitor Preferences application, I am only presented with 640x480 and 800x600 as options. My video card is an on board Matrox G200eW. I tried installing the proprietary driver from Matrox's website, but the installer immediately throws four errors. I also tried using xrandr to set my resolution, but it simply pops back saying "Size 1280x1024 not found in available modes." How can I get 1280x1024 added to my available sizes to that I can switch to it?</p>
| 0non-cybersec
| Stackexchange | 168 | 647 |
Why typecasting an integer literal to a pointer value results in a non-const expression?. <p>I'm trying to write a struct to calculate the pointer offset between a base and a derived class as a constant expression in C++03. The code is as follows:</p>
<pre><code>template <typename Base, typename Derived, typename Via = Derived>
struct OffsetToBase
{
static const std::ptrdiff_t val =
(const char*const)static_cast<Base*const>(static_cast<Via*const>((Derived*const)(1u << 7))) -
(const char*const)(1u << 7);
};
</code></pre>
<p>The code compiles in GCC, but not in clang and VC. The error produced by clang and VC basically says that the initializer is not a constant expression with clang further underlines the sub-expression <code>(Derived*const)(1u << 7)</code>. </p>
<p>So, my question is what the standards say about this? And if the initializer does not qualify as a constant expression according to the standards, then what is the reasoning behind this?</p>
<p><strong>UPDATE:</strong>
For your interest, I've found these two discussions:</p>
<p><a href="https://stackoverflow.com/questions/21592494/initializer-element-is-not-constant-error-for-no-reason-in-linux-gcc-compilin">"Initializer element is not constant" error for no reason in Linux GCC, compiling C</a></p>
<p><a href="https://stackoverflow.com/questions/21972815/about-cast-in-integer-constant-expression-in-standard-c">About cast in integer constant expression (in standard C)</a></p>
<p>But I don't think the same rules apply to C++.</p>
| 0non-cybersec
| Stackexchange | 470 | 1,587 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
Central Limit Theorem Fourier Isometry Confusion. <p>Okay, so I'm trying to understand the proof of the classical CLT. I'm not really a probability guy, so I'll apologize in advance for the analysis-heavy language used.</p>
<p>Statement: If $X_i\in L^1\cap L^2$ independent with constant mean and second moment. Then
$$
\sum_{i=1}^N\frac{x_i}{\sqrt{N}}
$$ converges weakly (in the probabilist sense) to a Gaussian.</p>
<p>Looking at the proof, we show essentially that the Fourier Transform (characteristic function) of a sequence of functions (rvs) $f_n$ converges to the Fourier Transform of a Gaussian at least pointwise. </p>
<p>Now, what confuses me is how we complete the proof. We know that the Fourier Transform is an Isometry on $L^2$, so why don't we use this? The standard proof seems to go through either some sort of approximation-theoretic argument using essentially Schwartz class functions and their density to obtain weak convergence or via something called the continuity theorem. Isn't there a another/easier way using the Fourier Isometry (of $L^2$)? The idea here is of course that isometry somehow means that both spaces have the same topology and thus convergence in either is equivalent to convergence in the other.</p>
<p>I'd appreciate any arguments as to why replacing Schwartz argument with the $L^2$ argument does or does not work! References are of course also appreciated.</p>
| 0non-cybersec
| Stackexchange | 350 | 1,412 |
next versus if in a .each loop?. <p>I have a text processing thing I'm doing in Ruby. Basically, I have to implement a simple state machine (with one character look-behind).</p>
<p>My code at the moment looks like this:</p>
<pre><code>text.each{ |c|
...
...
...
...
if @state!=:some_state
next
end
#processing stuff for if in :some_state mode
...
...
...
...
...
}
</code></pre>
<p>Is this proper? Or should it rather be implemented like:</p>
<pre><code>text.each{ |c|
...
...
...
...
if @state==:some_state
#processing stuff for if in :some_state mode
...
...
...
...
...
end
}
</code></pre>
<p>Is there a right way or is it just preference? Which one blends more with "the ruby way" of doing things?</p>
| 0non-cybersec
| Stackexchange | 269 | 775 |
I shared my cuckolding fantasy with my wife, she indulged it for a while, then changed her mind. However, I checked her web history and she is still watching cuckold themed porn quite often.. The topic, basically describes my question in a nutshell. But to add more details. We're both in our early 30s, she has an extremely high libido, while I have a moderately high one. Which means we do have sex maybe 2-3 times a week, but according to her she'd want more.
Very early in our relationship she told me she's turned on by big cocks quite a bit, but never experienced one (my 6 inches being her biggest).
So obviously, you can see how this eventually led to me indulging in cuckold territory. And for the last 4 years, we've indulged this fantasy quite a bit. Nothing, turned us on this much before and we both enjoyed it.
However, she never quite took the plunge. I think it was a combination of her having anxiety about being sexually intimate with another man after being exclusive to me for about 10 years.
She admitted this to me a year ago and we established what we called "partial cuckolding"; which allowed her to go out flirt, dance, grind, get felt up by other men - but no actual sex or making out. And she did this twice, one time even breaking some rules as she did let the guy feel up her breasts and even grinded on his cock on the dance floor until she orgasmed.
That was 9 months ago, she has since turned a complete 180 on the idea. Her reasoning is that, 9 months ago she realized how attracted she was to me - and didn't want any other men in her life, only me. She also, didn't like seeing me as a beta male (her words) who would let another man screw his wife.
What then happened was that we sort of have awkward sex (like we were both holding back on talking about cuckolding) for months. For the last 3 months, our sex life has been great and the awkwardness gone.
BUT, out of curiosity I checked her browser history and 4 times in the last month she been watching cuckold porn, interracial big cock porn and things along those lines.
Now, everyone of you will tell me, just ask her.
Well I did, and she lied saying nothing about the cuckolding idea turns her on anymore, and no part of her wants to do it.
So I've come to you now, with my dilemma.
1. Is it a case where she's afraid or indulging me in because of how much she said she didn't want it. As she's afraid of being a hypocrite?
2. Does she secretly need this to get off, but much prefers our sex life this way? I can't imagine that being fulfilling as I held this cuckold fantasy close to my chest for years which was mentally difficult.
3. She wants to do it, but maybe is still unsure of my reaction, because I too tell her it no longer turns me on. The truth is, it still does, but I've mentally compartmentalized that fantasy. So I can go weeks without indulging it.
Honestly, what I want is for her to be happy and if cuckolding makes her happy then I'm 100% GTG, if not then I'm fine. But yes, i do lean slightly into the cuckolding territory. | 0non-cybersec
| Reddit | 748 | 3,058 |
Cannot install HP printer: plugin installation not successful. <p>I am trying to set up my HP LaserJet P1102 on Ubuntu 19.04.</p>
<p>I know the <a href="https://askubuntu.com/questions/1070470/how-should-i-install-hplip-binary-proprietary-plugin-driver-for-my-hp-printer-or">theoretical procedure</a> to install the printer, but this procedure does not work for me, following the "correct" procedure to install the printer (the software + the plugin) fails as follows.</p>
<p>I have downloaded and installed hplip 3.19.5 from <a href="https://developers.hp.com/hp-linux-imaging-and-printing" rel="nofollow noreferrer">here</a>.</p>
<p>At first the installation seems to succeed. It asks for plugin to be installed, then it says "Plugin installation successful". But after I click OK on this message, it returns to the window in which I should choose which printer to install, and another message pops up:</p>
<blockquote>
<p>error: The device you are trying to setup requires a binary plug-in. Some functionalities may not work as expected without plug-ins. Please run 'hp-plugin' as normal user to install plug-ins. Visit <a href="http://hplipopensource.com" rel="nofollow noreferrer">http://hplipopensource.com</a> for more infomation.</p>
<p>error: hp-setup failed. Please run hp-setup manually.</p>
</blockquote>
| 0non-cybersec
| Stackexchange | 393 | 1,339 |
SQL 2008 RTM Temp Tables. <p>Today I implemented a monitoring solution on our SQL server using Cacti and the first thing i noticed is the growth in the number of temporary tables, in just 3 hours on our test system we had an additional 300+ temp tables in the temp DB. I also noticed that SQL Server's memory growth over these 3 hours was huge - 15 GB utilized after 3 hrs.</p>
<p>There were only 3-4 users testing on the test system and about 5 connections open to the application when I ran a SP_WHO.</p>
<p>What can be causing this? I did a query on the objects in the temp DB and all the names are similar to this #XXXXXXXXX, I read somewhere that these are from the Table Variable (Declare @myTable...)</p>
<p>Is there any way to check why we have a growth in the number of temp tables & what is causing it? Any help at this stage would be greatly appreciated.</p>
<p>I am going to be installing the service packs tomorrow for 2008, hopefully that solves the problem.</p>
| 0non-cybersec
| Stackexchange | 247 | 985 |
Is the exponential function the one this problem is hinting at?. <blockquote>
<p>Suppose that $f$ is holomorphic on all of $\mathbb{C}$ and that $$\lim_{n\rightarrow \infty} \left(\frac{\partial}{\partial z}\right)^nf(z)$$ exists, uniformly on compact sets, and that this limit is not identically zero. Then the limit function $F$ must be a very particular kind of entire function. Can you say what kind?</p>
</blockquote>
<p><strong>My attempt/thoughts:</strong></p>
<p>Well if the limit function is $F$, then $$\frac{\partial}{\partial z}\left(F(z)\right) = \frac{\partial}{\partial z}\left(\lim_{n\rightarrow \infty} \left(\frac{\partial}{\partial z}\right)^nf(z)\right) = \lim_{n\rightarrow \infty} \left(\frac{\partial}{\partial z}\right)^{n+1}f(z) = F(z).$$</p>
<p>Therefore, $$F'(z) = F(z) \implies F(z) = Ae^z$$</p>
<p>Where $A$ is some complex number.</p>
<p>However, this problem is supposed to be one of the harder problems, so my guess is that I must have assumed something that I shouldn't have. Is this wrong? If so, could you point out my error?</p>
| 0non-cybersec
| Stackexchange | 338 | 1,072 |
controlling spacing between lines in tree of contents. <p>Since yesterday I have learned that doing a hard reset on a git branch also throws away stashed changes. So, I need to recreate some steps that I have inadvertently thrown away. Unfortunately I cannot remember how I decreased the spacing between lines of contents table. I have tried </p>
<pre><code>\renewcommand{\cftsubsecafterpnum}{\vspace{-8pt}}
\renewcommand{\cftsubsubsecafterpnum}{\vspace{-8pt}}
</code></pre>
<p>which works, but unfortunately I also have the custom defined <code>subsubsubsection</code> which I am unable to modify using the above logic using <code>tocloft</code> package.</p>
<p>I have also tried </p>
<pre><code>\renewcommand{\baselinestretch}{0.8}\normalsize
\tableofcontents
\renewcommand{\baselinestretch}{1.0}\normalsize
</code></pre>
<p>but this controls only the space of multilines in TOC.</p>
<p>Below are images of what I have now and what it used to look like. Any hints on how to decrease spacing between the lines would be much appreciated.</p>
<p>This is "before" look of how I managed to decrease the spacing.
<a href="https://i.stack.imgur.com/hcxrB.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hcxrB.jpg" alt="enter image description here"></a></p>
<p>This is what it looks now.
<a href="https://i.stack.imgur.com/bUGbd.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bUGbd.jpg" alt="enter image description here"></a></p>
| 0non-cybersec
| Stackexchange | 447 | 1,473 |
Android custom chrome tab with deep links. <p>I have an Android/Kotlin application and I would like to configure deep links for certain pages to open inside my application (to look native).</p>
<p>At the moment, I have intent filters that redirect the user to an activity with WebView in which I open the desired url:</p>
<pre><code><activity android:name=".activity.WebViewActivity">
<intent-filter android:label="Futurity">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="api.example.com"
android:pathPrefix="/auth/confirm"
android:scheme="https" />
</intent-filter>
</activity>
class WebViewActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_web_view)
val data = intent.data
// construct url
val url = if (intent.data != null ) {
"https://" + data.host + data.path + "?" + data.query
}
appWebView.webViewClient = WebViewClient()
appWebView.loadUrl(url)
}
}
</code></pre>
<p>This works fine, but I would like to use Chrome custom tabs instead for security reasons.</p>
<p>However, when I try to configure the custom tab instead of WebView, I am getting an infinite loop of redirects between the page (launched in the chrome tab) and the intent filter which immediately redirects user back to the activity:</p>
<pre><code>CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.launchUrl(this, Uri.parse(url));
</code></pre>
<p>How can I achieve the same behavior as with webviews but without modifying the url? Is it even doable?</p>
| 0non-cybersec
| Stackexchange | 559 | 2,024 |
Password authentication using a master key and KDF without storing password. <p>I want to make a service stateless(has no data to store or mantain). But the service shoule be able to authenticate user. </p>
<p>What I'm considering is using <a href="https://en.wikipedia.org/wiki/Key_derivation_function" rel="nofollow noreferrer">key derivation function</a> with a shared master secret key and username to calculate user password each time when user login. The KDF should ensure it generates the same password everytime for specific user. The service will deliver the derived password to correspond user.</p>
<p>For example, use PBKDF2 and use username+secret_shared_master_key as the password, kinda like a <code>username-based key derivation function</code></p>
<p>I'm wondering is this way secure cryptographically? Thanks in advance!</p>
<hr>
<p>After some discussion with SteffenUllrich in comments, seems using <code>HMAC(secret_master_key, username)</code> or <code>PBKDF2(HMAC(secret_master_key, username))</code> as the user's password is one option to do the thing.</p>
| 0non-cybersec
| Stackexchange | 293 | 1,085 |
Just lost my best friend. My cat died. I had to leave him with my parents at home when I moved for work. My folks just called me with the news. He was fine this morning. Then a few hours ago, he was acting "funny", to the point where my parents were getting him ready for the emergency vet. He had a seizure and passed. He was only four. My dad could only spit the news out before my mom took the phone. My dad never cries. But he did.
I can't stop crying. Cato saved my life. I was about to die a few years ago, depressed, unemployed, lost all my friends to a bad break up riddled with trauma. Cato walked with me through isolation, slept with me through the nightmares, and cuddled me through painful physical therapy. He loved everyone unconditionally. He was bad at being a cat. He wanted everyone to share his toys, his "kisses", and his love. He sat with my mom when both her kids moved out last year, he kept my dad company too. I felt okay leaving because my parents had him. He couldn't follow me.
I kept putting off visiting after I got this job. I skipped Easter because I was "too busy". I contented myself with hearing his "hello?" Meow through the phone and promised to visit for Memorial Day. Now I can't.
He was talented at sounding like a person saying "hello" to get you to pay attention. He could manipulate my dad into starting a fire in the wood stove because of his "cold paws" that you could feel through your clothes. He stole the covers, hogged the bed, and snored worse than any human I ever met. He knew what doors each family member walked through, and waited for them at the right time. Mom says he never stopped "waiting" for me at mine.
Cato, I'm sorry, little buddy. | 0non-cybersec
| Reddit | 412 | 1,706 |
Ng5 Karma Jasmine test renders component instead of result page. <p>Let's say i have a very simple 'create' unit test, kind that <code>ng cli</code> generates for you:</p>
<pre><code>describe('MyComponent', () => {
let component: MyComponent;
let fixture: ComponentFixture<MyComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [MyComponent],
imports: [
HttpClientTestingModule,
FormsModule,
RouterTestingModule.withRoutes([{ path: 'home', redirectTo: '/' }])
],
providers: [SomeService1, SomeService2, { provide: SomeService3, useValue: {} }],
schemas: [NO_ERRORS_SCHEMA]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(MyComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
</code></pre>
<p>Now when i run this test like so <code>ng test --browser=Chrome</code> instead of looking at Karma results page, i am looking at my component.</p>
<p>My CLI version is <code>1.6.3</code>, Karma <code>1.7.1</code>, Angular <code>5.2.0</code>, OS macOS.</p>
<p><strong>Update</strong> My browser is captured, karma loads, tests run but instead of karma results i see my full-screen component because it's css overlays their results. If i find the div and delete it in the DOM, i can see Karma results.</p>
<p>I was just expecting Angular to remove that node.</p>
| 0non-cybersec
| Stackexchange | 475 | 1,541 |
Understanding the lower and upper limit of a graph. <p>I was recently presented the following graph:</p>
<p><img src="https://i.imgur.com/wdP5PmC.jpg" alt=""></p>
<p>I was given very little context and I have to recreate it. I don't want it to be done for me, but some context would help.</p>
<p>Any idea what these upper and lower limits represent? Are they represented by an exponential function (I noticed the lines curve)? Or is there some value at each point (it doesn't seem like it the way they are drawn)? I think it has something to do with error or confidence level?</p>
<p>I'm able to represent the data points in excel, and make a line of best fit, but have no idea what the dotted lines represent, or how to add them to my excel graph. Any help would be great.</p>
| 0non-cybersec
| Stackexchange | 212 | 782 |
Why cutting the cable is making me a better cook.... I know cable and satellite TV is loaded with cooking shows but it wasn't until we gave it (almost) all up that I really started getting into a cooking groove. We only get over-the-air TV now and it turns out most PBS stations also broadcast a couple of other channels in addition to their main one (albeit not in HD).
In my neck o' the woods, one of them is the "Create" channel. Whilst I always enjoyed cooking, I feel that the shows *America's Test Kitchen* and the companion show *Cook's Country USA* have really made mealtimes more enjoyable for everybody. I get the satisfaction of doing things in the kitchen that I never knew about growing up and my wife and our neighbors eat the results. I'm by no means a great (or even good) cook but I *know* I'm getting better (and saving $100 a month!). The only monetary down-side is that there was some purchasing of quality items (knives and pans, for the most part).
Sorry if this sounds like a commercial; I just wanted to give a shout-out. | 0non-cybersec
| Reddit | 246 | 1,049 |
Dual Boot Mint Linux cursor freezes on F541N (aka X541NA)- how to fix?. <p>Bought <a href="https://www.asus.com/Laptops/X541NA/" rel="nofollow noreferrer">ASUS VivoBook Max- F541N</a> with pre-installed Win 10 few days ago and dual booted into Mint Linux Sylvia (Cinnamon) 18.3 successfully</p>
<p>I see that the keyboard cursor (touchpad) pointer and touchpad suddenly freezes after a while (I don't use a mouse ). Observed on Linux Mint 18.3 and 18.2. The freeze is sure to occur the moment I initiate update ( On a few occasions the entire system is unresponsive and I need to hard reboot </p>
<ul>
<li><p>Switching to Intel Microcode (open source), rebooted and the behaviour persists (it was on <em>Don't change CPU microcode</em>)</p></li>
<li><p>All updates Level 1 and 2 done (corresponding to <em>Keep my computer safe</em>)</p></li>
<li><p>No difference if I update Kernel</p></li>
<li><p>It’s a virgin system – nothing installed it </p></li>
<li><p>Laptop tool confirms that it's running the latest BIOS</p></li>
<li><p>Resource applet shows CPU usage less than 15% and memory usage less than 1.5 GB when the freeze occurs- checked multiple times</p></li>
</ul>
<p>Same behavior persists over multiple installs over last few days</p>
<p><strong>tl:dr;</strong> <strong>How do I fix this problem?</strong> </p>
<p>( It's barely a week old so I want to be very , very careful and not screw up)</p>
<p>Here is more information about the setup using <code>inxi -Fxz</code></p>
<pre><code>System: Host: s****-X541NA Kernel: 4.13.0-45-generic x86_64 (64 bit gcc: 5.4.0)
Desktop: Cinnamon 3.6.6 (Gtk 3.18.9-1ubuntu3.3)
Distro: Linux Mint 18.3 Sylvia
Machine: System: ASUSTeK (portable) product: X541NA v: 1.0
Mobo: ASUSTeK model: X541NA v: 1.0
Bios: American Megatrends v: X541NA.318 date: 02/27/2018
CPU: Quad core Intel Pentium N4200 (-MCP-) cache: 1024 KB
flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 8755
clock speeds: max: 2500 MHz 1: 852 MHz 2: 798 MHz 3: 842 MHz
4: 1277 MHz
Graphics: Card: Intel Device 5a84 bus-ID: 00:02.0
Display Server: X.Org 1.18.4 drivers: intel (unloaded: fbdev,vesa)
Resolution: [email protected]
GLX Renderer: Mesa DRI Intel HD Graphics 505 (Broxton)
GLX Version: 3.0 Mesa 17.0.7 Direct Rendering: Yes
Audio: Card Intel Device 5a98 driver: snd_hda_intel bus-ID: 00:0e.0
Sound: Advanced Linux Sound Architecture v: k4.13.0-45-generic
Network: Card-1: Realtek RTL8101/2/6E PCI Express Fast/Gigabit Ethernet controller
driver: r8169 v: 2.3LK-NAPI port: e000 bus-ID: 01:00.0
IF: enp1s0 state: down mac: <filter>
Card-2: Qualcomm Atheros QCA9565 / AR9565 Wireless Network Adapter
driver: ath9k bus-ID: 02:00.0
IF: wlp2s0 state: up mac: <filter>
Drives: HDD Total Size: 1000.2GB (1.3% used)
ID-1: /dev/sda model: ST1000LM035 size: 1000.2GB
Partition: ID-1: / size: 29G used: 6.3G (23%) fs: ext4 dev: /dev/sda6
ID-2: /home size: 446G used: 160M (1%) fs: ext4 dev: /dev/sda8
ID-3: swap-1 size: 6.37GB used: 0.00GB (0%) fs: swap dev: /dev/sda7
RAID: No RAID devices: /proc/mdstat, md_mod kernel module present
Sensors: System Temperatures: cpu: 35.0C mobo: N/A
Fan Speeds (in rpm): cpu: N/A
Info: Processes: 201 Uptime: 13 min Memory: 607.0/3809.0MB
Init: systemd runlevel: 5 Gcc sys: 5.4.0
Client: Shell (bash 4.3.481) inxi: 2.2.35
</code></pre>
| 0non-cybersec
| Stackexchange | 1,276 | 3,597 |
"Mechanically generated" java source files in the Java source code. <p>As I was looking through the Java source code, I found some unusual files, mostly related to <code>ByteBuffer</code>s in the <code>java.nio</code> package which had a very messy source code and were labelled <code>This file was mechanically generated: Do not edit!</code>. </p>
<p>These files also contained large portions of blank lines (some even in the middle of javadocs (!!?)), presumably to prevent the line numbers from changing. I have also seen a few java decompilers, such as <a href="https://bitbucket.org/mstrobel/procyon/wiki/Java%20Decompiler" rel="nofollow"><code>procyon-decompiler</code></a>, which have an option to keep line numbers, but I doubt that's the case, because putting blank lines before the final accolade changes nothing.</p>
<p>Here are a few of these files (I couldn't find any links to them online and didn't pastebin them because I don't want to break any copyright, but you can find them in the <code>src.zip</code> folder at the root of your JDK installation folder):</p>
<ul>
<li>java.nio.ByteBuffer</li>
<li>java.nio.DirectByteBufferR</li>
<li>java.nio.Bits</li>
<li>java.nio.BufferOverflowException</li>
</ul>
<p>I'd be curious to know:</p>
<ul>
<li>Which tool generated these files?</li>
<li>Why does the tool keep the line numbers the same? Is it to make debugging (stacktraces) easier?</li>
<li>Why would a tool be used to generate them, while all other classes are programmed by humans?</li>
<li>Why would the tool put blank lines randomly inside parentheses, before the final accolade, or even in javadocs?</li>
</ul>
| 0non-cybersec
| Stackexchange | 476 | 1,649 |
Understanding tax liabilities of a 2nd home in another state. My wife and I live and rent in CA but are planning to purchase a house in Oregon. We want to rent it out 1-2 years before moving into it. As such, we're buying it as a '2nd home' and will be first time homeowners.
I've read through some of the tax laws and will find an accountant to go over this with us, but I was hoping the kind people of reddit could help give us an outline of how to get the maximum deductions and provide a heads-up to things to be aware of before we buy a house. We're trying to break even until we move in.
Things I'm aware of that we should or can do assuming we live in it less than 14 days a year:
* Keep receipts for everything
* Deduct everything possible for those days it's rented out:
Mortgage tax, property tax, insurance premiums, utilities, repairs, property management fees, travel expenses to/from property, depreciation on the property, any energy efficient items we install.
Are there other tax deductions or credits that I'm missing?
* Are we missing out on tax benefits by not living it as our first house?
* Is only the profit from the difference between the mortgage and rental income taxed as taxable income? (that might be a loaded question)
* Is there anything else we be prepared for, outside of the normal headache of owning a 2nd home far away from us?
Edit: Assuming we use an investment property loan, the rest of my questions still apply. Thanks to aardy for calling the loan situation out. | 0non-cybersec
| Reddit | 351 | 1,513 |
OpsCenter 5.1.2 fails to start with SSL enabled on CentOS 5. <p>This applies to OpsCenter 5.1.0 and 5.1.1 as well.</p>
<p>I got the following error when trying to run OpsCenter 5.1.2 on a CentOS 5 server:</p>
<pre><code>Unhandled Error
Traceback (most recent call last):
File "/usr/share/opscenter/lib/py-redhat/2.6/shared/amd64/twisted/scripts/_twistd_unix.py", line 317, in startApplication
app.startApplication(application, not self.config['no_save'])
File "/usr/share/opscenter/lib/py-redhat/2.6/shared/amd64/twisted/application/app.py", line 653, in startApplication
service.IService(application).startService()
File "/usr/share/opscenter/lib/py-redhat/2.6/shared/amd64/twisted/application/service.py", line 277, in startService
service.startService()
File "/usr/share/opscenter/lib/py-redhat/2.6/shared/amd64/twisted/internet/defer.py", line 1141, in unwindGenerator
return _inlineCallbacks(None, f(*args, **kwargs), Deferred())
--- <exception caught here> ---
File "/usr/share/opscenter/lib/py-redhat/2.6/shared/amd64/twisted/internet/defer.py", line 1020, in _inlineCallbacks
result = g.send(result)
File "/usr/lib/python2.6/site-packages/opscenterd/OpsCenterdService.py", line 45, in startService
File "/usr/lib/python2.6/site-packages/opscenterd/OpsCenterdService.py", line 101, in setupWebServer
File "/usr/lib/python2.6/site-packages/opscenterd/WebServer.py", line 120, in makeWebServer
File "/usr/lib/python2.6/site-packages/opscenterd/SslUtils.py", line 2, in <module>
exceptions.ImportError: No module named OpenSSL
</code></pre>
<p>python26 is installed from EPEL. This is OpsCenter from Datastax. SSL support worked fine with OpsCenter 5.0.x.</p>
| 0non-cybersec
| Stackexchange | 594 | 1,681 |
How to use Sequelize belongsToMany associations?. <p>I have projects and users.</p>
<p>A user can have many projects.</p>
<p>A project can have multiple users.</p>
<p>I tried to model this with a belongsToMany association.</p>
<p>On my server I defined the associations like that:</p>
<pre><code>user.belongsToMany(project, {
through: 'writer_of_project'
foreign-key: 'user'
as: \projects
});
project.bbelongsToMany(user, {
through: 'writer_of_project'
foreign-key: 'project'
as: 'writers'
});
</code></pre>
<p>On my client it looks like this:</p>
<pre><code>user: {
id: 1,
...
projects: [1,2,3]
}
project: {
id: 1,
...
writers: [1,4,5]
}
</code></pre>
<p>On the server the association requires a third table to store the association and Sequelize doesn't seem to let me include the corresponding models from it.</p>
<p>If I run a <code>project.find(1)</code> with <code>include:[user]</code> I get </p>
<blockquote>
<p>user is not associated with project!</p>
</blockquote>
<p>If I try to put the project from the example above into the update method. The users attribute is simply ignored (I expected a project.setUsers(projectUpdate.users to happen in the background).</p>
<p><strong>What is the right way to deal with the loading and updating of these associations?</strong></p>
| 0non-cybersec
| Stackexchange | 440 | 1,333 |
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 |
Enable coredump centos 7 with systemd. <p>I went through couple of articles after some googling but nothing seems to work. </p>
<p>I am using Centos 7.</p>
<p>Let me explain what have I done so far.</p>
<p>I followed step by step</p>
<p><a href="http://www.kibinlabs.com/re-enabling-core-dumps-redhat-7/" rel="nofollow noreferrer">http://www.kibinlabs.com/re-enabling-core-dumps-redhat-7/</a></p>
<p>After that, I can get the coredump generated but only if I start the process manually, however, whenvever I start the process like</p>
<pre><code>systemctl start <myprocess>
</code></pre>
<p>it does not generate coredump after killing with SEGV</p>
<pre><code>kill -11 <pid>
</code></pre>
<p>var/log/messages shows that it got the signal SEGV but I cant see the coredump.</p>
<p>The kernel core pattern is also set.</p>
<pre><code>cat /proc/sys/kernel/core_pattern
/var/lib/coredumps/core-%e-sig%s-user%u-group%g-pid%p-time%t
coredump.conf
cat /etc/sysctl.d/50-coredump.conf
Storage=both
cat /etc/sysctl.d/99-sysctl.conf
fs.suid_dumpable = 1
kernel.core_uses_pid = 1
Storage=both
[root@server01 coredumps]# ls -l /etc/sysctl.d/50-coredump.conf
lrwxrwxrwx 1 root root 26 Aug 6 13:51 /etc/sysctl.d/50-coredump.conf -> /etc/systemd/coredump.conf
</code></pre>
| 0non-cybersec
| Stackexchange | 513 | 1,303 |
run Airflow webserver on EC2 CentOS using Systemd: Permission denied. <p>I'm using <a href="https://airflow.apache.org/" rel="nofollow noreferrer">Airflow</a> in EC2 CentOS with <a href="https://en.wikipedia.org/wiki/Systemd" rel="nofollow noreferrer">systemd</a> to manage daemons for starting airflow processes (ie: webserver, worker and scheduler).
When I run <code>sudo systemctl start airflow-webserver</code></p>
<pre><code>: ec2-user : TTY=pts/0 ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl enable airflow-webserver
Oct 30 01:27:37 ip-171-32-6-92.us-east-2.compute.internal sudo[11680]: ec2-user : TTY=pts/0 ; PWD=/ ; USER=root ; COMMAND=/bin/systemctl start airflow-webserver
Oct 30 01:27:37 ip-171-32-6-92.us-east-2.compute.internal systemd[11684]: Failed at step EXEC spawning /home/ec2-user/.local/bin/airflow: Permission denied
Oct 30 01:27:37 ip-171-32-6-92.us-east-2.compute.internal systemd[1]: airflow-webserver.service: main process exited, code=exited, status=203/EXEC
Oct 30 01:27:37 ip-171-32-6-92.us-east-2.compute.internal systemd[1]: Unit airflow-webserver.service entered failed state.
Oct 30 01:27:37 ip-171-32-6-92.us-east-2.compute.internal systemd[1]: airflow-webserver.service failed
</code></pre>
<p><em>airflow-webserver.service</em></p>
<pre><code>[Unit]
Description=Airflow webserver daemon
After=network.target postgresql.service mysql.service redis.service rabbitmq-server.service
Wants=postgresql.service mysql.service redis.service rabbitmq-server.service
[Service]
EnvironmentFile=/etc/sysconfig/airflow
User=airflow
Group=airflow
Type=simple
ExecStart=/home/ec2-user/.local/bin/airflow webserver --pid /run/airflow/webserver.pid
RestartSec=5s
PrivateTmp=true
[Install]
WantedBy=multi-user.target
</code></pre>
<p>airflow group and user are present:</p>
<pre><code>$ less /etc/group
# airflow:x:1001:ec2-user
$less etc/psswd
# ec2-user:x:1000:1000:EC2 Default User:/home/ec2-user:/bin/bash
# tss:x:59:59:Account used by the trousers package to sandbox the tcsd # daemon:/dev/null:/sbin/nologin
# airflow:x:1001:1001::/home/airflow:/bin/bash
</code></pre>
<p><a href="https://stackoverflow.com/questions/47291335/run-airflow-process-and-airflow-webserver-as-airflow-user">THIS</a> does not help.</p>
| 0non-cybersec
| Stackexchange | 813 | 2,246 |
How do you feel about attending a concert with a platonic girl-friend to watch a performer serenade with sweet sweet baby-making music?. I think it'd make me feel quite uncomfortable, yet I've agreed to go...
She asked me to a concert after two "dates". I'm hesitant to call them dates because I figured I was just meeting a girl for the hell of it.
So I think we're platonic, and now I don't know how I'm going to act at the concert.
Men, advice? Do I have any reason to feel uncomft? Should I just keep my eyes fixated on the dude singing and try to enjoy the music?
edit: forgot to add a bit of detail: we've been strictly exchanging non-flirtatious normal messages with each other for a couple months before actually meeting in person. This weighs heavily into my reason for thinking it's platonic.
| 0non-cybersec
| Reddit | 202 | 816 |
Highlighting issue with solr 8.2. <p>Partial highlighting for <code>solr 8.2</code> is not working fine for me. I am able to do a partial search by using <code>NGramTokenizerFactory</code>. But the highlight dosen't seems to be working now.</p>
<p>Here is Field type defination:</p>
<pre><code> <fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.NGramTokenizerFactory" maxGramSize="15" minGramSize="1"/>
<filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
<filter class="solr.SynonymGraphFilterFactory" expand="true" ignoreCase="true" synonyms="synonyms.txt"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
</code></pre>
<p>Here is my Field: </p>
<pre><code><field name="title" type="text_general" multiValued="true" indexed="true" stored="true"/>
</code></pre>
<p>Query:</p>
<pre><code>http://10.232.208.141:8986/solr/up1/select?df=title&hl.fl=title%2Ccontent &hl.simple.post=%3C%2Fb%3E&hl.simple.pre=%3Cb%3E&hl=on&q=digi&rows=1
</code></pre>
<p>Expected highlight:</p>
<pre><code>"title":["AgencyPortal <b>Digi</b>tal Engagement Solution Integration—Case Study | Cognizant"]}},
</code></pre>
<p>Current output Highlight:</p>
<pre><code>"title":["AgencyPortal Digital Engagement Solution Integration—Case Study | Cognizant"]}},
</code></pre>
| 0non-cybersec
| Stackexchange | 650 | 1,773 |
Am I have right answer about dual problem?. <p>I have some problems to make from primal problem to dual problem.</p>
<p>If I have the primal problem like down below.</p>
<p>Problem</p>
<p><span class="math-container">$$ \text{Min} \qquad 3w_1 + 4w_2 + 5w_3 $$</span>
<span class="math-container">$$ w_1 - w_2 \le ε_1 $$</span>
<span class="math-container">$$ w_2 - w_3 \le ε_2 $$</span>
<span class="math-container">$$ w_3 \le ε_3 $$</span>
<span class="math-container">$$ 1 \le 2ε_1 +3ε_2 + 4ε_3 $$</span>
<span class="math-container">$$ w_1 + w_2 + w_3 = 1 $$</span></p>
<p>then I think its dual problem with dual variable x is</p>
<p><span class="math-container">$$ \text{Max} \qquad ε_1x_1 + ε_2x_2 + ε_3x_3 + (2ε_1 +3ε_2 + 4ε_3)x_4 + x_5$$</span>
<span class="math-container">$$ s.t. x_1 + x_5 \le3 $$</span>
<span class="math-container">$$ x_2 \le 4 $$</span>
<span class="math-container">$$ x_3 \le 5 $$</span>
<span class="math-container">$$ \text{where} \quad r_4 \quad \text{and} \quad r_5 \quad \text{are} \quad \text{unrestricted} \quad \text{in }
\quad \text{sign}. $$</span></p>
<p>am I right?</p>
| 0non-cybersec
| Stackexchange | 478 | 1,209 |
Bray-Curtis Pairwise Analysis in R. <p>I am trying to calculate and visualize the Bray-Curtis dissimilarity between communities at paired/pooled sites using the Vegan package in R.</p>
<p>Below is a simplified example dataframe:</p>
<pre><code>Site = c("A", "B", "C", "D", "E", "F", "G", "H", "I", "J")
PoolNumber = c(1, 3, 4, 2, 4, 1, 2, 3, 4, 4)
Sp1 = c(3, 10, 7, 0, 12, 9, 4, 0, 4, 3)
Sp2 = c(2, 1, 17, 1, 2, 9, 3, 1, 6, 7)
Sp3 = c(5, 12, 6, 10, 2, 4, 0, 1, 3, 3)
Sp4 = c(9, 6, 4, 8, 13, 5, 2, 20, 13, 3)
df = data.frame(Site, PoolNumber, Sp1, Sp2, Sp3, Sp4)
</code></pre>
<p>"Site" is a variable indicating the location where each sample was taken
The "Sp" columns indicate abundance values of species at each site.
I want to compare pairs of sites that have the same "PoolNumber" and get a dissimilarity value for each comparison.</p>
<p>Most examples suggest I should create a matrix with only the "Sp" columns and use this code:</p>
<pre><code>matrix <- df[,3:6]
braycurtis = vegdist(matrix, "bray")
hist(braycurtis)
</code></pre>
<p>However, I'm not sure how to tell R which rows to compare if I eliminate the columns with "PoolNumber" and "Site". Would this involve organizing by "PoolNumber", using this as a row name and then writing a loop to compare every 2 rows?
I am also finding the output difficult to interpret. Lower Bray-Curtis values indicate more similar communities (closer to a value of 0), while higher values (closer to 1) indicate more dissimilar communities, but is there a way to tell directionality, which one of the pair is more diverse?</p>
<p>I am a beginner R user, so I apologize for any misuse of terminology/formatting. All suggestions are appreciated.</p>
<p>Thank you</p>
| 0non-cybersec
| Stackexchange | 580 | 1,734 |
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 |
OpenCV build from source Windows make error "RC Object". <p>I downloaded the latest source from github and configured opencv and the contrib modules. I can seem to build. I already turned off FFMPEG, which I manually downloaded the .dll previously, i know that has been a recent problem. I have succeeded in the past. But now i'm getting to</p>
<pre><code>[ 50%] Building RC object modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj
C:\mingw\bin\windres.exe: invalid option -- W
Usage: C:\mingw\bin\windres.exe [option(s)] [input-file] [output-file]
The options are:
-i --input=<file> Name input file
-o --output=<file> Name output file
-J --input-format=<format> Specify input format
-O --output-format=<format> Specify output format
-F --target=<target> Specify COFF target
--preprocessor=<program> Program to use to preprocess rc file
--preprocessor-arg=<arg> Additional preprocessor argument
-I --include-dir=<dir> Include directory when preprocessing rc file
-D --define <sym>[=<val>] Define SYM when preprocessing rc file
-U --undefine <sym> Undefine SYM when preprocessing rc file
-v --verbose Verbose - tells you what it's doing
-c --codepage=<codepage> Specify default codepage
-l --language=<val> Set language when reading rc file
--use-temp-file Use a temporary file instead of popen to read
the preprocessor output
--no-use-temp-file Use popen (default)
-r Ignored for compatibility with rc
@<file> Read options from <file>
-h --help Print this help message
-V --version Print version information
FORMAT is one of rc, res, or coff, and is deduced from the file name
extension if not specified. A single file name is an input file.
No input-file is stdin, default rc. No output-file is stdout, default rc.
C:\mingw\bin\windres.exe: supported targets: pe-i386 pei-i386 elf32-i386 elf32-little elf32-big srec symbolsrec verilog tekhex binary ihex
make[2]: *** [modules\core\CMakeFiles\opencv_core.dir\build.make:1517: modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles\Makefile2:2363: modules/core/CMakeFiles/opencv_core.dir/all] Error 2
make: *** [Makefile:160: all] Error 2
</code></pre>
<p>cmake gui options</p>
<pre><code>Detected version of GNU GCC: 47 (407)
Could NOT find PythonInterp: Found unsuitable version "2.7.11", but required is at least "3.4" (found C:/Python27/python.exe)
Could NOT find PythonInterp: Found unsuitable version "2.7.11", but required is at least "3.2" (found C:/Python27/python.exe)
Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
A library with BLAS API not found. Please specify library location.
LAPACK requires BLAS
A library with LAPACK API not found. Please specify library location.
Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
Could NOT find Matlab (missing: MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN)
VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
Caffe: NO
Protobuf: NO
Glog: NO
Looking for tiny_dnn.h
Looking for tiny_dnn.h - found
Found tiny-dnn in: C:/Users/Ben/Documents/opencv/build/3rdparty/tinydnn/tiny-dnn-1.0.0a3
The protocol buffer compiler is not found (PROTOBUF_PROTOC_EXECUTABLE='PROTOBUF_PROTOC_EXECUTABLE-NOTFOUND')
freetype2: NO
harfbuzz: NO
No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake.
Failed to find gflags - Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components.
Failed to find gflags - Could not find gflags include directory, set GFLAGS_INCLUDE_DIR to directory containing gflags/gflags.h
Failed to find glog - Could not find glog include directory, set GLOG_INCLUDE_DIR to directory containing glog/logging.h
Module opencv_sfm disabled because the following dependencies are not found: Eigen Glog/Gflags
Torch importer has been enabled. To run the tests you have to install Torch ('th' executable should be available) and generate testdata using opencv_extra/testdata/dnn/generate_torch_models.py script.
Tesseract: NO
General configuration for OpenCV 3.3.0-rc =====================================
Version control: f670a99
Extra modules:
Location (extra): C:/Users/Ben/Documents/opencv_contrib/modules
Version control (extra): 3.3.0-rc
Platform:
Timestamp: 2017-07-04T19:39:34Z
Host: Windows 10.0.14393 AMD64
CMake: 3.5.0-rc3
CMake generator: MinGW Makefiles
CMake build tool: C:/mingw/bin/mingw32-make.exe
Configuration: Release
CPU/HW features:
Baseline: SSE SSE2
requested: SSE2
Dispatched code generation: SSE4_1 FP16 AVX AVX2
requested: SSE4_1 AVX FP16 AVX2
SSE4_1 (0 files): + SSE3 SSSE3 SSE4_1
FP16 (1 files): + SSE3 SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
AVX (1 files): + SSE3 SSSE3 SSE4_1 POPCNT SSE4_2 AVX
AVX2 (2 files): + SSE3 SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
C/C++:
Built as dynamic libs?: YES
C++ Compiler: C:/mingw/bin/g++.exe (ver 4.7.2)
C++ flags (Release): -fsigned-char -mstackrealign -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -march=i686 -fomit-frame-pointer -ffunction-sections -msse -msse2 -mfpmath=sse -fvisibility=hidden -fvisibility-inlines-hidden -O2 -DNDEBUG -DNDEBUG
C++ flags (Debug): -fsigned-char -mstackrealign -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -march=i686 -fomit-frame-pointer -ffunction-sections -msse -msse2 -mfpmath=sse -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
C Compiler: C:/mingw/bin/gcc.exe
C flags (Release): -fsigned-char -mstackrealign -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -fdiagnostics-show-option -march=i686 -fomit-frame-pointer -ffunction-sections -msse -msse2 -mfpmath=sse -fvisibility=hidden -O2 -DNDEBUG -DNDEBUG
C flags (Debug): -fsigned-char -mstackrealign -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -fdiagnostics-show-option -march=i686 -fomit-frame-pointer -ffunction-sections -msse -msse2 -mfpmath=sse -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
Linker flags (Release):
Linker flags (Debug):
ccache: NO
Precompiled headers: YES
Extra dependencies: comctl32 gdi32 ole32 setupapi ws2_32 vfw32 winmm
3rdparty dependencies:
OpenCV modules:
To be built: core flann imgproc ml objdetect phase_unwrapping photo plot reg surface_matching video xphoto bgsegm dnn face fuzzy img_hash imgcodecs shape videoio xobjdetect highgui superres ts bioinspired dpm features2d line_descriptor saliency text calib3d ccalib datasets rgbd stereo tracking videostab xfeatures2d ximgproc aruco optflow python2
Disabled: stitching world contrib_world structured_light
Disabled by dependency: -
Unavailable: cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python3 viz cnn_3dobj cvv dnn_modern freetype hdf matlab sfm
Windows RT support: NO
GUI:
QT: NO
Win32 UI: YES
OpenGL support: NO
VTK support: NO
Media I/O:
ZLib: build (ver 1.2.8)
JPEG: build (ver 90)
WEBP: build (ver encoder: 0x020e)
PNG: build (ver 1.6.24)
TIFF: build (ver 42 - 4.0.2)
JPEG 2000: build (ver 1.900.1)
OpenEXR: build (ver 1.7.1)
GDAL: NO
GDCM: NO
Video I/O:
Video for Windows: YES
DC1394 1.x: NO
DC1394 2.x: NO
FFMPEG: NO
avcodec: NO
avformat: NO
avutil: NO
swscale: NO
avresample: NO
GStreamer: NO
OpenNI: NO
OpenNI PrimeSensor Modules: NO
OpenNI2: NO
PvAPI: NO
GigEVisionSDK: NO
DirectShow: YES
Media Foundation: NO
XIMEA: NO
Intel PerC: NO
Parallel framework: none
Trace: YES ()
Other third-party libraries:
Use Intel IPP: NO
Use Intel IPP IW: NO
Use Intel IPP Async: NO
Use Lapack: NO
Use Eigen: NO
Use Cuda: NO
Use OpenCL: NO
Use OpenVX: NO
Use custom HAL: NO
Python 2:
Interpreter: C:/Python27/python.exe (ver 2.7.11)
Libraries: C:/Python27/libs/libpython27.a (ver 2.7.11)
numpy: C:/Python27/lib/site-packages/numpy/core/include (ver 1.11.3)
packages path: C:/Python27/Lib/site-packages
Python 3:
Interpreter: NO
Python (for build): C:/Python27/python.exe
Java:
ant: NO
JNI: NO
Java wrappers: NO
Java tests: NO
Matlab: Matlab not found or implicitly disabled
Documentation:
Doxygen: NO
Tests and samples:
Tests: YES
Performance tests: YES
C/C++ Examples: NO
Install path: C:/Users/Ben/Documents/opencv/build/install
cvconfig.h is in: C:/Users/Ben/Documents/opencv/build
-----------------------------------------------------------------
Configuring done
Generating done
</code></pre>
<p>Is there a cmake flag that gets around this? opencv_core sounds pretty crucial...</p>
| 0non-cybersec
| Stackexchange | 3,658 | 12,259 |
Using FractionallySizedBox in a Row. <p>I want to have a widget of arbitrary width that contains a row of three widgets sized relatively to its parent.</p>
<p><code>FractionallySizedBox</code> sounds like the right tool for the job, so I tried it like this:</p>
<pre><code>Container(height: 24.0, color: Colors.black, child:
Row(children: [
FractionallySizedBox(heightFactor: 1, widthFactor: 0.25,
child: Container(color: Colors.orange)),
FractionallySizedBox(heightFactor: 1, widthFactor: 0.15,
child: Container(color: Colors.green)),
FractionallySizedBox(heightFactor: 1, widthFactor: 0.05,
child: Container(color: Colors.blue)),
]
)
</code></pre>
<p>But I'm getting an error</p>
<blockquote>
<p>BoxConstraints forces an infinite width.</p>
</blockquote>
<p>This happens even when I set some width on the enclosing container.</p>
<p>Why doesn't this work?</p>
| 0non-cybersec
| Stackexchange | 294 | 961 |
Django - SQL bulk get_or_create possible?. <p>I am using <strong>get_or_create</strong> to insert objects to database but the problem is that doing 1000 at once takes too long time.</p>
<p>I tried <strong>bulk_create</strong> but it doesn't provide functionality I need (creates duplicates, ignores unique value, doesn't trigger post_save signals I need).</p>
<p>Is it even possible to do get_or_create in bulk via customized sql query? </p>
<p>Here is my example code:</p>
<pre><code>related_data = json.loads(urllib2.urlopen(final_url).read())
for item in related_data:
kw = item['keyword']
e, c = KW.objects.get_or_create(KWuser=kw, author=author)
e.project.add(id)
#Add m2m to parent project
</code></pre>
<p>related_data cotains 1000 rows looking like this:</p>
<pre><code>[{"cmp":0,"ams":3350000,"cpc":0.71,"keyword":"apple."},
{"cmp":0.01,"ams":3350000,"cpc":1.54,"keyword":"apple -10810"}......]
</code></pre>
<p>KW model also sends signal I use to create another parent model:</p>
<pre><code>@receiver(post_save, sender=KW)
def grepw(sender, **kwargs):
if kwargs.get('created', False):
id = kwargs['instance'].id
kww = kwargs['instance'].KWuser
# KeyO
a, b = KeyO.objects.get_or_create(defaults={'keyword': kww}, keyword__iexact=kww)
KW.objects.filter(id=id).update(KWF=a.id)
</code></pre>
<p>This works but as you can imagine doing thousands of rows at once takes long time and even crashes my tiny server, what bulk options do I have?</p>
| 0non-cybersec
| Stackexchange | 512 | 1,522 |
script not run after reboot from /etc/rc3.d. <p>I create symbolic link to the file - /etc/rc3.d/platform.bash from /var/tmp/platform.bash </p>
<pre><code> ln -s /var/tmp/platform.bash /etc/rc3.d/platform.bash
</code></pre>
<p>script exist under /var/tmp :</p>
<pre><code> -rwxr-xr-x 1 root root 58442 Aug 30 08:49 platform.bash
</code></pre>
<p>view from /etc/rc3.d :</p>
<pre><code> lrwxrwxrwx 1 root root 31 Aug 30 06:33 S99platform.bash -> /var/tmp/platform.bash
</code></pre>
<p>my target is to run platform.bash after reboot ( on solaris 10 OS )</p>
<p>from some reason the script platform.bash not run after reboot ?
please advice what I need to check in order to verify the problem ?</p>
<p>my script ( platform.bash )</p>
<pre><code> #!/bin/bash
echo test > /var/tmp/log.txt
</code></pre>
| 0non-cybersec
| Stackexchange | 322 | 875 |
MySQL creates lowercase database / table names. <p>I'm currently building an application which requires a large MySQL database. Whenever I run the script, it executes perfectly but all of my table names (and the database name) end up in full lowercase.</p>
<p>I tried setting <code>lower_case_table_names = 0</code> in the <code>my.ini</code> file (and I restarted the service).</p>
<p>However my script still keeps creating everything in lowercase. Column names are strangely not affected tough. </p>
<p>My script:</p>
<pre><code>CREATE DATABASE IF NOT EXISTS Vacation;
CREATE TABLE IF NOT EXISTS Users (
userId INT AUTO_INCREMENT,
userFirstname NVARCHAR(32) NOT NULL,
userLastname NVARCHAR(32) NOT NULL,
userPrefix VARCHAR(16),
userPhone VARCHAR(15),
userEmail VARCHAR(32) NOT NULL,
userPassword CHAR(40) NOT NULL,
userPoints INT DEFAULT 0 NOT NULL,
PRIMARY KEY(userId)
);
</code></pre>
<p>The result:</p>
<pre><code>SHOW DATABASES -- vacation
SHOW TABLES FROM Vacation -- users
</code></pre>
<p>I'm currently using Ubuntu 14.04 (and I've tried reading <a href="https://dev.mysql.com/doc/refman/5.5/en/identifier-case-sensitivity.html" rel="nofollow">this</a> article for help).</p>
<p>Is there any way of fixing this problem? Thanks in advance.</p>
| 0non-cybersec
| Stackexchange | 403 | 1,297 |
How to hide website background images by default?. <p>I universally consider background images on web pages as visual clutter. The images can impair text readability and website navigation, major examples include <a href="https://steamcommunity.com/app/440/discussions/" rel="nofollow noreferrer">Steam's community pages</a> and Wikia (<a href="http://callofduty.wikia.com/wiki/Frank_Woods" rel="nofollow noreferrer">sample page</a>). Because Firefox can detect background images (right click context menu > "view background image"), is it possible to hide (or preferably block the images from loading) on all pages?</p>
| 0non-cybersec
| Stackexchange | 157 | 621 |
AKKA-http deployment. <p>This is the first time I'm working with akka-http. I wrote the following main class which starts the application:</p>
<pre><code>object Main extends App with Routes with Config with Protocols {
implicit val system: ActorSystem = ActorSystem("slickboard-system")
implicit val executor: ExecutionContext = system.dispatcher
implicit val materializer: ActorMaterializer = ActorMaterializer()
override val employeeActor: ActorRef = system.actorOf(EmployeeActor.props, "employees")
val server = Http().bindAndHandle(route, httpServerURL, httpServerPort)
}
</code></pre>
<p>It starts a server on localhost, but when I try to deploy it on a remote tomcat server, it is not working anymore. It is responding with a HTTP 404: not found.</p>
<p>I've been searching on the web for akka-http deployment, but couldn't find an answer. Someone has experience with this probleem?</p>
<p>Kind regards</p>
| 0non-cybersec
| Stackexchange | 255 | 929 |
Best practices for securing a Windows machine?. I'll try to keep this short. I recently purchased a laptop with Windows 8 preinstalled. (I want to keep Windows as my primary OS because I have software I wish to run which I wouldn't expect to perform well in a VM) I'm looking for some practical tips to protect the machine from malware or software exploitation. When I say "practical," I mean that following a tip should not impose a significant burden on me. (e.g., "Run every application in a virtual machine" or "Don't connect to the Internet" are not practical) Here are some of my thoughts right now:
- Obviously, I intend to stay up-to-date with Windows Updates and other software updates. This is a given.
- Are there are any unnecessary services or features in the operating system that might be worth disabling (at little loss to me) for the sake of reducing my attack surface?
- Any thoughts on sandboxing? Applications that make heavy use of the Internet are understandably high targets for exploitation; does anyone have experience with running them in a sandbox? Would you recommend Sandboxie?
- I want to install some type of HIPS. I'd also like to install a highly configurable firewall. I'm open to suggestions. I have a moderate preference towards stuff that is free.
- I'm thinking of using an account without admin privileges as my primary account. Thoughts on this?
- I'll probably also run NoScript.
- I probably won't be using disk encryption, unless there is a good reason to do so. Attacks that require physical access are less of a concern to me right now.
Feel free to add any suggestions you might have. Or, if you think anything is overkill, feel free to say so. | 1cybersec
| Reddit | 402 | 1,713 |
Is there a way in .bash_profile, to create two aliases that do the same thing?. <p>I have some simple aliases in my <code>.bash_profile</code> (OS X El Capitan, 10.11.6). Sometimes, I want multiple aliases that do the same thing. I have, for example, a folder that is my starting point for programming projects. Currently, I have an alias for code and one for programming that do the same thing: </p>
<pre><code>alias code='cd /path/to/Programming/; clear; pwd; ls'
alias programming='cd /path/to/Programming/; clear; pwd; ls'
</code></pre>
<p>This saves me having to remember how I aliased this directory. Is there a way to set multiple aliases without having to repeat the command? In short, is there something like this? </p>
<pre><code>alias code,programming='cd /path/to/Programming/; clear; pwd; ls'
</code></pre>
| 0non-cybersec
| Stackexchange | 243 | 823 |
How to maintain up-to-date snapshot tar archive efficiently?. <p>I have a large directory of files and I would like to maintain a single compressed tar archive that I can server over http containing all the files which is brought up to date once each day.</p>
<p>Many of the files will not change day-to-day and I'd like to avoid hours of processor time compressing the same files every day.</p>
<p>tar "cannot update compressed archives", so <code>tar uj</code> won't help.</p>
<p>Is there a clever way to do this?</p>
| 0non-cybersec
| Stackexchange | 141 | 523 |