text
stringlengths 36
35k
| label
class label 2
classes | source
stringclasses 3
values | tokens_length
int64 128
4.1k
| text_length
int64 36
35k
|
---|---|---|---|---|
Phalanx vs phalanx: how much individual skill mattered and how the front lines were replaced?. 1. So, if you are the guy in the front line of a phalanx, does it mean that you're on a suicide mission or there's a certain period of time that you have to survive before you are replaced?
2. If you are supposed to be replaced, how does it work?
3. How did they decide who is going to be in the front line?
4. Do you have to watch out only for the spears from the opposite frontal column or also from the two columns next to it or even more than that?
5. If the spearmen have a shield, chest armor, helmet and shin protectors, what's the approach here? You stab the opponent in the legs and, if he falls, you finish him off or you primarily aim for his face? How do you protect your legs and feet? Can you trick the opponent to expose himself or it's just mindless random stabbing from behind the shield until someone gets tired and lowers his guard?
6. When do you switch to the sword? | 0non-cybersec
| Reddit | 240 | 982 |
What did Emil Artin mean when he said this?. <p>What does Emil Artin mean when he says:</p>
<blockquote>
<p>It is my experience that proofs involving matrices can be shortened by 50% if one throws the matrices out.</p>
</blockquote>
<p>I mean I do understand that matrices are really just <em>Linear Transformations in a vector space</em> and this also makes for cool visualizations associated with all of Linear Algebra. But for the sake of performing manipulations and thinking analytically about Linear Algebra, isn't it <em>essential</em> to have Matrices. </p>
<p>If we throw them out, what else can take its place?</p>
| 0non-cybersec
| Stackexchange | 166 | 630 |
What is first class function in Python. <p>I am still confused about what <code>first-class functions</code> are. If I understand correctly, <code>first-class functions</code> should use one function as an object. Is this correct?</p>
<p>Is this a <code>first-class function</code>?</p>
<pre><code>def this_is_example(myarg1):
return myarg1
def this_is_another_ example(myarg):
return this_is_example(myarg)+myarg
this_is_another_ example(1)
</code></pre>
| 0non-cybersec
| Stackexchange | 154 | 469 |
So who thinks this "Change your Facebook profile picture to your favorite black friend for Black History Month" is pretty offensive?. I'd feel kind of embarassed if I was a black person and someone just had me as their picture. That's like forcing you to find someone you know that's black and just exploit them. Pretty much what this month is equivalent to. Morgan Freeman said it best I guess on 60 minutes. "Black history is American history", and then he basically just went on to say that there are no black men or white men, just men. That's how you beat racism.
http://www.youtube.com/watch?v=GeixtYS-P3s
EDIT: Although I first heard about this being about your actual friends, most people are just picking prominent african-americans. | 0non-cybersec
| Reddit | 171 | 743 |
Share secret non-interactively in a verifiable way. <p>In an application, I need to share a secret (random number) with a Group of known receivers over a public channel (a Blockchain) but each receiver needs to be able to check that the others received the same secret and if not will ignore the message. The problem is that the other receivers may not be online right now and thus an interactive protocol is not an option. The end goal is that all recipients get the same secret or all recipients ignore the message.</p>
<p>One solution I came up with is that after a recipient decrypted its part and received the secret he encrypts it with the public keys of the other recipients and checks that the cyphertext is the same, but this requires that the encryption scheme is deterministic but I only found probabilistic schemes and explanations why deterministic schemes are bad (but the concerns seem not to be a problem in my case as the plaintext is always a random number).</p>
<p>Is there a ready available deterministic asymmetric encryption scheme?
In other parts of the system, I use ECDSA so if I could reuse these keys it would be optimal but adding another scheme would be possible as well.
I'm not a cryptography expert and unless there is no other way I would like to avoid changing an existing scheme to make it deterministic.</p>
<p>Another option I found was using zero-knowledge proofs like SNARK, STARK or Bulletproofs but this seems like overkill and extremely complicated to pull off.</p>
<p>Are their other options I missed?</p>
| 0non-cybersec
| Stackexchange | 343 | 1,553 |
What is the most performant way to render unmanaged video frames in WPF?. <p>I'm using FFmpeg library to receive and decode H.264/MPEG-TS over UDP with <strong>minimal</strong> latency (something MediaElement can't handle).</p>
<p>On a dedicated FFmpeg thread, I'm pulling PixelFormats.Bgr32 video frames for display. I've already tried InteropBitmap:</p>
<pre><code>_section = CreateFileMapping(INVALID_HANDLE_VALUE, IntPtr.Zero, PAGE_READWRITE, 0, size, null);
_buffer = MapViewOfFile(_section, FILE_MAP_ALL_ACCESS, 0, 0, size);
Dispatcher.Invoke((Action)delegate()
{
_interopBitmap = (InteropBitmap)Imaging.CreateBitmapSourceFromMemorySection(_section, width, height, PixelFormats.Bgr32, (int)size / height, 0);
this.Source = _interopBitmap;
});
</code></pre>
<p>And then per frame update:</p>
<pre><code>Dispatcher.Invoke((Action)delegate()
{
_interopBitmap.Invalidate();
});
</code></pre>
<p>But performance is quite bad (skipping frames, high CPU usage etc).</p>
<p>I've also tried WriteableBitmap: FFmpeg is placing frames in _writeableBitmap.BackBuffer and per frame update:</p>
<pre><code>Dispatcher.Invoke((Action)delegate()
{
_writeableBitmap.Lock();
});
try
{
ret = FFmpegInvoke.sws_scale(...);
}
finally
{
Dispatcher.Invoke((Action)delegate()
{
_writeableBitmap.AddDirtyRect(_rect);
_writeableBitmap.Unlock();
});
}
</code></pre>
<p>Experiencing almost the same performance issues (tested with various DispatcherPriority).</p>
<p>Any help will be greatly appreciated.</p>
| 0non-cybersec
| Stackexchange | 483 | 1,542 |
Gauss Elimination - Diagonal dominant matrices don't need row changes. <p>I was asked to prove the following statement:</p>
<p>let $A$ be an $n$ by $n$ matrix with real entries such that $\forall k \in \mathbb N, k\leq n$: $$\sum_{i \neq k} |A_{i,k}| < |A_{kk}|$$</p>
<p>Show that if we were to do gauss elimination (or LU factorization) of $A$, then there will be no need for row changes, no need for partial pivoting.</p>
<p>I don't see why this is true, I'd appreciate a hint in the right direction. Maybe I should take a general $n$ by $n$ matrix that is diagonly dominant, try to $LU$ factor it and see that I don't need row changes? is this the way?</p>
| 0non-cybersec
| Stackexchange | 214 | 670 |
Correlation between two metrics. <p>Say I have a $\text{discrete}$ multivariate random variable $X=[X_1,X_2,\ldots,X_n]$, where each $X_i$ is of the same distribution class. Define random variable $Y$ to be the Manhattan distance between two samples of $X$, and define $Z$ to be the 'normal' Euclidean distance. </p>
<p>Obviously, $Y$ and $Z$ are positively correlated. Given the parameters of the distribution of $X$, is it possible to express this correlation? For instance, given $n$ dimensions, let each $X_i$ be an independent Bernoulli with parameter $p_i$. </p>
| 0non-cybersec
| Stackexchange | 161 | 572 |
Fourier multiplier with a singularity on a convex curve. <p>Let $h$ be a strictly convex function such that $h(0) = h'(0)=0$. Let $\Phi: \mathbb{R}^2 \to \mathbb{R}$ be a $C^{\infty}$-function with compact support (say, $\Phi$ is supported on $[-1,1]\times[-1,1]$). Let $\delta$ be a complex number, $\Re \delta \in (0,2)$. Consider a distribution
\begin{equation*}
v.p. \frac{\Phi(\xi,\eta)}{sign(\eta - h(\xi))|\eta - h(\xi)|^{\delta}},
\end{equation*}
which acts on a test function $\varphi \in \mathfrak{D}$ by the following rule:
\begin{multline*}
\Big\langle vp \frac{\Phi(\xi,\eta)}{sign(\eta - h(\xi))|\eta - h(\xi)|^{\delta}},\varphi(\xi,\eta)\Big\rangle = \\ \lim\limits_{\varepsilon \to 0} \int\limits_{\{|\eta - h(\xi)| \geq \varepsilon\}}\frac{\Phi(\xi,\eta)\varphi(\xi,\eta)\,d\xi d\eta}{sign(\eta - h(\xi))|\eta - h(\xi)|^{\delta}}.
\end{multline*}
The Fourier multiplier $M_{\delta}$ is defined by the following formla:
\begin{equation*}
M_{\delta}[f] = \mathcal{F}^{-1}\Big[vp \frac{\Phi(\xi,\eta)}{sign(\eta - h(\xi))|\eta - h(\xi)|^{\delta}} \mathcal{F}[f](\xi,\eta)\Big],
\end{equation*}
so it is a Fourier multiplier with the symbol $vp \frac{\Phi(\xi,\eta)}{sign(\eta - h(\xi))|\eta - h(\xi)|^{\delta}}$. </p>
<p>The question is: for what pairs $(p,q)$ does $M_{\delta}$ act from $L^p$ to $L^q$? Or, if the answer is known, is it written anywhere? </p>
<p>If $\delta = 1$, then I know the answer (except some "endpoints"): $M_{\delta}$ acts from $L^p$ to $L^q$ if $1 \leq p < \frac43$, $4 < q \leq \infty$, and $\frac{1}{p} - \frac{1}{q} > \frac32$, and does not act otherwise, except the segment $\frac{1}{p} - \frac{1}{q} = \frac23$ (I don't know what is the answer for such pairs of $p$ and $q$). The idea is to use the restriction estimate for the curves $\Gamma_{t} = \{\xi = h(\eta) + t\}$, integrate it, and then multiply the achieved operator by its adjoint. This works for the case $\Re\delta < 1$. To pass to the case $\delta = 1$, one gets some weak estimate for $M_{\delta}$ with $\Re \delta > 1$ and interpolates using Stein's lemma on analytic family of operators. Unfortunately, such method is not sharp enough to cover the case $\frac{1}{p} - \frac{1}{q} = \frac23$. What is more, it does not give a complete answer for the cases $1 < \Re \delta \leq \frac32$.</p>
| 0non-cybersec
| Stackexchange | 786 | 2,323 |
SQL Server 2014 unable to connect on virtual machine. <p><a href="https://i.stack.imgur.com/mX3ar.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mX3ar.jpg" alt="enter image description here"></a>I have a problem, where I installed SQL Server Advanced Express 2014. </p>
<p>Everything seems fine, I checked all I thought could be the issue, and everything that needs to be installed is there, but when trying to connect the SQL Server it simply goes on forever. </p>
<p>Is it possible that some applications might have a conflict with the SQL Server itself? when I go to services and try to start it from there, I get the error that windows was unable to start the SQL server service.</p>
| 0non-cybersec
| Stackexchange | 189 | 710 |
Something I've never understood about drowsy. Imagine you're at work/school, you're bored and getting a little drowsy... then you get SLAPPED in the face by a 10-feet tall axe-wielding undead machination! Surely you'd be... *startled* at least, right? I know that *personally* if I were getting shot, stabbed, and thrown up into the air regardless of how drowsy I am I would probably not be able to fall asleep!
When Zoe was revealed I immediately assumed that taking damage while drowsy would prevent sleep from happening, that's just what I thought was intuitive. Did anyone think the same way?
This isn't meant to be a *MNEH NERF ZOE* post, I'm just curious about what you guys think about the mechanic itself. Do you feel that the sleep some kind of magic-coma? Or is it actual sleep? Why would a magic-coma require a drowsy period? | 0non-cybersec
| Reddit | 216 | 839 |
OS 10.10 not connecting through proxy specified by its Internet name. <p>My office proxy has always been specified with its IP address and everything worked fine. However, recently, the proxy was changed to use its Internet name, in the form <pre>xxxx-y.zzzz.com </pre></p>
<p>Since then, I have been unable to connect. I keep getting infinite authentication dialog boxes, but still doesn't connect. I've opened <code>/etc/hosts</code> to add its Internet name and map it to its IP address. It is still failing. </p>
<p>However, if I change back to the legacy numeric iIP address, it connects fine. Problem is that the legacy IP address will soon be discontinued as it has issues.</p>
| 0non-cybersec
| Stackexchange | 172 | 687 |
git branch -r showing incorrect cash of branches after git pull / git fetch. <p>I ran a "git push origin --delete {branch}". According to github branches pulldown menu, this worked. According to my view locally, the branch is still there with "git branch -r". I git checkout master and git fetch and git pull and "git branch -r" and it's still there.</p>
<p>I read this post as well</p>
<p><a href="https://superuser.com/questions/984035/github-desktop-not-showing-remote-branches">GitHub desktop not showing remote branches</a></p>
<p>How to get my git branch -r to update?</p>
<p>thanks,
Dean</p>
| 0non-cybersec
| Stackexchange | 186 | 606 |
Much as I loathe season of the worthy, it has forced me to chase quest lines that have turned out to be a lot more fun than I expected. In line with consensus views, I think this season is truly awful. Its so far below every other season / DLC / whatever that its hard to believe it came from Bungie. Even that Gambit season last year which I mostly skipped was better (and apparently some people like gambit, so this must be true).
However....having absolutely nothing better to do in Destiny has forced me to pick up some quests that have sat there nagging me to complete them for months or even years. I have picked up Jotunn and the other Ada exotic (thanks for the 6 shards). I'm 2/3 of the way to the Revoker, I'm a couple of strikes off Edgewise.
I've discovered Momentum Control as a game mode that helps to grind out crucible quests (Mountaintop I'm looking at you). I've jumped in to help others with Whisper and Outbreak missions. I've engaged with my Armor 2.0 build properly for the first time, and discovered degrees of movement I never new existed.
Point being I need practcially no excuse to dump hours at a time into this game. The core gameplay is as awesome as ever, and the completionist in me is quite enjoying a season of tying up lose ends. It has been a season where the depth of the game built before has compensated for the lack of breadth of new content.
So come on Bungie - I think we can all forgive you one season, but get your act together and listen to the feedback of a broad and loyal customer base! | 0non-cybersec
| Reddit | 372 | 1,547 |
SQL Server query performance affected by rebuilding an un-fragmented index. <p>I have a query within a stored procedure that the same input will periodically time out ( > 30 seconds) when it normally runs in milliseconds.</p>
<p>The table has 2077748 rows, 59 columns, and 13 indexes.
We have found that rebuilding one of the indexes takes the performance back to milliseconds.</p>
<p>Here is the fun part. The percentage fragmentation on this index every time it is rebuilt is < 1%, the last time it was .01%. I've been playing with the fill factors because I thought it may be an expansion issue, it was 100, then 80, now 60. This has not effected the frequency of this problem.</p>
<p>When I run the following</p>
<pre><code>select b.name,*
from sys.dm_db_index_physical_stats(5,1075691080,NULL,NULL,NULL) a
JOIN sys.indexes b ON a.object_id = b.object_id AND a.index_id = b.index_id
</code></pre>
<p>I get</p>
<blockquote>
<p>index_id partition_number index_type_desc alloc_unit_type_desc index_depth index_level avg_fragmentation_in_percent fragment_count avg_fragment_size_in_pages page_count</p>
<p>66 1 NONCLUSTERED INDEX IN_ROW_DATA 3 0 0.01 1116 18.9229390681004 21118</p>
</blockquote>
<p>Any suggestions on other places to look or sources of this problem?</p>
| 0non-cybersec
| Stackexchange | 404 | 1,314 |
If Lebron comes to the west, Will this be the most lopsided WC/EC has ever been?. You can make a case that 8 of the top 10 players in the league are in the WC(If lebron joins) with the exception of Kyrie/Giannis. There are 4 legit super teams pieced together in the WC if Lebron/Kawhi join the Lakers and PG stays with OKC then you got a really good Pelicans team who are probably a healthy Cousins and another solid bench piece away from being contenders in their own right. This is a crazy time for the NBA right now | 0non-cybersec
| Reddit | 130 | 518 |
Why does this Powershell Script create converted images OUTSIDE the Rootfolder?. <p>The following Powershell script is supposed to process all designated images INSIDE the specified Rootfolder. Some of the renamed output images are generated OUTSIDE the Rootfolder. Any Powershell gurus have any idea why?
How can I output files only in the Rootfolder and not OUTSIDE the Rootfolder?</p>
<pre><code>
# This script requires ImageMagick
# Configuration
# Enter the full path of the folder that contains the images
$Rootfolder = "C:\temp\rktest"
$Recursive=$true
# Change these if necessary
$fileExtensions = "*.png"
$fileNameSuffix = "_resized" # the text to be appended to the output filename to indicate that it has been modified
$files = $null;
$fileCount = 0
# Check if the root folder is a valid folder. If not, try again.
if ((Test-Path $RootFolder -PathType 'Container') -eq $false) {
Write-Host "'$RootFolder' doesn't seem to be a valid folder. Please try again" -ForegroundColor Red
break
}
# Get all image files in the folder
if ($Recursive) {
$files = gci $RootFolder -Filter $fileExtensions -File -Recurse
}
# If there are no image files found, write out a message and quit
if ($files.Count -lt 1) {
Write-Host "No image files with extension '$fileExtensions' were found in the folder '$RootFolder'" -ForegroundColor Red
break
}
# Loop through each of the files and process it
foreach ($image in $files) {
$newFilename = $image.DirectoryName + " " + $image.BaseName + $fileNameSuffix + $image.Extension
$imageFullname = $image.FullName
write-host "Processing image: $imageFullname" -ForegroundColor Green
#This line contains the ImageMagick commands
& convert.exe $image.FullName -resize 50% $newFilename
$fileCount++
}
Write-Host "$fileCount images processed" -ForegroundColor Yellow
</code></pre>
| 0non-cybersec
| Stackexchange | 518 | 1,866 |
Dell Vostro 3468 needs maxx audio pro driver. <p>Audio isn't working properly; when using headphones, the audio quality is terrible in Ubuntu on a Dell <a href="https://www.dell.com/support/article/ag/en/agbsdt1/sln302999/dell-vostro-14-3468-usage-and-troubleshooting-guide?lang=en" rel="nofollow noreferrer">Vostro 3468</a>. How may I get the maxxaudio pro driver for Ubuntu?</p>
| 0non-cybersec
| Stackexchange | 133 | 381 |
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 |
ssh kills "while read". <p>I have a really confusing error, in the following script. <code>reservations</code> is just a file with 100 lines, let's say something like this:</p>
<pre><code>apple
pear
fruit
...
</code></pre>
<pre><code>cat reservations | while read LINE;
do
echo $LINE
for i in {0..2}; do
ssh -o ConnectTimeout=10 admin@render rm -rf /tmp/lock$i
echo $i
done
done
</code></pre>
<p>(This is already a simplified version of a production script.)</p>
<p>Now, what I would have expected, is to see an output like this:</p>
<pre><code>apple
0
1
2
pear
0
1
2
...
</code></pre>
<p>BUT, I only get the first line, i.e., the output is</p>
<pre><code>apple
0
1
2
</code></pre>
<p>If I remove the <code>ssh</code>, everything works! For some reason, the <code>ssh</code> messes up the whole thing, and exits the while loop. I have absolutely no idea why that is!!</p>
| 0non-cybersec
| Stackexchange | 318 | 904 |
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 |
Dirichlet to Neumann Operator. <p>EDIT: I am trying to specify my Question. Also I am not going to clearify which spaces I use, because I am only interested in the basic idea. </p>
<p>I am looking at a standard elliptic second order PDE:</p>
<p><span class="math-container">\begin{cases} Lu & = f & \text{in} &\Omega \\ \quad u & = g & \text{on} & \Gamma \subset \partial\Omega \end{cases}</span></p>
<p>where <span class="math-container">$\Omega \subset \mathbb{R}^n$</span> is an open bounded Lipschitz domain. My goal is to find the normal derivative <span class="math-container">$\partial_n u$</span> on the boundary <span class="math-container">$\Gamma$</span> using the Dirichlet-to-Neumann (DtN) Operator in the Framework of FEM.</p>
<p>As far as I know the DtN operator is as map</p>
<p><span class="math-container">\begin{equation}
\Lambda_\Gamma:g \to\partial_nu \quad with \quad u=0 \quad on\quad \partial\Omega\setminus\Gamma
\end{equation}</span></p>
<p>where <span class="math-container">$u$</span> is the solution of the boundary value problem. </p>
<p>For <span class="math-container">$Lu = - \Delta u$</span> the weak form of the pde is given as: Find <span class="math-container">$u$</span> such that</p>
<p><span class="math-container">\begin{equation}
\int_\Omega \nabla u\nabla v \,\,d\Omega = \int_\Omega f v \,\, d\Omega \qquad\forall v
\end{equation}</span>
with <span class="math-container">$u = g$</span> on <span class="math-container">$\Gamma$</span>.</p>
<p>My question is, how do I use the DtN operator to calculate the normal derivative in this case? </p>
| 0non-cybersec
| Stackexchange | 534 | 1,622 |
Help with PC Build (Canada). So I've been trying to build a pc for a while now. (Mostly going to be using it for; fortnite, emulators, blacks ops 4, steam games, console games, watching twitch and potentially wanting to stream.) Here is the list I think I might go with. Any tips or feedback would be nice. Pc part picker says the list may be incompatible but I'm not sure. I really want the nzxt kraken AIO cooler because of aesthetics and I heard AMD builds need a AIO cooler because they get hot as opposed to Intel builds, I could be wrong though. Also is the power supply unnecessary or is it good enough because it has a little wiggle room. Thanks in advance! {Keyboard, mouse and case have already been purchased.}
[PCPartPicker part list](https://ca.pcpartpicker.com/list/RpRVbX) / [Price breakdown by merchant](https://ca.pcpartpicker.com/list/RpRVbX/by_merchant/)
Type|Item|Price
:----|:----|:----
**CPU** | [AMD - Ryzen 5 2600X 3.6GHz 6-Core Processor](https://ca.pcpartpicker.com/product/6mm323/amd-ryzen-5-2600x-36ghz-6-core-processor-yd260xbcafbox) | $279.99 @ Amazon Canada
**CPU Cooler** | [NZXT - Kraken X62 Rev 2 98.2 CFM Liquid CPU Cooler](https://ca.pcpartpicker.com/product/2RdFf7/nzxt-kraken-x62-rev-2-982-cfm-liquid-cpu-cooler-rl-krx62-02) | $179.99 @ PC-Canada
**Motherboard** | [MSI - B350 TOMAHAWK ATX AM4 Motherboard](https://ca.pcpartpicker.com/product/Y4kwrH/msi-b350-tomahawk-atx-am4-motherboard-b350-tomahawk) | $125.99 @ Newegg Canada
**Memory** | [G.Skill - Trident Z RGB 16GB (2 x 8GB) DDR4-3200 Memory](https://ca.pcpartpicker.com/product/ybrcCJ/gskill-tridentz-rgb-16gb-2-x-8gb-ddr4-3200-memory-f4-3200c16d-16gtzr) | $219.99 @ Amazon Canada
**Storage** | [Crucial - MX500 250GB 2.5" Solid State Drive](https://ca.pcpartpicker.com/product/4mkj4D/crucial-mx500-250gb-25-solid-state-drive-ct250mx500ssd1) | $68.95 @ shopRBC
**Storage** | [Western Digital - Caviar Blue 1TB 3.5" 7200RPM Internal Hard Drive](https://ca.pcpartpicker.com/product/MwW9TW/western-digital-internal-hard-drive-wd10ezex) | $47.99 @ Newegg Canada
**Video Card** | [MSI - GeForce GTX 1060 6GB 6GB GT OCV1 Video Card](https://ca.pcpartpicker.com/product/TrGj4D/msi-geforce-gtx-1060-6gb-6gb-gt-ocv1-video-card-geforce-gtx-1060-6gt-ocv1) | $299.97 @ Amazon Canada
**Case** | [NZXT - S340 Elite (Black) ATX Mid Tower Case](https://ca.pcpartpicker.com/product/3TYWGX/nzxt-ca-s340w-b3-atx-mid-tower-case-ca-s340w-b3) |-
**Power Supply** | [EVGA - SuperNOVA G2 650W 80+ Gold Certified Fully-Modular ATX Power Supply](https://ca.pcpartpicker.com/product/9q4NnQ/evga-power-supply-220g20650y1) | $97.99 @ PC-Canada
**Monitor** | [Asus - VE278H 27.0" 1920x1080 Monitor](https://ca.pcpartpicker.com/product/nsTmP6/asus-monitor-ve278h) | $219.75 @ Vuugo
**Keyboard** | [Corsair - K95 RGB PLATINUM Wired Gaming Keyboard](https://ca.pcpartpicker.com/product/MYtWGX/corsair-k95-rgb-platinum-wired-gaming-keyboard-ch-9127014-na) | $247.48 @ Amazon Canada
**Mouse** | [Logitech - G502 Proteus Spectrum Wired Optical Mouse](https://ca.pcpartpicker.com/product/kJM323/logitech-mouse-910004615) | $87.98 @ Amazon Canada
| *Prices include shipping, taxes, rebates, and discounts* |
| **Total** | **$1876.07**
| Generated by [PCPartPicker](https://pcpartpicker.com) 2018-10-01 01:20 EDT-0400 | | 0non-cybersec
| Reddit | 1,238 | 3,294 |
Sublime Text Update 3083 Error - Error Code 32. <p>When trying to update Sublime Text 3 to <strong>version 3083</strong> on a Windows 10 computer I keep getting an error message at the end of the update saying </p>
<blockquote>
<p>'Unable to rename C:\Program Files\Sublime Text 3 to C:\Program
Files\Sublime Text 3 (3083), error code: 32'</p>
</blockquote>
<p>I looked it up on Microsoft's website and error 32 stands for <em>'The process cannot access the file because it is being used by another process'</em>. </p>
<p>So I tried closing down all other programs and tried updating again but I still get the same problem. I have also tried running the program as an administrator but the update creates the same error message.</p>
<p>I only have package control installed and the Haxe plugin installed and so I can't find any other reason why it wouldn't work, although I haven't updated it before.</p>
<p>Can anyone offer any advice?</p>
| 0non-cybersec
| Stackexchange | 258 | 950 |
ConTeXt: Enumeration, Comments cause undefined control sequence startformula error. <p>I'm a LaTeX user working through some ConTeXt tutorials, and hit a brick wall pretty early. It makes me wonder if something is wrong with my setup, or if I'm not understanding something pretty fundamental, or if ConTeXt is a bit more brittle than I had hoped. I'm using MacTeX-2012.</p>
<p>I'm getting errors when using both a formula and an enumeration with the <code>letter</code> option. Leaving out the <code>letter</code> option, this works great:</p>
<pre><code>\defineenumeration[guess][location=left]
\starttext
\startformula
x = no error
\stopformula
\guess This is just a guess.
\stoptext
</code></pre>
<p>The following, however, causes <code>texexec</code> to fail with <code>Undefined control sequence</code> on <code>\startformula</code> and <code>\stopformula</code>:</p>
<pre><code>\defineenumeration[guess][location=left, letter=it]
\starttext
\startformula
x = error
\stopformula
\guess This is just a guess.
\stoptext
</code></pre>
<p>Taking out the <code>formula</code> removes the error, so the enumeration with the <code>letter=it</code> option is working fine on its own.</p>
<p>In testing this, I discovered (to my surprise) that commenting out the <code>letter</code> option gives the same error:</p>
<pre><code>\defineenumeration[guess][location=left] %, letter=it]
\starttext
\startformula
x = error
\stopformula
\guess This is just a guess.
\stoptext
</code></pre>
<p>But taking out the <code>=</code> sign fixes it. No error when running:</p>
<pre><code>\defineenumeration[guess][location=left] %, letter it]
\starttext
\startformula
x = no error
\stopformula
\guess This is just a guess.
\stoptext
</code></pre>
<p>However, it's not just the equals sign, as this works without error:</p>
<pre><code>\defineenumeration[guess][location=left] %, bar=baz]
\starttext
\startformula
x = no error
\stopformula
\guess This is just a guess.
\stoptext
</code></pre>
<p>I am very confused. Am I doing something wrong?</p>
| 0non-cybersec
| Stackexchange | 657 | 2,094 |
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 |
command-line tool for a single download of a torrent (like wget or curl). <p>I'm interested in a single command that would download the contents of a torrent (and perhaps participate as a seed following the download, until I stop it).</p>
<p>Usually, there is a torrent-client daemon which should be started separately beforehand, and a client to control (like <code>transmission-remote</code>).</p>
<p>But I'm looking for the simplicity of <code>wget</code> or <code>curl</code>: give one command, get the result after a while.</p>
| 0non-cybersec
| Stackexchange | 142 | 535 |
Is the subset $\{P\in C[0,1]: P \text{ is polynomial and} P(0)=P'(0)=0 \}$ dense in $L^1[0,1]$?. <p>Is the subset $\{P\in C[0,1]: P \text{ is polynomial and} P(0)=P'(0)=0 \}$ dense in $L^1[0,1]$?</p>
<p>We know that for any $f\in L^1[0,1]$ and small enough $\epsilon$, there exists $g\in C_c[0,1]$ , $supp(g)\subseteq [0,1]$ st $||f-g||_1 <\epsilon.$ For continuous $g$ above, we know $g(0)=0$, then there is a polynomial $P$ st $P(0)=0$, and $||g-p||_\infty <\epsilon$. So the set $\{P\in C[0,1]: P \text{ is polynomial and} P(0)=0 \}$ is dense in $L^1[0,1]$.</p>
<p>But if we strengthen it a little, we constrain that the first derivative at $0$ of polynomial is also $0$, can we get the same result? </p>
| 0non-cybersec
| Stackexchange | 301 | 727 |
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 |
PHP "for" loop that lists all even numbers and displays a sum of all odd numbers from an array. <p>My task is to create a loop that displays all even numbers in a column and it also displays a sum of all odd numbers in an array.
So far I have made this:</p>
<pre><code><?php
$numbers = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
foreach ($numbers as $index=>$value) {
if ($value % 2 == 0)
echo "$value <br>";
}
?>
</code></pre>
<p>This code successfully displays a list of all even numbers. However, I still have to include a sum of all odd numbers that is displayed below the list of evens. For some reason, I am supposed to use a variable $sumOdd = 0.</p>
<p>How do I approach this from here on?</p>
| 0non-cybersec
| Stackexchange | 232 | 725 |
Fresh installed Windows XP refuses to update. <p>today I installed Windows XP SP2 Home on a computer. I went to try to run Windows Update on it and was greeted with "The website has encountered a problem and cannot display the page you are trying to view -- error number 0x8024400A"</p>
<p><a href="http://lastyearswishes.com/static/updateerror.png"><img src="https://i.stack.imgur.com/N4pQf.png" alt="enter image description here"></a></p>
<p>I've encountered this kind of problem a lot of times. I remember when I worked at a computer repair shop 6 or so years ago I encountered it on a lot of computers running Windows XP. I never figured out how to fix it other than to do a reinstall of Windows. Googling for the error number never came up with any solutions either.</p>
<p>What is it that causes this problem and how do I fix it? </p>
<p>Edit:</p>
<p>Well, now I've installed <code>windowsupdateagent30-x86</code> and that got me to where I can now browse a list of needed updates, but when I go to install updates I get the same generic error message, but with error number 0x80070715</p>
| 0non-cybersec
| Stackexchange | 304 | 1,102 |
How do I convert from void * back to int. <p>if I have</p>
<pre><code>int a= 5;
long b= 10;
int count0 = 2;
void ** args0;
args0 = (void **)malloc(count0 * sizeof(void *));
args0[0] = (void *)&a;
args0[1] = (void *)&b;
</code></pre>
<p>how can I convert from args[0] and args0[1] back to int and long?
for example</p>
<pre><code>int c=(something im missing)args0[0]
long d=(something im missing)args1[0]
</code></pre>
| 0non-cybersec
| Stackexchange | 178 | 429 |
How to get the video thumbnail path, and not the bitmap. <p>This question is actually asked and supposedly answered here: <a href="https://stackoverflow.com/questions/14483682/android-get-video-thumbnail-path-not-bitmap">android get video thumbnail PATH, not Bitmap</a>. </p>
<p>I've tried several times but can't get it to work. I always get a null returned. Any help on this please?</p>
<p><strong>Edit:</strong> The sample code I'm using now:</p>
<pre><code>public static String getVideoThumbnailPath(Context context,
String filePath) {
String thubmnailPath;
String where = Video.Thumbnails.VIDEO_ID
+ " In ( select _id from video where _data =?)";
final String[] VIDEO_THUMBNAIL_TABLE = new String[] { Video.Media._ID, // 0
Video.Media.DATA, // 1
};
Uri videoUri = MediaStore.Video.Thumbnails.getContentUri("external");
Cursor c = context.getContentResolver().query(videoUri,
VIDEO_THUMBNAIL_TABLE, where, new String[] { filePath }, null);
if ((c != null) && c.moveToFirst()) {
thubmnailPath = c.getString(1);
c.close();
Log.i(TAG, "thumb path: " + thubmnailPath);
return thubmnailPath;
} else {
c.close();
Log.i(TAG, "thumb path is null");
return null;
}
}
</code></pre>
| 0non-cybersec
| Stackexchange | 417 | 1,326 |
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 share local files to docker container In swarm with docker-compose. <p>here is my docker compose file </p>
<pre><code>version: '2'
services:
demoui:
image: demoimage
ports:
- "80:8000"
volumes:
- ./democonfig/config.js:/usr/local/tomcat/webapps/demo-ui/config.js
- ./logs/demo-ui:/usr/local/tomcat/logs
restart: unless-stopped
</code></pre>
<p>This docker compose file works when I was in single node. After moving to docker swarm . It is not working. It throws the following error</p>
<pre><code>ERROR: for demoui Error response from daemon: rpc error: code = 2 desc = "oci runtime error: could not synchronise with container process: not a directory"
Traceback (most recent call last):
File "<string>", line 3, in <module>
File "compose/cli/main.py", line 63, in main
AttributeError: 'ProjectError' object has no attribute 'msg'
docker-compose returned -1
</code></pre>
<p>So the questions are</p>
<ol>
<li><p>How to share file to swarm cluster ?</p></li>
<li><p>Or need to copy all file into image and run it?</p></li>
<li><p>Please share some documentation of docker volume with swarm.</p></li>
</ol>
| 0non-cybersec
| Stackexchange | 380 | 1,152 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
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 |
[IDEA] "You have fewer than the recommended number of players for this raid... (Refund Raid Pass?) (Battle Anyway)". It's a simple fix for the problem of not knowing if you should use your raid pass or not. With no way to scout whether people are there or not, something needs to be done. The 'feel bad' experience when you end up being the only one at a level 4 gym and you wait there for an hour and nobody shows up... It's not good.
Raids have a recommended number of players. If the timer ticks down and reaches 0 (10?) then it could ask you this question. This would also serve as a ready check to make sure everyone is ready right before the battle.
"You have fewer than the recommended number of players for this raid..."
(Refund Raid Pass)
(Quit and Wait)
(Battle Anyway)
*-side rant- Feel absolutely cheated into buying an extra raid pass because of this issue. I should never be made to feel bad about purchases in game. And don't even get me started on rural player issues where there are no pokestops having to buy pokeballs...*
edit: minor text fix | 0non-cybersec
| Reddit | 273 | 1,077 |
Does Nvidia driver have any business with Xorg configuration?. <p>16.04 LTS, 4.15.13-041513-generic. Finally got Nvidia 390.25 driver working. Downloaded from graphics ppa. According to the Nvidia installation guide, I should let nvidia-xconfig rewrite the Xorg.conf, but it causes The login screen loop (Secure Boot ON, you guessed it). However, after Xorg.conf being deleted, the OS starts fine. Not sure about the graphics driver working currently, but if I managed to start Maple software, it seems like Nvidia is in action.</p>
<p>So, I spilled liters of sweat to make the Nvidia driver work, something disturbed, whatever that was, but this time I'm shocked to know Xorg has no deal with Nvidia driver. If I'm right..?</p>
<p>I couldn't sign SSH keys by (read the log below)</p>
<pre><code>-> Signing kernel module:
executing: '"/lib/modules/4.15.13-041513-generic/build/scripts/sign-file" "/root/.ssh/id_rsa.pub" "/root/.ssh/id_rsa" "./kernel/nvidia.ko"'...
Usage: scripts/sign-file [-dp] []
scripts/sign-file -s []
executing: '"/lib/modules/4.15.13-041513-generic/build/scripts/sign-file" "sha512" "/root/.ssh/id_rsa.pub" "/root/.ssh/id_rsa" "./kernel/nvidia.ko"'...
At main.c:163:
- SSL error:0906D06C:PEM routines:PEM_read_bio:no start line: pem_lib.c:701
sign-file: /root/.ssh/id_rsa.pub: Success
-> Failed to sign kernel module.
ERROR: Installation has failed. Please see the file '/var/log/nvidia-installer.log' for details. You may find suggestions on fixing installation problems in the README available on the Linux driver download page at www.nvidia.com.</code></pre>
<p>Yes, I had to download the .run file for the same driver version. Or I didn't, I was just in a hurry to complete the damn mission.</p>
<p>Anyway, Xorg conf deleted == tout va bien. Question's remaining: should I give a **** (put in whatever suits you, it's your fantasy)? Read helluva many threads around the net and didn't find a working solution. Would appreciate the explanation.</p>
| 0non-cybersec
| Stackexchange | 611 | 2,019 |
How to stop ProGuard from stripping the Serializable interface from a class. <p>Is there an explicit way to stop ProGuard from changing a class from implementing an interface?</p>
<p>I have a class that implements <code>java.io.Serializable</code>, let's call it <code>com.my.package.name.Foo</code>. I've found that after running through ProGuard, it no longer implements <code>Serializable</code>. I get <code>null</code> after I cast from <code>Serializable</code> to <code>Foo</code> and <code>false</code> if I check an instance with <code>instanceof Serializable</code>. I've made sure to set ProGuard to ignore this class:</p>
<pre><code>-keep class com.my.package.name.Foo
</code></pre>
<p>I've also tried:</p>
<pre><code>-keep class com.my.package.name.Foo { *; }
</code></pre>
<p>and I've also tried the whole package by doing this:</p>
<pre><code>-keep class com.my.package.name.** { *; }
</code></pre>
<p>or:</p>
<pre><code>-keep class com.my.package.** { *; }
</code></pre>
<p>and also just to keep all <code>Serializable</code> classes:</p>
<pre><code>-keep class * implements java.io.Serializable { *; }
</code></pre>
<p>but to no avail. I have another class in a sibling package (roughly: <code>com.my.package.name2.Bar</code>) that also implements <code>Serializable</code> and is used similarly but has no issues.</p>
<p>I'm not sure it's relevant, but I'm packing this in a jar for use with Android. The code that uses these classes include putting them in <code>Bundle</code>s which is why I need <code>Serializable</code>. I considered that perhaps somehow ProGuard thinks that <code>Foo</code> is never used as a <code>Serializable</code> but that seems unlikely given that I pass it as a parameter to <code>Bundle.putSerializable(String, Serializable)</code> and also I do an implicit cast: <code>Serializable serializable = foo;</code>. In fact, when I debug, I can see the <code>Foo</code> get put into the <code>Bundle</code> and I can examine the <code>Bundle</code> and see the instance of <code>Foo</code> there, but when retrieving it the cast fails. </p>
| 0non-cybersec
| Stackexchange | 629 | 2,098 |
UITableViewAutomaticDimension not working until scroll. <p>When the Table View is first loaded, all of the visible cells are the estimatedRowHeight. As I scroll down, the cells are being automatically sized properly, and when I scroll back up the cells that were initially estimatedRowHeight are being automatically sized properly.</p>
<p>Once the cells are being automatically sized, they don't ever seem to go back to being the estimatedRowHeight.</p>
<pre><code>override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .Plain, target: nil, action: nil)
self.tableView.estimatedRowHeight = 80.0
self.tableView.rowHeight = UITableViewAutomaticDimension
// Uncomment the following line to preserve selection between presentations
// self.clearsSelectionOnViewWillAppear = false
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem()
}
</code></pre>
<p>and</p>
<pre><code> override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cellIdentifier = "Cell"
let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as CustomTableViewCell
// Configure the cell...
let restaurant = restaurants[indexPath.row]
cell.namelabel.text = restaurant.name
cell.locationlabel.text = restaurant.location
cell.typelabel.text = restaurant.type
cell.thumbnailImageView.image = UIImage(named: restaurant.image)
cell.thumbnailImageView.layer.cornerRadius = cell.thumbnailImageView.frame.size.width / 2
cell.thumbnailImageView.clipsToBounds = true
cell.accessoryType = restaurant.isVisited ? .Checkmark : .None
return cell
}
</code></pre>
<p>Thoughts on how to have the cells autoresize initially?</p>
<p><strong>UPDATE:</strong> As of Xcode 7 beta 6 this is no longer an issue</p>
| 0non-cybersec
| Stackexchange | 552 | 2,040 |
Geometric interpretation of the Noether normalization lemma. <p>I am currently working my way through a proof of the following statement: Let $X$ be an integral, affine $k$-Variety of dimension $n$. Then there exists a surjective morphism $X\rightarrow \mathbb{A}_k^n$ with finite fibres.</p>
<p>The book containing the proof in question introduces the dimension of $X$ as the trancendence degree of the function field $K(X)$ over $k$. It then uses an anti-equivalence between the category of affine varieties over $k$ and that of finitely generated, reduced $k$-Algebras and Noether's normalization lemma for existence of such a morphism. It think I understand it except for the following: the coordinate ring $\mathcal{O}(X)$ is by Noether's normalization lemma a finitely generated $k[x_1,...,x_n]$-module. Let $M_P=(x_1-a_1,...,x_n-a_n)$ for any $P=(a_1,...,a_n)\in \mathbb{A}_k^n$. The book then claims that if follows that $\mathcal{O}(X)/M_P\mathcal{O}(X)$ is a finite-dimensional $k$-Algebra (Then $\mathcal{O}(X)/M_P\mathcal{O}(X)$ would only have finitely many maximal ideals which correspond to the points in the preimage of $P$ under the morphism). Why is that statement true though? I know that if in general if $A$ is a finitely generated $k$-Algebra and $M$ a maximal ideal in $A$ then $A/M$ is a finite-dimensional $k$-Algebra. But $M_P\mathcal{O}(X)$ isn't necessarily maximal, right? What am I missing?</p>
| 0non-cybersec
| Stackexchange | 404 | 1,426 |
Problem with characters in SSH with MingW32 and not super-user. <p>I am connecting to my server with SSH from Windows 10 with MINGW32 (Git).</p>
<p>When I connect and user the <strong>root user</strong> everything works correctly but when I login with another user and use special characters like <strong>backspace</strong> or similar, the console shows <strong>incorrect characters</strong> and I can't erase.</p>
<p>An example:</p>
<pre><code>root@sample:/# php -r 'echo "I can write\n";'
I can write
root@sample:/# php -r 'echo "I can erase without problem\n";'
I can erase without problem
root@sample:/# su sample
$ php -r 'echo "I can write some characters";'
I can write some characters
$ php -r 'echo "I cant erase and I cant use the up arrow for repeat the last command";'
I cant erase and I cant use the up arrow for repeat the last command$
$ ^[[A : not found
$ : 16:
$ trying erase^H^H^H^H^H
</code></pre>
<p>With Putty I have not problems.</p>
<p>Regards and thanks.</p>
| 0non-cybersec
| Stackexchange | 307 | 989 |
How do I calculate the Fourier transform of $\operatorname{sinc}^2\left ( \pi \frac{t-T}{\pi} \right )$?. <p>How do I calculate the Fourier transform of $\operatorname{sinc}^2\left ( \pi \frac{t-T}{\pi} \right )$?</p>
<p>$\frac{\sin t}{t}\;\substack{\mathcal{F}\\ \leftrightarrow} \; \pi \mathrm{rect}\frac \omega 2 = \pi \cdot\begin{cases}0 & \mbox{if } |\omega | > 1 \\\frac{1}{2} & \mbox{if } |\omega | = 1\\1 & \mbox{if } |\omega | < 1. \\ \end{cases}$</p>
<p>and than I would do $sinc(t)^2$ but I always get wrong result.</p>
| 0non-cybersec
| Stackexchange | 211 | 551 |
Should I always encapsulate an internal data structure entirely?. <p>Please consider this class:</p>
<pre><code>class ClassA{
private Thing[] things; // stores data
// stuff omitted
public Thing[] getThings(){
return things;
}
}
</code></pre>
<p>This class exposes the array it uses to store data, to any client code interested.</p>
<p>I did this in an app I'm working on. I had a <code>ChordProgression</code> class that stores a sequence of <code>Chord</code>s (and does some other things). It had a <code>Chord[] getChords()</code> method that returned the array of chords. When the data structure had to change (from an array to an ArrayList), all client code broke.</p>
<p>This made me think - maybe the following approach is better:</p>
<pre><code>class ClassA{
private Thing[] things; // stores data
// stuff omitted
public Thing[] getThing(int index){
return things[index];
}
public int getDataSize(){
return things.length;
}
public void setThing(int index, Thing thing){
things[index] = thing;
}
}
</code></pre>
<p>Instead of exposing the data structure itself, <strong>all of the operations offered by the data structure are now offered directly by the class enclosing it, using public methods that delegate to the data structure.</strong></p>
<p>When the data structure changes, only these methods have to change - but after they do, all client code still works.</p>
<p><strong>Note that collections more complex than arrays might require the enclosing class to implement even more than three methods just to access the internal data structure.</strong></p>
<hr>
<p>Is this approach common? What do you think of this? What downsides does it have other? Is it reasonable to have the enclosing class implement at least three public methods just to delegate to the inner data structure?</p>
| 0non-cybersec
| Stackexchange | 493 | 1,899 |
Recovering 3 private keys if Eve knows that the keys are shared prime numbers and knows their public keys, How would this be done?. <p>okay so here is the original question:</p>
<p>Alice Bob and Carl are generating public keys for RSA, but they are lazy and decide to
share some of the work of generating prime numbers. They find 3 large prime numbers
p,q and r, then Alice uses the modulus $n_A = pq$, Bob uses the modulus $n_B = pr$ and Carl
uses the modulus $n_C = qr$. The prime numbers used are much to large factoring to be
feasible, but Eve learns that they shared prime numbers (and knows their public keys)
how does she obtain p, q and r?</p>
<p>My thinking or possible reasoning for this question.
Since Eve knows the public keys and that the keys share prime numbers she can compute the GCD of n or factorize n in order to calculate or find the private keys. In this case she would first use Euclid's algorithm for $n_A = pq$ & $n_B= pr $ which we know is p because both n's share a common prime $p$. She would use the same process for computing $q$ which is $n_A = pq$ & $n_C = qr$. Shes does it a third time for $r$ which $n_B = pr$ & $n_C = qr$.</p>
<p>I want to know If I am thinking about this the right way or if I have the right idea. If I am on the right track, how do I mathematically represent this? </p>
| 0non-cybersec
| Stackexchange | 383 | 1,341 |
Linear transformation defined on vector space of twice differentiable functions to $R^2$.How to determine whether it is one to one or onto. <p>Given that T is a linear transformation from V to <span class="math-container">$R^2$</span> where V be the vector space of all twice differentiable functions with the condition that <span class="math-container">$f''(0)-2f'(0)+f(0)=0$</span> and <span class="math-container">$T(f)=(f'(0),f(0))$</span>
Then how to determine whether it is one one or onto
I was trying to find out the dimension of the vector space V<br>
But I am unable to find an basis of V
How to proceed with this please help</p>
| 0non-cybersec
| Stackexchange | 178 | 640 |
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 |
Xpath select cell in table being in last row in fixed column position. <p>How can I use XPath to click a button in a table in a specific position? The column is constant and it is always the last row. I have the id of the table, but the cell contains a delete button, whose value is dynamic - a generated hash value.</p>
<pre><code>Xpath = ".//[@=id='blah']/tbody/tr[5]/td[5]" # <- this xpath fails.
</code></pre>
<p>This is for automation - python using the selenium.</p>
| 0non-cybersec
| Stackexchange | 143 | 479 |
American Chemical Society: I’m May Nyman here to answer your questions about the August 12 warehouse explosion in Tianjin, China, AMA!. Hello, May Nyman here, professor of chemistry at Oregon State University. A warehouse exploded in Tianjin, China last week that did the damage of 20 tons of dynamite, felt like an earthquake, looked like a nuclear explosion from space, but we don’t know yet what caused it. Many different chemicals were stored in that warehouse, and scientists and other experts can only hypothesize what happened, and what will happen next.
At Oregon State University, I run a [research lab](http://nyman.chem.oregonstate.edu/), training young scientists from all over the country and the world. We are inorganic synthetic chemists, and we make materials for energy and environmental applications. For example, we collaborate with other scientists in the [Center for Sustainable Materials Chemistry](http://sustainablematerialschemistry.org/) developing low energy methods to make the materials you find inside your smartphone and computer. We also work with scientists in the [Energy Frontier Research Center, Materials Science of Actinides](http://www.msa-efrc.com/) to discover new ways to make nuclear energy more efficient and safer. For the [Department of Energy](http://science.energy.gov/bes/mse/research-areas/materials-chemistry/), we figure out ways to make new materials with new properties.
I have not always been a professor; for only three years in fact. I started my career at Sandia National Labs, studying nuclear wastes, and inventing ways to remove the radioactive elements and store them safely. I also figured out ways to make the water that we drink cleaner. But what I love most of all about chemistry is the beautiful and perfectly functional things in nature that are completely composed of the elements of the periodic table; including rocks and minerals, butterfly wings, leaves, and DNA! August 12, 2015 was a sad day for chemists when such a tragic accident happened that gives chemistry a bad name, and results in people fearing chemicals.
The officials do not yet know what exactly happened, what caused the explosion, how it could’ve been prevented, and which chemicals stored in the warehouse might have been the source of explosion. We also do not know why the fish are dying and why ‘soap suds’ are observed everywhere after it rained in Tianjin. We do not know what the short-term or long-term impact of this accident will be, or if the people living near the accident site or sites like it are in danger of future explosions. We know of about a half dozen chemicals that were stored there including calcium carbide; ammonium potassium and sodium nitrate; sodium cyanide; toluene diisocyanate; and compressed gases. As scientists, we can form hypotheses of what chemical reactions could have occurred in Tianjin at the scene of this most unfortunate event.
Update: strangely enough there was a second warehouse explosion a few hundred miles away, 10 days later in Shandong; the chemical mentioned here is adiponitrile
I’ll be back at 1:00pm ET to begin answering your questions.
EDIT: 9:53 PT good day Reddit community, Thank you for all your questions. I am online now until 2:00 Eastern time. May Nyman
EDIT: 11:10 PT. thank you for all the fantastic questions and comments, Reddit community. My official hour is up, and I need to take a break and work on my day job. I will come back at 3:00 PT to answer some more questions. May Nyman
EDIT: 2:59 PT I am back to answer a few more of these many many questions. and I will be sure to address storage, as this question comes up in various forms. May Nyman
EDIT: 3:49 PT. It has been fun talking with you, Reddit community. A good day to all.
May Nyman
| 0non-cybersec
| Reddit | 837 | 3,778 |
How to make OpenGL viewport have the exact size and position of my QML item which renders into it?. <p>I'm trying to render a <code>640x360</code> red square inside a <code>1280x720</code> window. The problem is that OpenGL's viewport won't automatically be inside the area occupied by the square into the Qt window system. That is, if my video object have <code>640x360</code> dimensions, the OpenGl viewport still have the <code>1280x720</code> dimensions (WHY?).</p>
<p>Anyways, I can fix that by using <code>glViewport(this->x, this->y, this->width, this->height);</code>. The problem is that in OpenGL, the coordinate system has origin at the left low corner, and <code>this->x, this->y, this->width, this->height</code> are from the object's coordinates in QML syntax, where the origin is in the upper left corner. The result is this:</p>
<p><strong>main.qml</strong>:</p>
<pre><code>import QtQuick 2.0
import OpenGlVideoQtQuick2 1.0
Grid {
columns: 2
spacing: 2
width: 1280
height: 720
OpenGlVideoQtQuick2 {
width: 640
height: 360
}
}
</code></pre>
<p><strong>but the red square occupies the 3rd grid instead of the 1st one:</strong></p>
<p><a href="https://i.stack.imgur.com/zIBLN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zIBLN.png" alt="enter image description here"></a></p>
<p>I could <strong>easily</strong> fix that by doing <code>glViewport(this->x, WINDOW_HEIGHT-this->y, this->width, this->height);</code> where <code>WINDOW_HEIGHT</code> would have the value <code>720</code>, however I don't think I should trust the OpenGL viewport to always have the size of the window, so instead I should get the OpenGl viewport dimensions, but I don't think that that is possible. </p>
<p>I tried</p>
<pre><code>GLint dims[2] = {9999, 9999};
glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
std::cout << "dimenson x:" << dims[0] << " dimenson y:" << dims[1] << std::endl;
</code></pre>
<p>which gives me <code>dimenson x:8192 dimenson y:8192</code> which makes no sense to me.</p>
<p>Here is the OpenGL rendering code: <a href="https://github.com/lucaszanella/QQuickPaintedItemBug/blob/0a8ef6b5229afa7113ec1e4e3838981042792329/OpenGlVideoQtQuick2.cpp" rel="nofollow noreferrer">https://github.com/lucaszanella/QQuickPaintedItemBug/blob/0a8ef6b5229afa7113ec1e4e3838981042792329/OpenGlVideoQtQuick2.cpp</a></p>
<p>You can view an entire buildable project here: <a href="https://github.com/lucaszanella/QQuickPaintedItemBug/tree/0a8ef6b5229afa7113ec1e4e3838981042792329" rel="nofollow noreferrer">https://github.com/lucaszanella/QQuickPaintedItemBug/tree/0a8ef6b5229afa7113ec1e4e3838981042792329</a></p>
| 0non-cybersec
| Stackexchange | 992 | 2,752 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
How 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 |
jQuery Mousewheel Scroll Horizontally. <p>I'm currently developing a horizontally website that can enable my mouse scroll to scroll to the left and right... </p>
<p>My jQuery included sequence:</p>
<pre><code><script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
<!--jquery validation script-->
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
<!--Smooth Scroll-->
<script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
</code></pre>
<p>My code as below:</p>
<pre><code><script type="text/javascript" src="js/jquery.mousewheel.min.js"></script>
<script>
$.noConflict();
$(function() {
$("body").mousewheel(function(event,delta) {
this.scrollLeft -= (delta * 30);
event.preventDefault();
})
})
$(function() {...});
$(document).ready(function() {
$('#form').validate({...});
$("#submit").click(function()
{...});
})
</script>
</code></pre>
<p>My "body" CSS as below:</p>
<pre><code>html {
width:100%;
overflow-y:hidden;
overflow-x: scroll;
}
body{
}
</code></pre>
<p>For right now the code that I doubt is:</p>
<pre><code><!--Smooth Scroll-->
<script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
</code></pre>
<p>which is crashing with the mouse scroll I think.</p>
<p>The mouse scroll is working, the only problem is the mouse scroll is not smooth, sometimes stop there, sometimes cant even move, is not my mouse problem. I'm not sure what's cause this because I tried to debug it for 2 days already. Anyone here to share their thoughts on this issue?</p>
<p>I been finding solution but it looked weird on my case. Scroll until a certain part and is jam at the middle. (Just the scrolling bar.) I'm using Chrome on Mac for testing. Btw is there any solution like AutoShift while scrolling because that's worked for me when I pressed Shift button.</p>
| 0non-cybersec
| Stackexchange | 694 | 2,130 |
Making hostapd work with systemd-networkd using a bridge. <p>I have two ethernet ports and one wireless port on a router I am setting up. I am using systemd-networkd. I am renaming the ports first then creating a bridge then am bridging one of the the ethernet ports and the wireless board to create on combined lan port with a single IP and DHCP/DNSMASQ. The other ethernet being the wan port. Here you see the the networkctl output. lan is the bridge. You see wlan has same status as lan2 (which is the NIC and is working fine). So the bridge and all the routing is fine. </p>
<pre><code>IDX LINK TYPE OPERATIONAL SETUP
1 lo loopback carrier unmanaged
2 wan ether routable configured
3 lan2 ether carrier configuring
4 wlan wlan carrier configuring
5 lan ether routable configured
</code></pre>
<p>So.....I am pretty close. It's only getting hostapd to start at the right time using systemd-networkd. The AP comes up but it looks like the wireless interface is not getting bound to the bridge. A client can enter WPA password and it is accepted but then it never connects. The logs aren't helping me to identify the issue but I am pretty sure the wireless port is not getting fixed to the bridge. That would explain why the AP functions seems fine but then there is not actual connection with an IP address being given out.</p>
<p>Anyone with some experience have some tips? As you can see the hostapd.service I wrote tries to delay starting hostapd until networkd is done, in particular until the bridge has been created. Maybe it's something to do with hostapd delaying for networkd but networkd adding wlan to the lan bridge before hostapd has started...kinda a catch22.</p>
<p>hostapd.conf</p>
<pre><code>interface=wlan
# the interface used by the AP
hw_mode=g
# g simply means 2.4GHz band
channel=10
# the channel to use
#ieee80211d=1
# limit the frequencies used to those allowed in the country
#country_code=US
# the country code
ieee80211n=1
# 802.11n support
#wmm_enabled=1
# QoS support
#ignore_broadcast_ssid=0
ssid=645-gateway
# the name of the AP
auth_algs=1
# 1=wpa, 2=wep, 3=both
wpa=2
# WPA2 only
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
wpa_passphrase=elf645Keb1920
</code></pre>
<p>hostapd.service</p>
<pre><code>[Unit]
Description=Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator
Wants=network-online.target
After=systemd-networkd.service
After=sys-subsystem-net-devices-wlan.device
After=sys-subsystem-net-devices-lan.device
BindsTo=sys-subsystem-net-devices-lan.device
[Service]
Type=forking
PIDFile=/run/hostapd.pid
ExecStart=/usr/sbin/hostapd /etc/hostapd/hostapd.conf -P /run/hostapd.pid -B
[Install]
WantedBy=multi-user.target
</code></pre>
<p>30-br-wlan-lan.network</p>
<pre><code>[Match]
Name=wlan
[Network]
Bridge=lan
</code></pre>
| 0non-cybersec
| Stackexchange | 925 | 3,014 |
Preseed failed with exit 2. <p>Preseed does not seem to work for me. When executing the preseee/lat command it fails with exit 2. At this point after trying it 6 times it would be nice to get some advice.</p>
<p>Every time I got an exit 2.</p>
<p>This is the part of the preseed that fails:</p>
<pre><code>d-i preseed/late_command string \
apt-install mednafen mame wget git openssh-server; \
in-target wget --no-check-certificate http://build.ppsspp.org/builds/iOS-fat/ppssppbuildbot-org.ppsspp.ppsspp-1.1.1-ios-fat.deb -O /home/arcadia/ppsspp.deb; \
in target dpkg -i /home/arcadia/ppsspp.deb; \
in-target git config http.sslVerify "false" && git clone https://github.com/Prezto/Arcadia /opt/arcadia; \
in-target echo '#!/bin/bash' > /usr/bin/arcadia; \
in-target echo '/opt/arcadia/Arcadia' > /usr/bin/arcadia; \
in-target chmod a+x /usr/bin/arcadia; \
in-target git config http.sslVerify "false" && git clone https://github.com/Prezto/Arcadia-splash /lib/plymouth/themes/arcadia-splash; \
in-target update-alternatives --install /lib/plymouth/themes/default.plymouth default.plymouth /lib/plymouth/themes/arcadia-splash/arcadia-splash.plymouth 100; \
in-target update-alternatives --set default.plymouth /lib/plymouth/themes/arcadia-splash/arcadia-splash.plymouth; \
in-target cat /etc/systemd/system/getty.target.wants/[email protected] | sed -e "s/ExecStart=-\/sbin\/agetty --noclear \%I \$TERM/ExecStart=-\/sbin\/agetty --autologin arcadia --noclear \%I \$TERM/" > /etc/systemd/system/getty.target.wants/[email protected]; \
in-target mkdir -p /home/arcadia/.config/openbox; \
in-target echo 'hsetroot /lib/plymouth/themes/arcadia-splash/arcadia.png &' > /home/arcadia/.config/openbox/autostart; \
in-target echo 'arcadia &' >> /home/arcadia/.config/openbox/autostart; \
in-target echo 'openbox-session' > /home/arcadia/.xinitrc
</code></pre>
<p>Does anyone see what is wrong with this? And why this would fail?</p>
<p>Update:</p>
<p>After many hours it is clear to me that it is better to copy a script to the target system and execute it there.</p>
<pre><code>d-i preseed/late_command string cp -a /cdrom/preseed/post-install.sh /target/post-install.sh; in-target /bin/bash /post-install.sh
</code></pre>
| 0non-cybersec
| Stackexchange | 857 | 2,273 |
tikzpicture with 4 curves needs adjustment. <p>I would like to replicate the image below (see "Desired output") because it's too murky + I would like to change the labels. </p>
<p>I would appreciate any help that get's me closer to the goal. </p>
<p><strong>Current code</strong></p>
<pre><code>\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[domain=0:3,scale=1.6,thick]
\usetikzlibrary{calc} %allows coordinate calculations.
%Define linear parameters for marginal revenue and demand
\def\dintone{5.5} %Y-intercept for DEMAND_1.
\def\dslpone{-1} %Slope for DEMAND_1.
\def\mintone{4.5} %Y-intercept for MR_1.
\def\mslpone{-1.5} %Slope for MR_1.
\def\dinttwo{2.5} %Y-intercept for DEMAND_2.
\def\dslptwo{-0.4} %Slope for DEMAND_2.
\def\minttwo{2} %Y-intercept for MR_2.
\def\mslptwo{-0.6} %Slope for MR_2.
\def\pmc{1} %marginal cost
\def\demandone{\x,{\dslpone*\x+\dintone}}
\def\marginalrevenueone{\x,{\mslpone*\x+\mintone}}
\def\demandtwo{\x,{\dslptwo*\x+\dinttwo}}
\def\marginalrevenuetwo{\x,{\mslptwo*\x+\minttwo}}
% Define coordinates for D_1 and MR_1.
\coordinate (ints) at ({(\mintone-\dintone)/(\dslpone-\mslpone)},{(\mintone-\dintone)/(\dslpone-\mslpone)*\mslpone+\mintone});
\coordinate (ep) at (0,{(\mintone-\dintone)/(\dslpone-\mslpone)*\mslpone+\mintone});
\coordinate (eq) at ({(\mintone-\dintone)/(\dslpone-\mslpone)},0);
\coordinate (dintone) at (0,{\dintone});
\coordinate (mintone) at (0,{\mintone});
\coordinate (pfqone) at ({(\pmc-\dintone)/(\dslpone)},0);
\coordinate (pfpone) at ({(\pmc-\dintone)/(\dslpone)},{\pmc});
\coordinate (mfqone) at ({(\pmc-\mintone)/(\mslpone)},0);
\coordinate (mfpone) at ({(\pmc-\mintone)/(\mslpone)},{\pmc});
% Define coordinates for D_2 and MR_2.
\coordinate (ints) at ({(\minttwo-\dinttwo)/(\dslptwo-\mslptwo)},{(\minttwo-\dinttwo)/(\dslptwo-\mslptwo)*\mslptwo+\minttwo});
\coordinate (ep) at (0,{(\minttwo-\dinttwo)/(\dslptwo-\mslptwo)*\mslptwo+\minttwo});
\coordinate (eq) at ({(\minttwo-\dinttwo)/(\dslptwo-\mslptwo)},0);
\coordinate (dinttwo) at (0,{\dinttwo});
\coordinate (minttwo) at (0,{\minttwo});
\coordinate (pfqtwo) at ({(\pmc-\dinttwo)/(\dslptwo)},0);
\coordinate (pfptwo) at ({(\pmc-\dinttwo)/(\dslptwo)},{\pmc});
\coordinate (mfqtwo) at ({(\pmc-\minttwo)/(\mslptwo)},0);
\coordinate (mfptwo) at ({(\pmc-\minttwo)/(\mslptwo)},{\pmc});
% DEMAND_1
\draw[thick,color=blue] plot (\demandone) node[right] {$D_1$};
% MARGINAL REVENUE_1
\draw[thick,color=blue] plot (\marginalrevenueone) node[right] {$MR_1$};
% DEMAND_2
\draw[thick,color=black] plot (\demandtwo) node[right] {$D_2$};
% MARGINAL REVENUE_2
\draw[thick,color=black] plot (\marginalrevenuetwo) node[right] {$MR_2$};
% Draw axes, and dotted equilibrium lines.
\draw[->] (0,0) -- (7,0) node[right] {$Q$};
\draw[->] (0,0) -- (0,6) node[above] {$P$};
%MC
\draw[solid,color=red] plot (\x,{\pmc}) node[right] {$MC$};
\draw[dashed] (mfpone) -- (mfqone) node[below] {$Q_1$};
\draw[dashed] (mfptwo) -- (mfqtwo) node[below] {$Q_2$};
\end{tikzpicture}
\end{document}
</code></pre>
<p><strong>Current output</strong></p>
<p><a href="https://i.stack.imgur.com/KWfWj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KWfWj.png" alt="enter image description here"></a></p>
<p><strong>Desired output</strong></p>
<p><a href="https://i.stack.imgur.com/DBHql.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DBHql.jpg" alt="enter image description here"></a></p>
| 0non-cybersec
| Stackexchange | 1,501 | 3,678 |
Manually Installing A New Kernel. <p>For some reason, my kernel got uninstalled.</p>
<p>I have only file called "initrd.img-2.6.26-1-xen-amd64.bak" in my /boot folder. The only other thing is a 'grub' folder.</p>
<p>I booted into a rescue OS, but is there a way to install a kernel manually so that I can boot into my original OS again?</p>
<p>Can I just download a vmlinuz file into that folder and then fix my menu.lst?</p>
| 0non-cybersec
| Stackexchange | 145 | 429 |
Theorem 6.20 rudin Integration. <p>How does he do the algebra? (page 134 Rudin, chapter 6 ,theorem 6.20)</p>
<p>$\left| \frac {F(t)- F(s)}{t-s} -f(x_o) \right| = \left| \frac{1}{t-s} \int_s^t[f(u) - f(x_o)]du \right|< \epsilon $</p>
<p>also, how does he conclude that $F'(x_o) = f(x_0)$</p>
<p>: here is the theorem(and the proof by rudin)</p>
<p>Let $f \in \Re$ on $[a,b]$. For $ a \leq x \leq b$, put: $F(x) = \int_a^x f(t)dt$, Then $F$ is continuous on $[a,b]$; furthermore, if $f$ is continuous at a point $x_0$ of $[a,b]$, then $F$ is differentiable at $x_o$ and $F'(x_0) = f(x_0)$. </p>
<p>(i will omit the proof of continuity of $F$ on $[a,b]$)</p>
<p>Suppose $f$ is continuous at $x_0$. Given $\epsilon > 0 $ choose $\delta > 0$ such that:</p>
<p>$\vert f(t)- f(x_o) \vert < \epsilon $</p>
<p>if $\vert t- x_0 \vert < \delta$, and $a \leq t \leq b $.Hence, if </p>
<p>$x_0 - \delta < s \leq x_0 \leq t < x_0 + \delta$ $\enspace$ with: $a\ \leq s < t \leq b$</p>
<p>we have by theorem 6.12(d)</p>
<p>$\left| \frac{F(t) - F(s)}{t-s} - f(x_0) \right| = \left| \frac{1}{t-s} \int_s^t [f(u) - f(x_0)]du \right| < \epsilon$</p>
<p>it follows that $F'(x_0) = f(x_0)$</p>
| 0non-cybersec
| Stackexchange | 586 | 1,216 |
Python datetime: strftime() codes for decimal numbers. <p>Why does it give error?</p>
<pre class="lang-py prettyprint-override"><code>>>> an = datetime.datetime.now(); an
datetime.datetime(2020, 3, 8, 22, 52, 19, 256487)
>>> datetime.datetime.strftime(an, '%-d')
Traceback (most recent call last):
File "<pyshell#16>", line 1, in <module>
datetime.datetime.strftime(an, '%-d')
ValueError: Invalid format string
</code></pre>
<p>Based on this sources (<a href="https://strftime.org/" rel="nofollow noreferrer">sources1</a>, <a href="https://www.programiz.com/python-programming/datetime/strftime" rel="nofollow noreferrer">sources2</a>) I expected <strong>"8"</strong></p>
| 0non-cybersec
| Stackexchange | 246 | 710 |
How to create your own library for Android development to be used in every program you write?. <p>I am a Delphi programmer and have written, over the years, hundreds of classes and routines which I can use in every Delphi program I write.</p>
<p>This <strong>library</strong> is called dlib and can be <strong>used in every Delphi program</strong> by putting this folder in my library path and using one of the units in the uses section of a Delphi unit.</p>
<p>Being completely new to Java and Android development, I am wondering how to do this in similar way.</p>
<p><strong>So my question, how can I write own classes, put them in some global folder, and use these classes and routines in every Android program I write</strong> ?</p>
<p>I know this is a basic question, which I can probably find out by searching Google and trying it out in Eclipse, but if someone can put me on the right track, I know I will save much time.</p>
<p>Thanks.</p>
| 0non-cybersec
| Stackexchange | 245 | 953 |
How do I exit the w3m help menu?. <p>I'm using scrapy and just discovered the view command from the shell. It brings up the webpage in a very convenient instance of <code>w3m</code>. From <code>man w3m</code>, I learned that <strong>H</strong> brings up the help menu, but despite reading through it, I can't find the proper way to exit it.</p>
<p>I can do <code>C-h</code> which takes me back to history, but there must be a right way of exiting the help menu.</p>
| 0non-cybersec
| Stackexchange | 137 | 467 |
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 get tombstone count for a cql query?. <p>I am trying to evaluate number of tombstones getting created in one of tables in our application. For that I am trying to use nodetool cfstats. Here is how I am doing it:</p>
<pre><code>create table demo.test(a int, b int, c int, primary key (a));
insert into demo.test(a, b, c) values(1,2,3);
</code></pre>
<p>Now I am making the same insert as above. So I expect 3 tombstones to be created. But on running cfstats for this columnfamily, I still see that there are no tombstones created.</p>
<pre><code>nodetool cfstats demo.test
Average live cells per slice (last five minutes): 0.0
Average tombstones per slice (last five minutes): 0.0
</code></pre>
<p>Now I tried deleting the record, but still I don't see any tombstones getting created. Is there any thing that I am missing here? Please suggest.</p>
<p>BTW a few other details,
* We are using version 2.1.1 of the Java driver
* We are running against Cassandra 2.1.0</p>
| 0non-cybersec
| Stackexchange | 295 | 984 |
What exploits involve making long http requests with lots of mostly null byte octals?. <p>I've gotten a lot of strange http requests in my access logs before, like calls to nonexistent WordPress login scripts and application specific locations. I've even gotten a few wise guy requests like <code>...GET /your-site-sucks HTTP/1.1 400...</code>.</p>
<p>I'm curious about some that have varying lengths of octal characters. Here's an example:</p>
<pre><code>x.x.x.x - - [31/Aug/2019:15:20:13 -0400] "\x01A\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" 400 157 "-" "-"
</code></pre>
<p>I understand this as <code>Start of heading start of text null null null null null....</code>.
Looking up the ip address, I found it was labeled as an abusive ip.</p>
<p><strong>What kind of exploit is this particular request looking for?</strong></p>
| 1cybersec
| Stackexchange | 1,000 | 1,822 |
How can I call async method from constructor?. <p>I need to call a <code>async</code> method from my <code>Form1</code> constructor. Since a constructor can't have a return type, I can't add a <code>async void</code>. I read that <a href="https://social.msdn.microsoft.com/Forums/windowsapps/en-US/0d24419e-36ad-4157-abb5-3d9e6c5dacf1/constructor-invoke-async-method" rel="noreferrer">static constructor</a> can be <code>async</code> but I need to call methods from constructor that aren't <code>static</code>, such as <code>InitializeComponent()</code> (since it's the Form's constructor).</p>
<p>The class is:</p>
<pre><code>public partial class Form1 : Form
{
InitializeComponent();
//some stuff
await myMethod();
}
</code></pre>
<p>I read <a href="https://stackoverflow.com/questions/7261173/c-sharp-start-async-method-within-object-constructor-bad-practice">this</a> one too but I still don't know how to implement this (in my case) since the method still requires to use <code>async</code>.</p>
| 0non-cybersec
| Stackexchange | 322 | 1,016 |
Hard drive issue with HFS and windows. <p>I've got a problem with some hard drives. I've had some issues with my MBP and I'm unable to access my account on the computer. (I've been told its a graphical issue with the GPU, it keeps crashing before logging on) I've verified and repaired the disk on the macbook and it says its all great.</p>
<p>Problem is that I have a few confidential files that I need to access quickly and the drive wont show the OSX partition on my windows computer. It shows up as a unknown partition in the Disk management. The windows partition (From bootcamp) shows up in my computer and as a NTFS partition in Disk management. I've tried installing apples bootcamp registry folders to allow my computer to read the disk, I've also gotten paragon HFS+ and HFSExplorer. Nothing comes up.</p>
<p>I would appreciate some help on how I can gain access to my files once more as I really do need to access them urgently. Ideally at no cost (Sending in to HDD specialists etc)</p>
| 0non-cybersec
| Stackexchange | 241 | 1,001 |
Understanding Fatou's lemma. <p>I want to prove that
(without using Fatou's lemma)</p>
<p>for every $k \in N$ let $f_k$ be a nonnegative sequence $f_k(1),f_k(2),\ldots$</p>
<p>$$\sum^\infty_{n=1}\liminf_{k \to \infty} f_k(n) \le \liminf_{k \to \infty} \sum^\infty_{n=1}f_k(n)$$</p>
<p>Can you give some hint for me about that? hat</p>
| 0non-cybersec
| Stackexchange | 151 | 342 |
Android build success but cannot resolve R. <p>help me, my Android cannot resolve symbol R( the R becomes red color) but when i try to build project, it succeed. anybody know why ? i already try clean project, rebuild project, sync project with gradle files and also invalidate cache and restart but still cannot resolve R <a href="https://i.stack.imgur.com/fMEyu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fMEyu.png" alt=""></a></p>
<p>here is my gradle (app):</p>
<pre><code>apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.justinjunias.stockitem"
minSdkVersion 24
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
apply plugin: 'com.google.gms.google-services'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
// Butterknife
implementation 'com.jakewharton:butterknife:8.6.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
//Design
implementation 'com.android.support:design:28.0.0'
//Volley
implementation 'com.android.volley:volley:1.1.1'
//Firebase
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-database:16.0.6'
implementation 'com.google.firebase:firebase-auth:16.2.0'
implementation 'com.google.firebase:firebase-firestore:18.1.0'
}
</code></pre>
<p>And my gradle build: </p>
<pre><code>// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
//Firebase
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
</code></pre>
| 0non-cybersec
| Stackexchange | 840 | 2,710 |
Why websocket needs an opening handshake using HTTP? Why can't it be an independent protocol?. <p><em>Websocket is designed in such a way that its servers can share a port with HTTP servers, by having its handshake be a valid HTTP Upgrade request.</em></p>
<p>I have a doubt in this design philosophy.
Any ways the WebSocket Protocol is an independent TCP-based protocol.</p>
<p>Why would we need this HTTP handshake(upgrade request) and a protocol switching. Instead why can't we directly(& independently) follow a websocket like protocol?</p>
| 0non-cybersec
| Stackexchange | 142 | 555 |
Creating Two NFS Shares: One Read/Write and One Read Only. <p>Hopefully this is an easy question!</p>
<p>Background:
I am currently using Ubuntu 12.04 as a home media server running MythTV and using XBMC as frontends on both Windows and Ubuntu. My media is shared via SMB and NFS, but I use NFS primarily for the XBMC frontends because the lower overhead translates into significantly better performance.</p>
<p>What I Want:
What I would like to do is to create two NFS shares to my media files. One share I would like to be read/write, and the other share I would like to be read only. This way, I can set up a frontend for my roommate, for example, where he can access the files for viewing, but not screw anything up.</p>
<p>Since I can't create two identical NFS shares, one read/write and one read-only, I tried to create two mounts to differentiate them.</p>
<p>In /etc/fstab, I have the following device mounted:</p>
<pre><code>/dev/stb1 /mnt/Media ext4 defaults 0 0
</code></pre>
<p>And in /etc/exports, I have the following NFS share:</p>
<pre><code>/mnt/Media *(rw,async,all_squash,insecure,anonuid=1001,anongid=122,no_subtree_check)
</code></pre>
<p>The above works fine for read/write access. My intention was to create a second, read-only mount, and then export it via NFS as /mnt/Media_ReadOnly. So I've tried to create the second mount as follows:</p>
<pre><code>/dev/stb1 /mnt/Media_ReadOnly ext4 ro,auto,user,noexec 0 0
</code></pre>
<p>but I get an error:</p>
<pre><code>mount: according to mtab, /dev/sdb1 is mounted on /mnt/Media
</code></pre>
<p>So I guess I can't mount the same device twice?</p>
<p>How can I export the same path via NFS in a read-only format?</p>
| 0non-cybersec
| Stackexchange | 543 | 1,706 |
Difference between os.getenv and os.environ.get. <p>Is there any difference at all between both approaches?</p>
<pre><code>>>> os.getenv('TERM')
'xterm'
>>> os.environ.get('TERM')
'xterm'
>>> os.getenv('FOOBAR', "not found") == "not found"
True
>>> os.environ.get('FOOBAR', "not found") == "not found"
True
</code></pre>
<p>They seem to have the exact same functionality.</p>
| 0non-cybersec
| Stackexchange | 164 | 415 |
What are the advantages and disadvantages of different types of motion sensors?. <p>I understand there are a number of different motion sensor technologies out there, including Active Infrared (AIR), Passive Infrared (PIR), Microwave and Ultrasonic motion sensors. </p>
<p>I would like to know what the advantages and disadvantages of these different types of motion sensors are and what (if any) vulnerabilities exist in them. </p>
<p>Additionally, have I overlooked any other similar motion sensing devices?</p>
<hr>
<p>Edit: just to clarify, human based motion sensors is what im interested in. Practical, non-theoretical technologies. This question isn't to do with vibration sensors, glass break sensors etc</p>
<p>Edit: To limit the scope somewhat, lets stick to more common types of motion sensors rather than exotic situation specific types?</p>
| 0non-cybersec
| Stackexchange | 204 | 859 |
Question on numbers modulo $(n+1)!$. <p>I just noticed the following surprising 'fact' (it holds at least for low values of n):</p>
<p>Pick any number k < $(n+1)!$</p>
<p>Consider the n products $ki$ with $1 \le i \le n$, i.e. $k, 2k, ... nk$ modulo $(n+1)!$.</p>
<p>In at least one of these cases, this modulus will at either:</p>
<ul>
<li>be at most $n!$, or</li>
<li>be at least $(n+1)! - n!$</li>
</ul>
<p>So basically it will lie in the range $[-n!, n!]$ modulo $(n+1)!$.</p>
<p>For example, let n = 5.
Here, $(n+1)! = 720$.</p>
<p>Pick a random number in $[0, 720]$, say $489$. We get $n = 5$ products:</p>
<ul>
<li>$489 * 1 \mod 720 = 489$</li>
<li>$489 * 2 \mod 720 = 258$</li>
<li>$489 * 3 \mod 720 = 27$</li>
<li>$489 * 4 \mod 720 = 516$</li>
<li>$489 * 5 \mod 720 = 285$</li>
</ul>
<p>Although we managed to escape in four cases, with $i=3$ we ended up with a residue of $27$ which lies between $-120$ and $120$.</p>
<p>Any ideas on how to prove that this will always happen? Or maybe a counter-example?</p>
| 0non-cybersec
| Stackexchange | 416 | 1,032 |
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 |
Partitions that separate all subsets. <p>Let $A=\{1,2,\dots,n\}$ and let $\mathcal{A}_1,\dots,\mathcal{A}_k$ be partitions of $A$ into two sets. Suppose that for each subset $B\subseteq A$ of even size, there exists a partition $\mathcal{A}_i$ such that half the elements of $B$ is in one part of the partition and the other half is in the other part. What is the minimum possible $k$ for which this is possible?</p>
<p>An asymptotic bound for $k$ would already be good enough. For example, can we use just $k=O(n)$ partitions? Or even some polynomial in $n$ partitions?</p>
<p>If we only consider subsets $B$ of size two, then we can do it with $\log n$ partitions by writing each element of $A$ in base two and have $\mathcal{A}_i$ be the partition according to whether the $i$th digit is $0$ or $1$. However this does not work when $B$ is of arbitrary size: For example among the four numbers $001,010,011,111$, none of the digits has $0$ and $1$ appearing twice each.</p>
| 0non-cybersec
| Stackexchange | 283 | 978 |
Why is there no "pathspec" when I try to remove a folder in Git?. <p>I am trying to remove a folder from my Git repository with</p>
<pre><code>git rm folderToRemove
</code></pre>
<p>but Git issues this error when I try to do so.</p>
<pre><code>fatal: pathspec 'siteFiles/applicationFiles/templates/folderToRemove'
did not match any files
</code></pre>
<p>My current directory is "templates." I am finding this error odd since I can <code>cd</code> into the folder "folderToRemove," so it clearly exists. What does this error mean?</p>
| 0non-cybersec
| Stackexchange | 167 | 550 |
Strange entry in Apache log. <p>in my <a href="https://serverfault.com/questions/215074/strange-stuff-in-apache-log">previous pos</a>t I got something weird in Apache log. Again, I found something strange, but what freaks me out is the response code. It's not 501 anymore, but 200. What do you say? Should I enable the paranoid-mode? Here's the entry:</p>
<pre><code>***.***.***.*** - - [02/Feb/2011:00:42:51 +0100] "=\xa29)\x84\x11\xd0O\xa7@\xbd\x8f\xc4G\x96T\xf4" 200 25564
</code></pre>
| 1cybersec
| Stackexchange | 180 | 491 |
60% CPU Usage just moving my mouse around | Ubuntu 18.04. <p>So last night I decided to return to Linux after reviewing the way Microsoft manufactures consent for surveillance type behaviour on their Windows operating system.</p>
<p>I'm having a problem with high CPU usage just moving around my mouse in Firefox I get 30% CPU usage and 30% web content usage which seems a tad high for my CPU which is actually an AMD A10-4655m APU with Radeon HD graphics × 4. This problem also occurs just moving my mouse over the dock icons to the left which causes the CPU usage to spike to 30% also for gnome-shell.</p>
<p>The machine feels sluggish, I have looked in the additional drivers area but there are no additional drivers available and I am kind of stuck from where to go from here so I am relying on your kind responses.</p>
<p>There is actually a post from 2012 <a href="https://askubuntu.com/questions/166538/problems-with-ubuntu-and-amd-a10-4655m-apu">here</a> which tells you how to install proprietary drivers but on installation I did check the mark to install 3rd party drivers at the point of installation.</p>
<p>Is there any way to fix this problem and give me a bit of speed so I can stick with Ubuntu. Thank you for taking the time to help me out in advance.</p>
| 0non-cybersec
| Stackexchange | 321 | 1,278 |
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 |
HD images on eCommerce and SEO. <p>I have an eCommerce website where product images are currently resized to 250x250 max and shown to the user. I shrink the original high-definition images to a size that makes it possible for the page to load quickly.</p>
<p>This is what is currently being done:</p>
<ul>
<li>Images are part of the Product microdata information.</li>
<li>Every product image is listed on my website's sitemap.xml</li>
<li>The product image is loaded via an IMG tag.</li>
</ul>
<p>I want to take advantage of the HD version that I keep on my server, and show it to users in a friendly way, but also want to help images rank.</p>
<p>How can I get Google to associate my image in the most SEO friendly way? I could possibly replace the image on the sitemap with the HD version.</p>
<p>However, what bothers me is that I can't seem to do the same for the Product snippet, since Google hates hidden content, and I certainly don't want the HD image to be loaded when the product page is loaded. Are there any alternatives to actually loading the full-sized image?</p>
| 0non-cybersec
| Stackexchange | 289 | 1,085 |
D3 bar chart background with dots. <p>I found this d3 example showing a bar chart with a solid background and a diagonal line pattern. I'm trying to modify it to show dots, solid, white circles instead of lines, by modifying the 'd' attribute, but think there is probably a better way to do this. </p>
<p>This is my fiddle showing diagonal lines:</p>
<p><a href="http://jsfiddle.net/ljp007/gruc1vod/1/" rel="nofollow noreferrer">http://jsfiddle.net/ljp007/gruc1vod/1/</a></p>
<pre><code>var svg = d3.select("body").append("svg");
svg
.append('defs')
.append('pattern')
.attr('id', 'diagonalHatch')
.attr('patternUnits', 'userSpaceOnUse')
.attr('width', 4)
.attr('height', 4)
.append('path')
.attr('d', 'M-1,1 l2,-2 M0,4 l4,-4 M3,5 l2,-2')
.attr('stroke', '#fff')
.attr('stroke-width', 1);
svg.append("rect")
.attr("x", 0)
.attr("width", 100)
.attr("height", 100)
.style("fill", 'blue');
svg.append("rect")
.attr("x", 0)
.attr("width", 100)
.attr("height", 100)
.attr('fill', 'url(#diagonalHatch)');
</code></pre>
<p>and here is what I'm trying to achieve:</p>
<p><a href="https://i.stack.imgur.com/QYA1m.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QYA1m.png" alt="enter image description here"></a></p>
<p>The dots do not plot data but are simply for appearance to distinguish this bar from others in the chart. How can I convert the lines to dots to achieve this?</p>
| 0non-cybersec
| Stackexchange | 521 | 1,475 |
Definition of a Manifold from Guillemin Pollack. <p>I have been studying differential topology from Guillemin and Pollack (GP).
Unlike many other books that define differentiable manifolds using maximal atlases GP starts by saying $ X \subset R^{N}$ for some ambient space $R^{N}$ and then goes on to define a $k$ dimensional manifold. But I know that this containment comes due to a weak version of Whitney's theorem.</p>
<p>Later on when they prove Whitney's theorem it is done so by induction on $N >= 2k+1$. But how to I justify that $ X \subset R^{N}$ in the first place? How can it just be assumed in definition like that?</p>
<p>I need help getting from the general definition of manifolds using atlases to the weak version of Whitney.</p>
<p>Thanks</p>
| 0non-cybersec
| Stackexchange | 202 | 767 |
Can I upgrade to Linux 3 Kernel on Ubuntu 10.10?. <p>I need to use Linux 3, becasue with Linux 2.6.x has display problems with my SandyBridge integrated graphic. On the other hand, I need to downgrade to Ubuntu 10.04/10 because <a href="http://www.betavine.net/bvportal/resources/datacards/os/ubuntu" rel="nofollow">Betavine</a> packages for running my mobile broadband modem work only with Ubuntu 10.04 (and 10.10). Hence I need to make a compromise. I appreciate your hints. </p>
| 0non-cybersec
| Stackexchange | 142 | 483 |
A limit coming from high school. <p>I'm sure you guys can do this in many ways, using integrals, Taylor series, but I need a<br>
high school way, like the use of a simple squeeze theorem. Can we get such a way? </p>
<p>$$\lim_{n\to\infty}\left(1+\log\left(1+\frac{1}{n^2}\right)\right)\left(1+\log\left(1+\frac{2}{n^2}\right)\right)\cdots\left(1+\log\left(1+\frac{n}{n^2}\right)\right)$$</p>
<p><strong>EDIT</strong>: The proof I need I plan to present to some kids, so everything should be clear for them.</p>
| 0non-cybersec
| Stackexchange | 180 | 513 |
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 |
want to get rid of the gap between \mathcal{F} and \mid_S. <p>With this code</p>
<p><pre><code>
\documentclass[12pt]{amsart}
\usepackage{pstricks}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{latexsym,amsmath}
\usepackage{graphicx}
\usepackage{stmaryrd}</p>
<p>\begin{document}</p>
<p>$L^{2}(\mathcal{F})\cong L^{2}(\Gamma)\otimes
L^2(\mathcal{F}\mid_{S})\cong L^{2}(\Gamma) \otimes
L^2(\mathcal{F}_{\Gamma})$</p>
<p>\end{document}
</pre></code></p>
<p>how do I get rid of the gap between the F and the \mid_S ?</p>
| 0non-cybersec
| Stackexchange | 218 | 552 |
Doctrine 2.1 where foreign key id =?, edit: Fixed in Doctrine 2.2. <p>I've looked at a lot of answers here related to what seems to be a serious lack of functionality in Doctrine 2.1 that may be the result of OOP correctness trumping relational sanity. </p>
<p>I have two tables with a many to one relationship, Articles and Members. A Member can have many published Articles. The annotation on the owning side is</p>
<pre><code>/**
* @var \Member
* @ORM\ManyToOne(targetEntity="Member")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="member_id", referencedColumnName="id")
* })
*/
private $member;
</code></pre>
<p>I want to get all active articles for member 6, this is a simple query in SQL: </p>
<pre><code>SELECT * FROM mbr_article
WHERE active = 1 AND member_id = 6
ORDER BY article_id DESC
</code></pre>
<p>What I ended up with was </p>
<pre><code>$rep = $this->getDoctrine()->getRepository('SMWMemberBundle:Article');
$q = $rep->createQueryBuilder('a')
->leftJoin('a.member','m')
->where('m.id = ?1')
->andWhere('a.active = 1')
->orderBy('a.id', 'DESC')
->setParameter(1, $id)
->getQuery();
</code></pre>
<p>which generated</p>
<pre><code>SELECT m0_.id AS id0, m0_.active AS active1, m0_.update_time AS update_time2,
m0_.content AS content3, m0_.member_id AS member_id4
FROM mbr_article m0_
LEFT JOIN mbr_member m1_ ON m0_.member_id = m1_.id
WHERE m1_.id = ? AND m0_.active = 1
ORDER BY m0_.id DESC
</code></pre>
<p>which works and probably isn't much slower, but that JOIN is not needed as I already have the Member object. When I tried it the other way, I got all Articles not just active ones. </p>
<p>I've seen responses such as <a href="https://stackoverflow.com/questions/8211679/can-you-get-a-foreign-key-from-an-object-in-doctine2-without-loading-that-object">Can you get a foreign key from an object in Doctine2 without loading that object?</a> that use <code>getEntityIdentifier</code> and mentions improvements coming in the 2.2 where I could say <code>IDENTITY(member)</code>. </p>
<p>Is there a reasonable way to do this in Doctrine 2.1? Will the enhancement allow <code>andWhere('IDENTITY(member) = ?')</code> in the query builder? </p>
<p>Edit:</p>
<p>Thanks to @Ocramius, ->where('IDENTITY(a.member) = ?1') does work in Doctrine 2.2</p>
| 0non-cybersec
| Stackexchange | 805 | 2,382 |
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 |
Backbone.js: communication between views. <p>I'm working on a Backbone app that contains a list of entries, much like the example app Todos (<a href="http://documentcloud.github.com/backbone/examples/todos/index.html" rel="nofollow noreferrer">http://documentcloud.github.com/backbone/examples/todos/index.html</a>).</p>
<p>So, I have an App view and one view per list item. Now, say I have a global edit button. The App view would handle a click and what I then want to do is tell each list view to show a delete button. </p>
<p>In the screenshots below (from Spotify), pressing the Edit button causes all list views to change appearance.</p>
<p>What's the best way to do this with Backbone. I need to iterate over all list views and call a editMode function. But the App view (out of the box) doesn't know about the list views..</p>
<p><img src="https://i.stack.imgur.com/xkoVx.png" alt="enter image description here"></p>
| 0non-cybersec
| Stackexchange | 274 | 930 |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange | 349 | 1,234 |
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 |
Error installing Canon LBP 2900 on Ubuntu 18.04. <p><a href="https://i.stack.imgur.com/eHWzP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eHWzP.png" alt="error image"></a></p>
<p>I've been trying to install Canon LBP 2900 driver on my Ubuntu 18.04 for the past few days. I tried following many tutorials such as <a href="https://askubuntu.com/questions/920841/how-to-install-canon-lbp2900b-printer-in-ubuntu-16-04-lts">How to install canon lbp2900b printer in ubuntu 16.04 lts</a>, and also tried installing via GUI by downloading <a href="https://www.canondriver.net/canon-lbp-2900-driver-linux/" rel="nofollow noreferrer">this driver</a>. I'm having problems installing.</p>
<pre><code>Preparing to unpack cndrvcups-capt_2.71-1_amd64.deb ...
Unpacking cndrvcups-capt (2.71-1) ...
dpkg: dependency problems prevent configuration of cndrvcups-capt:
cndrvcups-capt depends on cndrvcups-common (>= 3.21); however:
Version of cndrvcups-common on system is 2.60-1.
dpkg: error processing package cndrvcups-capt (--install):
dependency problems - leaving unconfigured
Processing triggers for systemd (237-3ubuntu10.2) ...
Processing triggers for ureadahead (0.100.0-20) ...
Errors were encountered while processing:
cndrvcups-capt
</code></pre>
<p>How can I get this printer working?</p>
| 0non-cybersec
| Stackexchange | 446 | 1,312 |
Proof that $\frac{1}{2} > 0$ using order properties of $\mathbb R$. <p>Let <span class="math-container">$\mathbb P$</span> be a non-empty subset of <span class="math-container">$\mathbb R$</span> such that for all <span class="math-container">$a, b \in \mathbb P$</span>,</p>
<ul>
<li><span class="math-container">$a + b \in \mathbb P$</span></li>
<li><span class="math-container">$ab \in \mathbb P$</span></li>
<li>Exactly one of the following holds:
<span class="math-container">$a \in \mathbb P$</span>, <span class="math-container">$-a \in \Bbb P$</span>, <span class="math-container">$a = 0$</span>.</li>
</ul>
<p>I already know that <span class="math-container">$n > 0$</span> for all <span class="math-container">$n\in \mathbb N$</span>. How do I show that <span class="math-container">$\frac{1}{2} > 0$</span>, or, in general, <span class="math-container">$\frac{1}{n} > 0$</span>? My initial attempt at doing this was to assume by contradiction that <span class="math-container">$\frac{1}{2} < 0$</span>. Then by definition, <span class="math-container">$-\frac{1}{2} \in \mathbb P$</span>. My question is, can I assume that <span class="math-container">$-\frac{1}{2} - \frac{1}{2} = -1$</span> if I'm basing this on the algebraic properties of <span class="math-container">$\mathbb R$</span> where <span class="math-container">$\mathbb R$</span> is treated as a field?</p>
<p>For instance, although it's obvious that <span class="math-container">$1*0 = 0$</span> in common sense math, in field theory, it is proven rigorously (a.k.a the annihilator property). Does a similar idea apply for other numbers in the field, for instance, the number <span class="math-container">$\frac{1}{2}$</span>?</p>
<p>Thanks in advance.</p>
| 0non-cybersec
| Stackexchange | 589 | 1,754 |
What are those nul bytes doing in Certificate Subject CN?. <p>While doing some research with SSL certificates, I found some weird certificates containing nul bytes in their Subject field. One example is <code>www.refah - bank.ir</code> (did the Iranian government fake this CA? It looks very similar to a Spanish CA except for location...).</p>
<p>Another example is <code>mcafee.com</code> which looks more trustworthy to me. They have two different IP addresses for <code>mcafee.com</code> and <code>www.mcafee.com</code>, the certificate also differs. What surprised me was that such a company uses certificates containing nul bytes in their Subject field:</p>
<pre><code>Data:
Version: 3 (0x2)
Serial Number:
c8:e6:3c:67:a8:7f:38:ba:c9:ab:06:ef:4e:68:67:0d
Signature Algorithm: sha1WithRSAEncryption
Issuer: O=Network Associates, OU=NAI Certificate Services, CN=NAI SSL CA v1
Validity
Not Before: Aug 26 20:36:38 2008 GMT
Not After : Apr 26 09:28:50 2019 GMT
Subject: C=US, ST=Texas, L=Plano, O=McAfee, Inc, OU=IIS-Plano, CN=\x00*\x00.\x00m\x00c\x00a\x00f\x00e\x00e\x00.\x00c\x00o\x00m
</code></pre>
<p>Opening <code>mcafee.com</code> correctly rejected the certificate as the wildcard does not match against this. Out of curiosity, I edited my host file and made <code>foo.mcafee.com</code> (and <code>www.</code>) point to the IP address 161.69.13.40 (mcafee.com).
I would expect such a certificate to be rejected, but Firefox and Chromium both accept this certificate.</p>
<p>I found another website that has nul bytes in the CN and is still "trusted": <a href="https://www.digiturk.com.tr">https://www.digiturk.com.tr</a></p>
<p>What is happening here?</p>
| 0non-cybersec
| Stackexchange | 561 | 1,714 |
dont you hate it when you're a guest in someone's house who you don't know too well and they hand you the TV remote and tell you, "put on whatever you want!". I get anxious. What do i do??? Do i change what they had on? Should I keep the TV off? What if i want to watch something i know they have no interest in? What if I have NO IDEA what to watch??? I normally just go on the guide for a long time (something i never even do lol) and end it with like "gee i don't know" or something like that. awfully awkward! | 0non-cybersec
| Reddit | 134 | 514 |
Get and display the selected variation SKU in WooCommerce. <p>I have this code that works for simple product type but not for variable products in WooCommerce: </p>
<pre><code>add_shortcode( 'product_sku_div', 'wc_product_sku_div');
function wc_product_sku_div() {
global $product;
return sprintf( '<div class="widget" sp-sku="%s"></div>', $product->get_sku() );
}
</code></pre>
<p>How can I make it work for both simple and variable products?</p>
| 0non-cybersec
| Stackexchange | 168 | 476 |
Subsets and Splits