text
stringlengths
3
1.74M
label
class label
2 classes
source
stringclasses
3 values
Why Homebrew is connecting to Google analytics and how to disable it?. <p>I've noticed that when I run :</p> <pre><code>brew update </code></pre> <p>Homebrew is connecting to Google analytics. Why? And how to disable it?</p>
0non-cybersec
Stackexchange
How to get a list of all the labels in a LaTeX document in WinEdt. <p>I am writing a large document using LaTeX and WinEdt. I have labeled each chapter, section and so on. I would like to print out a list of just the labels (so that I don't duplicate one later on, and so that I have it handy in order to write <code>\ref</code>s). </p> <p>Is there a way to do this?</p>
0non-cybersec
Stackexchange
My schools “Gaming Club” 🤦🏻‍♂️.
0non-cybersec
Reddit
Biblatex cite with footnote only once, with use of brackets. <p>I've started putting into practice the answer to <a href="https://tex.stackexchange.com/questions/20637/biblatex-which-style-for-a-footnote-once-then-nothing/20741#20741">this question</a>. Yet I would like to change this so that there are brackets around the citations:</p> <ul> <li>in the superscript in text, </li> <li>in the superscript in footnote, </li> <li>in the bibliography.</li> </ul> <p>I've managed to get the first one and the last one working. The second one however, I don't know how to do this. </p> <p>Note that I mainly write in english and in dutch, so I don't think there is much babel interference.</p> <p>Also, would there be a way to order the footnotes so that first all ''normal'' <code>\footnote{}</code> are printed and below that all <code>\sfcite{}</code> citational footnotes (per page that is)?</p> <p>Here's what I've managed to concoct:</p> <pre><code>\documentclass{article} \usepackage[english]{babel} \usepackage[pdfborder={0 0 0}]{hyperref} \usepackage[citestyle=numeric-comp,sorting=none,hyperref]{biblatex} \usepackage{filecontents} % No brackets around the number of each bibliography entry \DeclareFieldFormat{labelnumberwidth}{\textbf{[#1]}} %--------------------------------------------------------------- % Essentially verbatim from Joseph Wright % http://www.texdev.net/2010/03/08/biblatex-numbered-citations-as-footnotes/ \makeatletter \ExecuteBibliographyOptions{citetracker,sorting=none} \DeclareCiteCommand{\notefullcite}[\mkbibbrackets] {\usebibmacro{cite:init}% \usebibmacro{prenote}} {\usebibmacro{citeindex}% \usebibmacro{notefullcite}% \usebibmacro{cite:comp}} {} {\usebibmacro{cite:dump}% \usebibmacro{postnote}} \newbibmacro*{notefullcite}{% \ifciteseen {} {\footnotetext[\thefield{labelnumber}]{% \usedriver{}{\thefield{entrytype}}\addperiod}}} \DeclareCiteCommand{\sfcite}[\cbx@superscript]% {\usebibmacro{cite:init}% \let\multicitedelim=\supercitedelim \iffieldundef{prenote} {} {\BibliographyWarning{Ignoring prenote argument}}% \iffieldundef{postnote} {} {\BibliographyWarning{Ignoring postnote argument}}} {\usebibmacro{citeindex}% \usebibmacro{sfcite}% \usebibmacro{cite:comp}} {} {\usebibmacro{cite:dump}} \newbibmacro*{sfcite}{% \ifciteseen {} {\xappto\cbx@citehook{% \noexpand\footnotetext[\thefield{labelnumber}]{% \fullcite{\thefield{entrykey}}\addperiod}}}} \newrobustcmd{\cbx@superscript}[1]{% \mkbibsuperscript{[#1]}% \cbx@citehook \global\let\cbx@citehook=\empty} \let\cbx@citehook=\empty \makeatother %--------------------------------------------------------------- \begin{filecontents}{\jobname.bib} @article{ref1, hyphenation = {american}, title = {Natural Products as Sources of New Drugs over the Last 25 Years}, author = {Newman, D.J. and Cragg, G.M.}, journal = {J. of Nat. Prod.}, volume = {70}, number = {3}, pages = {461--477}, year = {2007}} @article{ref2, hyphenation = {american}, title = {Natural products as leads to potential drugs: an old process or the new hope for drug discovery?}, author = {Newman, D.J.}, journal = {J. of Med. Chem.}, volume = {51}, number = {9}, pages = {2589--2599}, year = {2008}} @online{ref3, author = {Quintin, C.}, title = {Les eponges}, url = {http://christophe.quintin.pagesperso-orange.fr/Liste_Doc.html}, urldate = {2009-05-03} } \end{filecontents} \addbibresource{\jobname.bib} \begin{document} First citation.\sfcite{ref1,ref2} Some text\footnote{A footnote}. \pagebreak Second citation\sfcite{ref1}, second citation\sfcite{ref2}, first citation.\sfcite{ref3} \printbibliography \end{document} </code></pre>
0non-cybersec
Stackexchange
How to deal with a bad/ unfair DM?. Let's ignore the (No DnD>DnD). I have tried talking to him after almost every session, and he doesn't listen. He's also the only source for DnD in the area. 1). He changes DM calls between sessions, without telling anyone, until they try to do something that he previously said yes to. Then he tells them they can't do it. 2). He'll make certain ability checks fail for some characters, but make others succeed. 3). I can't use investigation (which he said was used to put together various clues) to try and figure out what these clues mean, effectively creating an unsolvable puzzle. 4). Companions that get their own initiative rolls, just go after their owner/controller's turn, effectively limiting certain strategies. 5). Certain characters get useful items when they scavenge, but other characters don't. *(Such as when I search a boss and find absolutely nothing, but another person searches some rotting corpse and finds a +1 longsword)* These are just a few examples, and I know I'm complaining, but this is my only way to play DnD.
0non-cybersec
Reddit
DRM on CSS or even HTML files through domain locking via Javascript?. <p>If you are planning to downvote me to oblivion, let me clarify what this question is about:</p> <ol> <li>I am not interested to prevent someone from copying my website. I know there are no foolproof method.</li> <li>My goal here is to merely make it more difficult for <strong>non-technical</strong> users who are ripping my site via right-click save-as on their browser.</li> </ol> <p>I have tried out JSCrambler and it seems like their ability to <strong>obfuscate javascript files</strong> are pretty good. They even have <strong>domain locking</strong> which renders an obfuscated js file useless on a domain not specified at the time of compilation. The technology is pretty solid.</p> <p>So that brings up another question:</p> <h2>Will it be possible to protect your CSS?</h2> <p>I thought about creating a <code>&lt;style&gt;</code> element via javascript and appending it to the document. On Chrome, saving this as a complete page will result in a page with the said <code>&lt;style&gt;</code> element included in the html itself.</p> <p>This is where I am out of ideas. Is it possible to have a way of styling your elements through javascript that will not be saved by the browser?</p> <p><strong>EDIT</strong></p> <p>Let me clarify what the <strong>exact</strong> use case is:</p> <p>I run an affiliate marketing website specializing in advertising for Amazon products. There is someone on the internet, Joe, who is visiting my site and right click saving it to run as his own. Joe <strong>does not know</strong> CSS or Javascript, and he is lazy. He is not willing to spend more than a few minutes trying to figure out how to rip my website - this means that he will not bother to screenshot it and reconstruct it from scratch as it is too troublesome for him. Disabling right click save-as doesn't work anymore as a simple google search will reveal a solution available on the menu.</p> <p>All I need is enough disincentive to discourage Joe from ripping my site. There are other affiliate websites he can rip. He is not interested to spend a long time trying to rip <strong>mine</strong> if there are alternative available. If Joe has to learn CURL from a command line to download my page, it is probably enough incentive to discourage him.</p> <p>Right now, my affiliate website utilizes no javascript as it's purely html and css.</p>
1cybersec
Stackexchange
Some keyboard keys in Lenovo Ideapad 320E-15IKB D not working after Ubuntu 18.04.1 LTS installation. <ul> <li>Laptop: Lenovo Ideapad 320E-15IKB D,</li> <li>Memory: 8 GB,</li> <li>Processor: Intel® Core™ i5-7200U CPU @ 2.50GHz × 4,</li> <li>Graphics: Intel® HD Graphics 620 (Kaby Lake GT2),</li> <li>OS Type: 64-bit,</li> <li>HDD: 1 TB.</li> </ul> <p>I bought this laptop with pre-installed Windows 10. Now I have installed only one OS, Ubuntu 18.04.1 LTS. Everything is going smooth but some keys like "Q", "P", "Tab", "Backspace" etc are not working at all, whereas the onscreen keyboard is working fine.</p> <p>I have tried enough by changing keyboard layout and many other ways as described on internet to get the solutions, but no result. Region &amp; Language in the system are currently set as follows,</p> <ul> <li>Language: English (United States),</li> <li>Formats: United States,</li> <li>Input Sources: English (US).</li> </ul> <p>How can I fix debug this issue?</p>
0non-cybersec
Stackexchange
TIL: Men have a tiny functionless uterus in their prostate called a prostatic utricle..
0non-cybersec
Reddit
Not enough storage for El Capitan; no way to free up space. <p>I wanted to upgrade my Macbook 2008 from Yosemite to El Capitan. Unfortunately, when I downloaded it and restarted my computer, on the "select the disk on which to install" page the only location, Macintosh HD, didn't have enough space (by about 2 GB). It doesn't seem like there's a way to free up space from this startup menu, though. I can open Disk Utility from this menu, and it seems logical to put some method of freeing up disk space from there, but if there is, I can't find it.</p> <p>Is there a way to get out of this startup menu so I can free up space, or a way to free up space directly from the menu? This is pretty frustrating because it seems like a major design flaw if it tells you you don't have enough storage for a certain thing, but it doesn't let you free up the storage to download the thing.</p> <p>There's already a question exactly like mine: <a href="https://apple.stackexchange.com/questions/233300/stuck-in-update-boot-not-enough-disk-space">Stuck in update boot (not enough disk space)</a> But no one has answered it, so I think it's okay to ask it again.</p> <p>EDIT: I can also access Terminal which I could potentially also use</p> <p>EDIT AGAIN: Nevermind, it looks like Macintosh HD is read-only while I'm in this boot menu. At least terminal says "read-only file system" when I try to use rmdir on something.</p>
0non-cybersec
Stackexchange
Heard you were looking for a stud.... I got the STD, now all I need is u.
0non-cybersec
Reddit
Reducing space between table rows. \arrayrowstretch and \extrarowheight not working. <p>How do I decrease the space between the rows in the table shown? I was unable to do so using <code>\arrayrowstretch</code> and <code>\extrarowheight</code>. Here is the code I used:</p> <pre><code>\newcommand*{\cvpressentry}[4]{ {\setlength\tabcolsep{1ex}} {\setlength{\extrarowheight}{0pt}} \def\arraystretch{0.7} \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}L{1.5cm} L{14.5cm}} \publdatestyle{#1} &amp; \publpubtitlestyle{#2} \publauthorstyle{#3} \publvenuestyle{\href{#4}{\faExternalLink}} \end{tabular*} </code></pre> <p><a href="https://i.stack.imgur.com/cpb2Y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cpb2Y.png" alt="table with row borders showing the space between the rows"></a></p> <p>The table <code>\hline</code>s are added for clarity of the issue.</p> <p>UPDATE: Based on the Sveinung's observation of separate tabular environments, I removed it and made it into a single tabular environment and it solved the problem.</p>
0non-cybersec
Stackexchange
How to replace certain data frame value with it&#39;s unknown column name?. <p>I have a large data frame with unknown column names and numeric values 1, 2, 3, or 4. Now I want to replace all 4 values with it's column name and all 1, 2 and 3's with an empty value. </p> <p>Ofcourse I can make a loop of some kind, like this:</p> <pre><code>df &lt;- data.frame(id=1:8,unknownvarname1=c(1:4,1:4),unknownvarname2=c(4:1,4:1)) for (i in 2:length(df)){ df[,i] &lt;- as.character(df[,i]) df[,i] &lt;- mgsub::mgsub(df[,i],c(1,2,3,4),c("","","",names(df)[i])) } </code></pre> <p>This would be the result:</p> <pre><code> id unknownvarname1 unknownvarname2 1 1 unknownvarname2 2 2 3 3 4 4 unknownvarname1 5 5 unknownvarname2 6 6 7 7 8 8 unknownvarname1 unknownvarname2 </code></pre> <p>For a data frame this size that's no problem at all. But when I try this loop on large data frames with up to 30k and up to 40 uknown variables, the loop takes ages to complete.</p> <p>Does anyone know of a faster way to do this? I tried functions like <code>mutate()</code> of <code>dplyr package</code> but I could not manage to make it work.</p> <p>Many thanks in advance!</p>
0non-cybersec
Stackexchange
Why Life is Absurd.
0non-cybersec
Reddit
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
How Warframe built an ethical free-to-play economy.
0non-cybersec
Reddit
how to refresh facebook access token for server side (in facebook-php SDK)?. <p>I'm using the Facebook PHP SDK to call relevant APIs to post and get data. At present I'm saving a user access token in the database but it expires after 60 days. How can I refresh a user access token? </p> <p>1 . When do I need to refresh the access tokens? After it expires, or before?</p> <p>2 . What is the best way to refresh access tokens?</p> <p>3 . Should my users need to login again to refresh access token? </p> <p>This is the function that I'm using to extend the access token. but expire time remain same.</p> <pre class="lang-php prettyprint-override"><code>public function getExtendedAccessToken($access_token) { $token_url="https://graph.facebook.com/oauth/access_token"; $params=array('client_id'=&gt;self :: appId,'client_secret'=&gt;self :: appSecretId,'grant_type'=&gt;'fb_exchange_token','fb_exchange_token'=&gt;$access_token); $response = $this-&gt;curl($token_url,$params); $response = explode ('=',$response); $response = explode ('&amp;',$response[1]); $response = $response[0]; return $response; } </code></pre>
0non-cybersec
Stackexchange
SQL alwayson manual Failover Cluster failed because a duplicate IP address detected. <p>When I manually tried to make a failover I got the following errors: "SQL always on Cluster IP address resource listener cannot be brought online because a duplicate IP address was detected on the network. Please ensure all IP addresses are unique. event 1049"</p> <p>As a result, all the resources of the Cluster\Listener\witness were in a failure state and could not be moved back to online state.</p> <p>When I aborted the failover attempts Everything returned to normal.</p> <p>version: SQL SERVER 2016 SP2 Enterprise edition 2 nodes (Primary and secondary)</p> <p>appreciated to receive your response and suggestions</p> <p>Thanks and Regards</p> <p>Erez Hasman</p>
0non-cybersec
Stackexchange
Dairy was an important food source in the Irish Neolithic.
0non-cybersec
Reddit
QML : how to pass javascript function as argument in another function. <p>I have QML code, for example this code</p> <pre><code>Item { id:self; function update(){ var visitFunc = self.applyUpdate; innerTraversal(self,visitFunc); } function reset(){ var visitFunc = self.applyReset; innerTraversal(self,visitFunc); } function innerTraversal(obj, visitFun){ console.log(typeof visitFun); if(obj!== self &amp;&amp; visitFun &amp;&amp; typeof visitFun ==="function") visitFun(obj); if(hasChilderns(obj)){ var objChilderns = obj.children; for(var i=0 ; i&lt; objChilderns.length ; i++){ innerTraversal(objChilderns[i]); } } } function hasChilderns(obj){ if(typeof obj.children !== 'undefined') return true; else return false; } function applyReset(obj){ if(typeof obj.reset === 'function') obj.reset(); } function applyUpdate(obj){ if(typeof obj.update === 'function') obj.update(); } } </code></pre> <p>in normal javascript this works cool, but when I use this code in QML the bad thing is visitFun always has type of undefined, and it does not work..</p> <p>any idea how to make this work ? </p>
0non-cybersec
Stackexchange
On a post about comparing raw meat to vaginas (the meat in question is partially sliced chicken).
0non-cybersec
Reddit
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
Tools to modify UEFI Variables in Windows/Linux?. <p>I have a DELL machine that use Phoenix SecureCore Tiano as its UEFI/BIOS However, it is totally not configurable as its UEFI shell &amp; menus are hidden in BIOS Setup.</p> <p>I'm wondering if there were tools that can modify the UEFI settings(such as Boot Items) in user mode? such as "efibootmgr" in linux.</p> <p>btw, because it is not configurable, I think the boot process is in legacy mode so that's to say OSes can not detect the UEFI exist, am i right?</p> <p>so, that's the paradox: I must be boot in non-legacy mode to enable UEFI tools to modify boot items in user mode? but I must enable UEFI tools to modify boot items first to enable non-legacy boot?</p>
0non-cybersec
Stackexchange
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
My calculator uses an odd number of batteries.
0non-cybersec
Reddit
Russian Thinkfluencers | Full Frontal with Samantha Bee.
0non-cybersec
Reddit
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
Finding the smallest field containing multivariate polynomial evaluations of the roots of an irreducible polynomial. <p>$\newcommand\Q{\mathbb Q}$Suppose I have an irreducible polynomial $f\in\Q[x]$ and suppose I know the roots say $r_1,\dots,r_n\in \bar \Q$. I want to know if there is an easy way to "compute" the smallest number field $K$ such that we have $$a_0(r_1,\dots, r_n) + a_1(r_1,\dots, r_n)x + \dots + a_k(r_1,\dots, r_n)x^k \in K[x]$$ where $a_0,\dots, a_k \in \Q[x_1,\dots, x_n]$. I am actually only interested in knowing $[K:\Q]$.</p> <p>I suppose this is "strongly" dependent on how $a_0,\dots, a_k$ are constructed. In my particular case, I want to prove that $[K:\Q]$ is actually always even. I guess I can go into details of the $a_i's$ but I am not sure if this will help in solving $[K:\Q]$. For me, the multivariate polynomials $a_0,\dots,a_k$ are not symmetric but they are certainly not random (i.e. there are non-trivial permutations of the $n$-indeterminates that preserve the $a_i$'s). I do not know if any of these information helps. </p> <p>Even a specific example that could give me a start on how to solve this kind of problem is very much appreciated.</p>
0non-cybersec
Stackexchange
Atiyah&#39;s vector bundles over an elliptic curve. <p>I'm reading through Atiyah's paper that classifies vector bundles over an elliptic curve, and I'm a little confused about one of his proofs. </p> <p>Lemma 15(i) states that if $E \in \mathcal{E}(r,d)$ is a vector bundle of rank $r$ and degree $d\geq0$ over $X,$ then $s:=h^0(X,E)=d$ if $d&gt;0$ and $s=0$ or $1$ if $d=0.$ </p> <p>For the proof, if $d\geq r,$ choose a maximal splitting $E=(L_1 ,...,L_r)$ with each $L_i&gt;1$ (where 1 denotes the trivial line bundle). But in Lemma 11 he has the equation </p> <p>$d=deg(E)=\sum^{r}_{1} deg(L_i).$ If each $L_i&gt;1$ doesn't that mean $deg(L_i )\geq2$ so $deg(E)\geq2r?$ But we are only assuming $d\geq r.$</p> <p>Anyways, If $deg(L_i)\geq 2 $ then it's clear that $H^1 (X,L_i)=0$. Is that how he claimed that $H^1 (X,L_i)=0$ in the next line or is he using something else?</p> <p>EDIT: Actually, we don't necessarily have $deg(L_i)\geq 2$ since $1$ denotes the trivial line bundle which has degree $0$. So if $L_i &gt;1$ it just means that $deg(L_i)&gt;0.$ Still, how do we know that $L_i &gt;1$? And how does this imply $H^1 (X,L_i)=0$?</p> <p>We say that $L_1 \geq L_2$ if $\Gamma Hom(L_2 ,L_1)\neq 0.$ It implies that $deg(L_1)\geq deg(L_2).$ </p> <p>$\Gamma Hom(L_2,L_1) $ is the space of global sections of the bundle $Hom(L_2,L_1)≅L^*_2 \otimes L_1$</p>
0non-cybersec
Stackexchange
How To Pick Up a Kan Of Pepsi Max.
0non-cybersec
Reddit
I&#39;m not able to connect to my wifi. <p>I'm using ubuntu 12.04, and I'm having some issues in connecting to my home's wifi. Here's the quick resume:</p> <ol> <li>my home wifi works, because I'm surfing trhough ethernet</li> <li>my wireless drivers work, because I can successfully connect to my office's wifi</li> <li>I'm not even able to ping my router!</li> </ol> <p>So, I cannot understand the reason for it to not work! I'm using ubuntu 12.04. Here are informations about the connection and similar:</p> <pre><code>alecive@calliope:~$ nm-tool NetworkManager Tool State: connected (global) - Device: eth0 ----------------------------------------------------------------- Type: Wired Driver: atl1c State: unavailable Default: no HW Address: 00:24:BE:EB:DA:87 Capabilities: Carrier Detect: yes Speed: 100 Mb/s Wired Properties Carrier: off - Device: wlan0 [InfostradaWiFi-004309] --------------------------------------- Type: 802.11 WiFi Driver: iwlwifi State: connected Default: yes HW Address: 00:27:10:2B:68:28 Capabilities: Speed: 135 Mb/s Wireless Properties WEP Encryption: yes WPA Encryption: yes WPA2 Encryption: yes Wireless Access Points (* = current AP) FASTWEB-1-00219631C110: Infra, 00:21:96:31:C1:18, Freq 2462 MHz, Rate 54 Mb/s, Strength 82 WPA Vodafone-23070663: Infra, 00:24:89:94:F6:AE, Freq 2437 MHz, Rate 54 Mb/s, Strength 50 WPA2 belkin.0bc: Infra, 08:86:3B:57:20:BC, Freq 2412 MHz, Rate 54 Mb/s, Strength 44 WPA WPA2 Ivica: Infra, 00:11:50:36:9C:EB, Freq 2412 MHz, Rate 54 Mb/s, Strength 27 WPA Paola WiFi: Infra, F8:D1:11:62:8C:CF, Freq 2462 MHz, Rate 54 Mb/s, Strength 20 WPA WPA2 FASTWEB-1-0021964482E4: Infra, 00:21:96:44:82:EC, Freq 2462 MHz, Rate 54 Mb/s, Strength 20 WPA ciao wireless: Infra, 00:25:9C:88:68:56, Freq 2462 MHz, Rate 54 Mb/s, Strength 27 WEP TISCALI: Infra, 00:24:17:D9:2A:B7, Freq 2462 MHz, Rate 54 Mb/s, Strength 27 *InfostradaWiFi-004309: Infra, AC:E2:15:4A:35:74, Freq 2427 MHz, Rate 54 Mb/s, Strength 90 WPA LEPRE35: Infra, 58:98:35:7E:D6:9B, Freq 2412 MHz, Rate 54 Mb/s, Strength 24 WPA WPA2 TP-LINK: Infra, 00:14:78:EC:40:AA, Freq 2437 MHz, Rate 54 Mb/s, Strength 24 WPA WPA2 Alice-92034414: Infra, 00:19:3E:15:82:B0, Freq 2437 MHz, Rate 54 Mb/s, Strength 22 WPA MAMADOU: Infra, F0:7D:68:11:3F:E7, Freq 2437 MHz, Rate 11 Mb/s, Strength 24 WPA WPA2 M&amp;A: Infra, 00:17:F2:E4:83:67, Freq 2412 MHz, Rate 54 Mb/s, Strength 29 WEP Vodafone-26148616: Infra, 00:24:89:82:19:EE, Freq 2412 MHz, Rate 54 Mb/s, Strength 22 WPA2 FASTWEB-1-001CA2AE2E70: Infra, 00:1C:A2:AE:2E:70, Freq 2437 MHz, Rate 54 Mb/s, Strength 20 WPA IPv4 Settings: Address: 192.168.1.8 Prefix: 24 (255.255.255.0) Gateway: 192.168.1.1 DNS: 8.8.8.8 DNS: 8.8.4.4 alecive@calliope:~$ ip addr 1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 16436 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: &lt;NO-CARRIER,BROADCAST,MULTICAST,UP&gt; mtu 1500 qdisc pfifo_fast state DOWN qlen 1000 link/ether 00:24:be:eb:da:87 brd ff:ff:ff:ff:ff:ff 3: wlan0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc mq state UP qlen 1000 link/ether 00:27:10:2b:68:28 brd ff:ff:ff:ff:ff:ff inet 192.168.1.8/24 brd 192.168.1.255 scope global wlan0 inet6 fe80::227:10ff:fe2b:6828/64 scope link valid_lft forever preferred_lft forever alecive@calliope:~$ ping 192.168.1.1 PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data. ^C --- 192.168.1.1 ping statistics --- 13 packets transmitted, 0 received, 100% packet loss, time 12094ms alecive@calliope:~$ </code></pre> <p>Can someone please help me? Thanks!</p>
0non-cybersec
Stackexchange
iOS Image Orientation has Strange Behavior. <p>For the past few weeks I've been working with images in objective-c and noticing a lot of strange behavior. First, like many other people, I've been having this problem where images taken with the camera (or taken with somebody else's camera and MMS'd to me) are rotated 90 degrees. I wasn't sure why in the world this was happening (hence <a href="https://stackoverflow.com/questions/10307521/ios-png-image-rotated-90-degrees" title="my question">my question</a>) but I was able to come up with a cheap work around. </p> <p>My question this time is <strong>why is this happening</strong>? Why is Apple rotating images? When I take a photo with my camera right-side up, unless I perform my code mentioned above, when I save the photo it gets saved rotated. Now, my workaround was okay up until a few days ago. </p> <p>My application modifies individual pixels of an image, specifically the alpha channel of a PNG (so any JPEG conversion gets thrown out of the window for my scenario). A few days ago I noticed that even though the image is displayed properly in my app thanks to my workaround code, when my algorithm modifies the individual pixels of the image, it thinks the image is rotated. So instead of modifying the pixels at the top of the image, it modifies the pixels on the side of the image (because it thinks it should be rotated)! I can't figure out how to rotate the image in memory - ideally I would prefer to just wipe away that <code>imageOrientation</code> flag all together.</p> <p>Here's something else that has been baffling me as well... When I take the photo, the <code>imageOrientation</code> is set to 3. My workaround code is smart enough to realize this and flip it so the user never notices. Additionally, my code to save the image to the library realizes this, flips it, <em>then</em> saves it so it appears in the camera roll properly. </p> <p>That code looks like so:</p> <pre><code>NSData* pngdata = UIImagePNGRepresentation (self.workingImage); //PNG wrap UIImage* img = [self rotateImageAppropriately:[UIImage imageWithData:pngdata]]; UIImageWriteToSavedPhotosAlbum(img, nil, nil, nil); </code></pre> <p>When I load this newly saved image into my app, the <code>imageOrientation</code> is 0 - exactly what I want to see, and my rotation workaround doesn't even need to run (note: when loading images from the internet as opposed to images taken with a camera, the <code>imageOrientation</code> is always 0, resulting in perfect behavior). For some reason, my save code seems to wipe away this <code>imageOrientation</code> flag. I was hoping to just steal that code and use it to wipe away my imageOrientation as soon as the user takes a photo and has it added to the app, but it doesn't seem to work. Does <code>UIImageWriteToSavedPhotosAlbum</code> do something special with <code>imageOrientation</code>?</p> <p>Would the best fix for this problem be to just blow away <code>imageOrientation</code> as soon as the user is done taking an image. I assume Apple has the rotation behavior done for a reason, right? A few people suggested that this is an Apple defect. </p> <p>(... if you're not lost yet... Note2: When I take a horizontal photo, everything seems to work perfectly, just like photos taken from the internet)</p> <p>EDIT:</p> <p>Here are what some of the images and scenarios actually look like. Based off the comments so far, it looks like this strange behavior is more than just an iPhone behavior, which I think is good.</p> <p>This is a picture of the photo I took with my phone (note the proper orientation), it appears exactly as it did on my phone when I snapped the photo:</p> <p><img src="https://i.stack.imgur.com/tG0Uf.png" alt="Actual Photo taken on iPhone"></p> <p>Here is what the image looks like in Gmail after I emailed it to myself (looks like Gmail handles it properly):</p> <p><img src="https://i.stack.imgur.com/pgIBL.png" alt="Photo as it appears in Gmail"></p> <p>Here is what the image looks like as a thumbnail in windows (doesn't look like it is handled properly):</p> <p><img src="https://i.stack.imgur.com/S4rsI.png" alt="Windows Thumbnail"></p> <p>And here is what the actual image looks like when opened with Windows Photo Viewer (still not handled properly):</p> <p><img src="https://i.stack.imgur.com/SZKqC.png" alt="Windows Photo Viewer Version"></p> <p>After all of the comments on this question, here's what I'm thinking... The iPhone takes an image, and says "to display this properly, it needs to be rotated 90 degrees". This information would be in the EXIF data. (Why it needs to be rotated 90 degrees, rather than defaulting to straight vertical, I don't know). From here, Gmail is smart enough to read and analyze that EXIF data, and properly display it. Windows however, is not smart enough to read the EXIF data, and therefore displays the image <strong>improperly</strong>. Are my assumptions correct?</p>
0non-cybersec
Stackexchange
update values based on values from another table. <p>I have a table (Table A) in DB2 where a columns needs to be updated based on values from values from Table B.</p> <p>e.g. </p> <p><strong>Table A</strong> has two columns and following data.</p> <pre><code> ID LOGIN 01 DONALD.TRUMP 02 BARACK.OBAMA 03 ABRAHAM.LINCOLN </code></pre> <p><strong>Table B</strong> has the following data.</p> <pre><code> ID OLDLOGIN NEWLOGIN 01 DONALD.TRUMP DONALD.T 02 ABRAHAM.LINCOLN ABRAHAM.LIN </code></pre> <p>I want to update Table A's LOGIN value, give them the NEWLOGIN values if they exist in OLDLOGIN in Table B.</p> <p>So the final result in Table A should be like below</p> <pre><code> ID LOGIN 01 DONALD.T 02 BARACK.OBAMA 03 ABRAHAM.LIN </code></pre> <p>What would be the easiest way to do that?</p>
0non-cybersec
Stackexchange
A curious near concurrence. <p>In a triangle $ABC$ with incircle $\omega$, excenters $I_A, I_B, I_C$, let $t_{AB}$ and $t_{AC}$ be the tangent lines to $\omega$ through $I_A$ that are closer to $B$ and $C$ respectively. Construct similarly $t_{BA}$, $t_{BC}$, $t_{CA}$, $t_{CB}$.</p> <p>Define $D:=t_{BA} \cap t_{CA}$, $E:=t_{CB} \cap t_{AB}$, $F:=t_{AC} \cap t_{BC}$.</p> <p>My question is:</p> <ul> <li><p>is there a way to prove that lines $AD$, $BE$, $CF$ do NOT concur? I am particularly interested in a synthetic method that does not involve writing everything in trilinear coordinates and doing all the calculations.</p></li> <li><p>is there a reason why, even though they do not concur, they seem to be very close (with respect to the size of $ABC$), which may come as a surprise given the "natural" construction we performed? Why this almost concurrence?</p></li> </ul>
0non-cybersec
Stackexchange
Mass. Home Intruder Turns Out to be a Duck.
0non-cybersec
Reddit
backup raid content from disks extracted from a NAS. <p>I've a friend with a NAS stuck in the firmware upgrade process, it is Linux based and I believe it use software raid-5 on 4 disks using <code>mdadm</code> <code>/dev/md*</code>.</p> <p>The product customers support just told how to re-install the factory firmware but all the data will be lost.</p> <p>The friend have contacted a professional recovery service but they're asking for some money (not cheap).</p> <p>I'm quite confident with Linux (used to write firmware for embedded devices in the past) but not really with raid.</p> <p>I'd like to attach the disks to a Debian pc and mount the raid as read-only, if I understand correctly there are good chances the raid and its configuration will be automatically detected by the kernel (or using <code>mdadm</code>), but how to be sure that no data is written to the disks and what are the steps to mount the raid <code>ro</code>?</p>
0non-cybersec
Stackexchange
Why use IntrospectionFragmentMatcher?. <p>Is there any reason to use <code>IntrospectionFragmentMatcher</code> to determine concrete types of values returned from interface and union fields? </p> <p>I'm talking about <code>apollo-client</code>. I'm using <code>InMemoryCache</code> with <code>addTypename: true</code>, so the type is known the moment the client gets the response. </p> <p>Meanwhile my console is plagued with warnings like these: <a href="https://i.stack.imgur.com/GPrlY.png" rel="noreferrer"><img src="https://i.stack.imgur.com/GPrlY.png" alt="console warnings"></a></p> <p>The only reason I see the documentation hint at is response validation. But why validate the server-sent response at all? If the server is not worth trusting, validation is useless anyway.</p>
0non-cybersec
Stackexchange
how to label rows and columns of matrix?. <p>i have a matrix as follows:</p> <pre><code>\begin{document} \[ \begin{bmatrix} &amp; S1 &amp; S2 &amp; S3 &amp; S4 \\ W1 &amp; 0 &amp; 0 &amp; 0 &amp; 0 \\ % inserting body of the table W2 &amp; 0 &amp; 0 &amp; 0 &amp; 0 \end{bmatrix} \] \end{document} </code></pre> <p>i want to write labels S1,S2,S3,S4 and W1,W2 outside the brackets instead of inside, any help would be appreciated.</p>
0non-cybersec
Stackexchange
How to set page title with AngularJS. <p>I am using the following code to display page titles for each of my AngularJS app template, but whenever I try to enter an invalid URL to test the .otherwise I get the following error:</p> <pre><code>TypeError: Cannot read property 'title' of undefined at http://localhost/app/js/app.js:34:43 </code></pre> <p>Below is the app.js, index.html code used:</p> <pre><code>app.js: var myApp = angular.module('myApp', ['ngRoute', 'ngSanitize']); myApp.config(['$routeProvider', function($routeProvider) { $routeProvider.when('/home', { templateUrl: 'templates/index.html', controller: 'MainController', title: 'Welcome to Home Page' }); $routeProvider.otherwise({ redirectTo: '/home' }); }]); myApp.run(['$location', '$rootScope', function($location, $rootScope) { $rootScope.$on('$routeChangeSuccess', function (event, current, previous) { $rootScope.title = current.$$route.title; }); }]); </code></pre> <p>Index.html:</p> <pre><code>&lt;title ng-bind="title +' - MyAPP Home'"&gt; - MyApp&lt;/title&gt; </code></pre> <p>Please suggest</p>
0non-cybersec
Stackexchange
Returning a value in constructor function of a class. <p>So far I have a <code>PHP</code> class with the constructor</p> <pre><code>public function __construct ($identifier = NULL) { // Return me. if ( $identifier != NULL ) { $this-&gt;emailAddress = $identifier; if ($this-&gt;loadUser() ) return $this; else { // registered user requested , but not found ! return false; } } </code></pre> <p>the functionality of <code>loadUser</code> is to look up the database for a particular email address. When i set the identifier to some email that i'm sure it's not in the database; the first IF is get passed, and goes to the first ELSE. here the constructor should return FALSE; but instead, it returns an object of the class with all NULL values ! </p> <p>how do i prevent this? thanks </p> <p>EDIT:</p> <p>thank you all for the answers. that was quite fast ! I see that the OOP way is to throw an Exception. So a throw one, my question changes that what should i do with the exception?? php.net's manual is pretty confusing ! </p> <pre><code> // Setup the user ( we assume he is a user first. referees, admins are considered users too ) try { $him = new user ($_emailAddress); } catch (Exception $e_u) { // try the groups database try { $him = new group ($_emailAddress); } catch (Exception $e_g) { // email address was not in any of them !! } } </code></pre>
0non-cybersec
Stackexchange
MySQL: Does access to table data not in an index via a join causes a file-sort when ordered. <p>The inclusion of category.name in the SELECT, causes the query to perform a Using index; Using temporary; Using filesort, and also the rows scanned are not affected by the LIMIT 0,1.</p> <pre><code>CREATE TABLE `item` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`) ) ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; CREATE TABLE `category` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `name` VARCHAR(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `created_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` TIMESTAMP NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; CREATE TABLE `feature` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `item_id` INT(10) UNSIGNED DEFAULT NULL, `category_id` INT(10) UNSIGNED DEFAULT NULL, `start_date` DATE DEFAULT NULL, `created_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `tbl_feature_id_item_id_foreign` (`item_id`), KEY `tbl_feature_id_category_id_foreign` (`category_id`), CONSTRAINT `tbl_feature_id_item_id_foreign` FOREIGN KEY (`item_id`) REFERENCES `item` (`id`), CONSTRAINT `tbl_feature_id_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `category` (`id`) ) ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; INSERT INTO `item` (`id`) VALUES (1),(2),(3),(4),(5); INSERT INTO `category` (`id`, `name`, `created_at`, `updated_at`) VALUES (1, 'a', '2016-12-02 22:49:46', NULL), (2, 'b', '2016-12-02 22:49:48', NULL) ; INSERT INTO `feature` (`id`, `item_id`, `category_id`, `start_date`, `created_at`, `updated_at`) VALUES (1, 1, 1, '2016-12-01', NOW(), NOW()), (2, 1, 2, '2016-12-02', NOW(), NOW()), (3, 2, 1, '2016-12-01', NOW(), NOW()), (4, 2, 2, '2016-12-02', NOW(), NOW()), (5, 3, 1, '2016-12-01', NOW(), NOW()), (6, 3, 2, '2016-12-02', NOW(), NOW()), (7, 4, 1, '2016-12-01', NOW(), NOW()), (8, 4, 2, '2016-12-02', NOW(), NOW()), (9, 5, 1, '2016-12-01', NOW(), NOW()), (10, 5, 2, '2016-12-02', NOW(), NOW()) ; EXPLAIN EXTENDED SELECT item.id , feature.id , category.id , category.name -- Is the cause of the temporary table; file-sort; FROM item LEFT JOIN feature ON ( feature.item_id = item.id AND feature.start_date = ( SELECT MAX(start_date) AS start_date FROM feature WHERE feature.item_id = item.id ) ) LEFT JOIN category ON ( category.id = feature.category_id ) ORDER BY item.id DESC -- or ASC LIMIT 0, 1 -- Is ignored in the table scan ; </code></pre> <p>MySQL 5.7.16</p> <p><a href="https://i.stack.imgur.com/aQeGk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aQeGk.png" alt="enter image description here"></a></p> <p>I believe it may be because of the need to access the source table after the sort is done. because the file-sort is performed in Mode 2</p> <p><a href="http://s.petrunia.net/blog/?p=24" rel="nofollow noreferrer">http://s.petrunia.net/blog/?p=24</a></p> <p><em>Mode 2: sort pairs and produce a sequence of rowids which one can use to get source table’s rows in the required order (but this will be essentially hit the table in random order and is not very fast)</em></p> <p>Adding an index to category.name does resolve the issue. Is this is because category.name is now part of the index? </p> <p>Can anybody confirm, and possibly provide a better solution than adding the index, as in reality, it does not resolve the issue as the point in time construct is repeated for multiple other features i.e. feature_a, feature_b. </p> <p><strong>Why is Using index; Using temporary; Using filesort performed?</strong></p> <p><strong>Why does the LIMIT 0,1 not affect the rows scanned?</strong></p>
0non-cybersec
Stackexchange
Booted up with low graphics, no mouse, no internet (driver failure?). <p>I just turned on my laptop and the gui is very low res compared to normal, the mouse is missing, and the internet no longer will connect. I have an asus laptop so when I first got it I had to get special drivers to make the wifi work, so that is why I think it is some sort of failure to load drivers. I am at a loss of what do to, it worked fine just a few hours ago.</p>
0non-cybersec
Stackexchange
Missing &#39;lowerdir&#39; on boot. <p>I did not perform any update on my system on Ubuntu 18.04. On booting the system, I get error</p> <blockquote> <p>[24.537547] aufs aufs_fill_super:918:mount[1298]: no arg <br/> [24.558603] overlayfs: missing 'lowerdir'</p> </blockquote> <p>I cannot load GRUB, because I get the same error instead of GRUB loading. So, I cannot boot in recovery mode. Hence, <a href="https://askubuntu.com/questions/1068588/boot-problem-after-update-missing-lowerdir">this answer</a> does not work.<br/> However, I can access tty, and on running <code>df</code>, <code>/dev/sda1</code> mounted on <code>/</code> uses only 65% of total blocks.<br/> I cannot seem to find a solution, what can I do?</p>
0non-cybersec
Stackexchange
MRW browsing Netflix's "Critically-Acclaimed Movies" list.
0non-cybersec
Reddit
Shit why thoo.
0non-cybersec
Reddit
Theorems in number theory whose first proofs were long and difficult. <p>What are the examples of important theorems of number theory that has been shown to have surprisingly simple proofs though their first demonstration wasn't at all simple enough. Now <em>simple proof</em> is an ambiguous term but in this case it may be defined as a proof which is both short and <a href="http://en.wikipedia.org/wiki/Elementary_proof" rel="nofollow">elementary</a>. As an example, the Kelly's proof of <a href="http://en.wikipedia.org/wiki/Sylvester%E2%80%93Gallai_theorem" rel="nofollow">Sylvester-Gallai Theorem</a> may be consdered. </p>
0non-cybersec
Stackexchange
simple select query in linq. <p>Lets say I have a student table and I want to display the student with ID 1.</p> <pre><code>SELECT * FROM STUDENT ST WHERE ST.ID = 1 </code></pre> <p>This is how I achive this in Linq.</p> <pre><code>StudentQuery = from r in oStudentDataTable.AsEnumerable() where (r.Field&lt;int&gt;("ID") == 1) select r; oStudentDataTable = StudentQuery.CopyToDataTable(); </code></pre> <p>but what if I want to display the students with these ids 1,2,3,4,5..</p> <pre><code>SELECT * FROM STUDENT ST WHERE ST.ID IN (1,2,3,4,5) </code></pre> <p>How can I achieve this in Linq?</p>
0non-cybersec
Stackexchange
This is how quick it happens.
0non-cybersec
Reddit
Why did Leonardo DiCaprio laugh at the Oscar joke?. Because he finally got it
0non-cybersec
Reddit
Cancel Subscription At Period End. <p><strong>QUESTION:</strong></p> <p>How does one append the "at_period_end" argument to the following PHP function in accordance with the relevant Stripe documentation ?</p> <p><strong>DOCUMENTATION:</strong> </p> <p><a href="https://stripe.com/docs/api/php#cancel_subscription" rel="noreferrer">STRIPE: cancel subscription</a></p> <p><strong>CODE:</strong></p> <pre><code>&lt;?php require_once('./lib/Stripe.php'); Stripe::setApiKey("$APIKEY"); $cu = Stripe_Customer::retrieve("$CUSTOMER_ID"); $cu-&gt;subscriptions-&gt;retrieve("$SUBSCRIPTION_ID")-&gt;cancel(); ?&gt; </code></pre>
0non-cybersec
Stackexchange
UICollectionView in a UICollectionViewCell. <p>I am interested in having a collectionview as a part of a collection view cell but for some reason cannot figure out how this would be done. Where would I implement the necessary methods for the cells collectionview? </p>
0non-cybersec
Stackexchange
Linux LACP (802.3ad) working for ingress traffic only?. <p>We've setup LACP (802.3ad) on our Juniper switch and a Linux host, connected to the switch with 3x 1Gbps links. We are able to download from multiple sources at a rate of 3 Gbps, but when uploading files to different destinations, we get a maximum of 1 Gbps. Interestingly, only 1 uplink appears to be used by the Linux host to upload (to different destinations) :</p> <pre><code>Interface: ge-0/0/34, Enabled, Link is Up Encapsulation: Ethernet, Speed: 1000mbps Traffic statistics: Input bytes: 9874189047641 (981736896 bps) Output bytes: 5641687864781 (440210816 bps) Interface: ge-0/0/36, Enabled, Link is Up Encapsulation: Ethernet, Speed: 1000mbps Traffic statistics: Input bytes: 6194266205 (1016 bps) Output bytes: 5368956712475 (400087456 bps) Interface: ge-0/0/44, Enabled, Link is Up Encapsulation: Ethernet, Speed: 1000mbps Traffic statistics: Input bytes: 1494878289802 (1016 bps) Output bytes: 11897014259103 (469673216 bps) </code></pre> <p>Input and output are flipped over.</p> <p>We basically followed this tutorial : <a href="http://phreek.org/blog/2014/11/centos-7-lacp-network-bonding" rel="nofollow noreferrer">http://phreek.org/blog/2014/11/centos-7-lacp-network-bonding</a></p> <p>And setup LACP as usual on our switch.</p> <pre><code># show system rollback 2 compare 1 [edit chassis] - aggregated-devices { - ethernet { - device-count 1; - } - } [edit interfaces ge-0/0/34] - ether-options { - 802.3ad ae0; - } [edit interfaces ge-0/0/34] + unit 0 { + family ethernet-switching; + } [edit interfaces ge-0/0/36] - ether-options { - 802.3ad ae0; - } [edit interfaces ge-0/0/36] + unit 0 { + family ethernet-switching; + } [edit interfaces ge-0/0/44] - ether-options { - 802.3ad ae0; - } [edit interfaces ge-0/0/44] + unit 0 { + family ethernet-switching; + } [edit interfaces] - ae0 { - aggregated-ether-options { - lacp { - active; - periodic fast; - } - } - unit 0 { - family ethernet-switching; - } - } [edit vlans SERVER-130 interface] + ge-0/0/44.0; + ge-0/0/36.0; + ge-0/0/34.0; - ae0.0; </code></pre> <p>Any idea?</p>
0non-cybersec
Stackexchange
Star Wars Lego AT-ST Walker Gets Obliterated by Swinging Logs.
0non-cybersec
Reddit
control + enter in browser takes only .com?. <p>I have this strange problem, how exactly does control + enter decides the domain of a website?? If i type stackoverflow,then hit control+enter, it works and takes to homepage, but i type ubuntuforums, then hit control + enter, it does not recognise its ubuntuforums.org, but goes to ubuntuforums.com??</p> <p>How does this exactly work? If i need to change this behaviour, how should i do it?</p>
0non-cybersec
Stackexchange
Introduction to Linear Algebra (Strang) Challenge Question. <p>I've been studying from Gilbert Strang's 1993 Linear Algebra text, and right in the first chapter, I've found a problem on dot products whose answer in the back is tough for me to make sense out of...</p> <p>Question:</p> <blockquote> <p>Pick any numbers that add to x + y + z = 0. Find the angle between your vector v = (x, y, z) and the vector w = (z, x, y). Challenge Question: Explain why (v · w) / ||v||||w|| is always -1/2.</p> </blockquote> <p>The former part is easy. I found cos(angle) = -1/2 using v = (-1, -1, 2).</p> <p>Answer given for the latter part: </p> <blockquote> <p>...Write v · w = xz + yz + xy as (1/2)(x + y + z)<sup>2</sup> - (1/2)(x<sup>2</sup> + y<sup>2</sup> + z<sup>2</sup>) whis is (-1/2)(x<sup>2</sup> + y<sup>2</sup> + z<sup>2</sup>).</p> </blockquote> <p>I tried rewriting it as suggested, which could make sense of that long middle term. It's is the final phrase "which is.." that throws me off. </p> <p>Help so appreciated!</p>
0non-cybersec
Stackexchange
Font awesome percentage width stacked icon. <p>I want to achieve the following effect with CSS:</p> <p><a href="https://i.stack.imgur.com/V2U7O.png" rel="noreferrer"><img src="https://i.stack.imgur.com/V2U7O.png" alt="enter image description here"></a></p> <p>This star icon is a font. I would like to define the width of the orange background by percents, so 50% should be the perfect half of the star.</p> <p>For now, I did the following:</p> <pre><code>&lt;div class="container"&gt; &lt;span class="star star-under fa fa-star"&gt;&lt;/span&gt; &lt;span class="star star-over fa fa-star"&gt;&lt;/span&gt; &lt;/div&gt; </code></pre> <p>And:</p> <pre><code>.container { font-size: 200px; height: 300px; position: relative; width: 100%; } .star { display: inline-block; left: 0; position: absolute; top: 0; } .star-under { color: #ddd; } .star-over { color: #f80; overflow: hidden; width: 30%; } </code></pre> <p>The problem is that I need to provide the width and height in order to use % of width. And if I skip the container's width and height, it displays nothing, because it contains absolutely positioned children.</p> <p>This % value is calculated on server side, so I'd rather keep it inline, like this:</p> <pre><code>&lt;span class="star star-over fa fa-star" style="width: 62%;"&gt;&lt;/span&gt; </code></pre> <p>What is the most flexible way to do this? By most flexible I mean the one that doesn't make it necessary to provide any width nor height.</p>
0non-cybersec
Stackexchange
Show Category table with parent categories. <p>Below is my table structure:</p> <p><strong>Menu Table</strong></p> <pre><code>id title position -------------------- 1 Test home 2 Test2 home </code></pre> <p><strong>Category</strong></p> <pre><code>cid name parent parent_menu -------------------------------- 1 ABC 0 1 2 DEF 0 2 3 GHI 1 0 4 JKL 2 0 </code></pre> <p><strong>Category Description</strong></p> <pre><code>id cat_id catdesc slug ------------------------------- 1 1 ABC_DESC abc 2 2 DEF_DESC def 3 3 GHI_DESC ghi 4 4 JKL_DESC jkl </code></pre> <ul> <li><code>Menu table</code> handles the menu title an position.</li> <li><code>Category table</code> handles category name and other parameters. (if parent=0 then it means that this is main category and so on..)</li> <li><code>Category Description table</code> handles the description, slug and other parameters.</li> </ul> <p>Now i want to display data like as below</p> <pre><code> Name Description Edit Delete /*table headings*/ ------------------------------------------------------- Menu Title: (Test) Main Category Name: (ABC) ------------------------------------------------------ GHI GHI_DESC edit_icon delete_icon ______________________________________________________ Menu Title: (Test2) Main Category Name: (DEF) ------------------------------------------------------ JKL JKL_DESC edit_icon delete_icon </code></pre> <p>I tried to use JOINS and manipulate data in PHP but no luck.</p> <pre><code>SELECT * FROM `category` t1 LEFT JOIN `category_description` t2 ON t1.cid = t2.cat_id WHERE 1 </code></pre> <p>Then in PHP i tried like as below</p> <pre><code>&lt;?php $i = 1; foreach($subcat as $sub) { ?&gt; &lt;?php if($sub-&gt;parent == 0) { ?&gt; &lt;tr&gt;&lt;td&gt;&lt;?php echo $sub-&gt;name ?&gt;&lt;/td&gt;&lt;/tr&gt; &lt;?php } ?&gt; &lt;?php if($sub-&gt;parent != 0) { ?&gt; &lt;tr&gt;&lt;td&gt;&lt;?php echo $sub-&gt;name ?&gt;&lt;/td&gt;&lt;td&gt;&lt;?php echo $sub-&gt;catdesc ?&gt;&lt;/td&gt; &lt;td&gt;Edit&lt;/td&gt;&lt;td&gt;Delete&lt;/td&gt;&lt;/tr&gt; &lt;?php } ?&gt; &lt;?php } ?&gt; </code></pre> <p>And above prints table like as below:</p> <pre><code>Main Category Name: ABC Main Category Name: DEF ------ GHI GHI_DESC JKl JKL_DESC </code></pre> <p>Please suggest how to print as desired. </p>
0non-cybersec
Stackexchange
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
Z-index not applying on :hover for flex elements. <p>I have two side by side divs. The right div is set to expand on hover and display a message. I have set the z-index on the expanding div to be <code>z-index: 1</code> and the left div and all its children to be <code>z-index: 0</code>, however the expanding div will only expand as far as the text in the div beside it.</p> <p>I have read multiple questions here about z-index and flex items but can't work out what I am doing wrong. I have added a higher z-index to my first flex-item as described here <a href="https://stackoverflow.com/questions/45398088/z-index-doesnt-work-with-flex-elements">Z-index doesn&#39;t work with flex elements?</a> but that has not fixed it.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>.container { display: flex; background-color: lightgray; height: 48px; width: 139px; border-radius: 4px; } .container .inner { height: 48px; } .container .inner &gt; div { display: flex; z-index: 0; } .container .inner.left { display: flex; flex-direction: column; flex: 1 0 auto; padding-left: 10px; justify-content: center; } .container .inner.right { display: flex; flex: 0 1 8px; background-color: red; border-radius: 0 4px 4px 0; overflow: hidden; transition: 0.3s; cursor: pointer; z-index: 1; } .container .inner.right .info-msg { display: none; transition: 0.3s; } .container .inner.right:hover { flex: 0 1 150px; } .container .inner.right:hover .info-msg { display: flex; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="container"&gt; &lt;div class="inner left"&gt; &lt;div class="time"&gt;9:00am - 5:00pm&lt;/div&gt; &lt;div class="name"&gt;Worker&lt;/div&gt; &lt;/div&gt; &lt;div class="inner right"&gt; &lt;div class="info-msg"&gt;Message&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;</code></pre> </div> </div> </p>
0non-cybersec
Stackexchange
how to modify creation date in photoshop?. <p>How can I modify the date of file creation in Photoshop? I don't need any specific date, "today" will be okay. Is there any other meta-information stored in .psd files apart from what I can see in File->File info?</p> <p>Edit: It's not about the file creation time, .psd has its own date stored somewhere in the file.</p>
0non-cybersec
Stackexchange
Trying to compute Lebesgue outer measure of irrationals by constructing a cover. <p>It is known that to compute the Lebesgue outer measure $\lambda^*$ of irrationals $\Bbb{I}$ we make use of the following property:</p> <p>$$\lambda^*(\Bbb{I}) +\lambda^* (\Bbb{Q}) = \lambda^* (\Bbb{R})$$</p> <p>and noting that since $\Bbb{Q}$ has zero measure being a countable union of singletons and using countable subadditivity of $\lambda^*$, we thus conclude that $\Bbb{I}$ has full measure and more generally $\lambda^*([a,b]\cap \Bbb{I}) = b-a$</p> <p>However, in order to better understand what features of uncountable sets controls the value of its Lebesgue outer measure, I tried to compute $\lambda^*([a,b]\cap \Bbb{I})$ by constructing an open cover to exclude all rationals (Without loss of generality, and for ease of writing down the enumeration of rationals I use, we consider $\lambda^*([-1,1]\cap \Bbb{I})$ and the general result can be obtained by appropriate translation and scaling of the interval)</p> <p>I first give an enumeration of the rationals within $[-1,1]$ as follows:</p> <p>$S=\{(p, q) \in \Bbb{N}^2 - \{n\in \Bbb{N} : (n+2,1)\} : \pm \frac{p}{q} \in \Bbb{Q} \land \text{lcm} (p,q)=pq\}=\{0,1,-1,\frac{1}{2},-\frac{1}{2},\frac{1}{3},-\frac{1}{3},\frac{2}{3},-\frac{2}{3}, \frac{1}{4},-\frac{1}{4},\frac{3}{4},-\frac{3}{4},\frac{1}{5},-\frac{1}{5}, \frac{2}{5},-\frac{2}{5},\frac{3}{5},-\frac{3}{5},\frac{4}{5},-\frac{4}{5},...\}$</p> <p>and then construct my open cover $C$ in stages (which for the later stages, I abbreviated the union by using n-tuples). Each later stage splits up the interval from the previous stage by the next two rationals in the order given by $S$:</p> <p>\begin{align} C_0 &amp; =(-1,1)\\ C_1 &amp; = (-1,0) \cup (0,1) := (-1,0,1)\\ C_2 &amp; = (-1,-\frac{1}{2}) \cup (-\frac{1}{2},0) \cup (0,\frac{1}{2}) \cup (\frac{1}{2},1) := (-1,-\frac{1}{2},0,\frac{1}{2},1)\\ C_3 &amp; = (-1,-\frac{1}{2},-\frac{1}{3},0,\frac{1}{3},\frac{1}{2},1)\\ C_4 &amp; = (-1,-\frac{2}{3},-\frac{1}{2},-\frac{1}{3},0,\frac{1}{3},\frac{1}{2},\frac{2}{3}‌​,1)\\ C_5 &amp; = (-1,-\frac{2}{3},-\frac{1}{2},-\frac{1}{3},-\frac{1}{4},0,\frac{1}{4},\frac{1}{3},\frac{1}{2},\frac{2}{3}‌​,1)\\ C_6 &amp; = (-1,-\frac{3}{4},-\frac{2}{3},-\frac{1}{2},-\frac{1}{3},-\frac{1}{4},0,\frac{1}{4},\frac{1}{3},\frac{1}{2},\frac{2}{3}‌​,\frac{3}{4},1)\\ C_7 &amp; = (-1,-\frac{3}{4},-\frac{2}{3},-\frac{1}{2},-\frac{1}{3},-\frac{1}{4}, -\frac{1}{5},0,\frac{1}{5},\frac{1}{4},\frac{1}{3},\frac{1}{2},\frac{2}{3}‌​,\frac{3}{4},1)\\ C_8 &amp; = (-1,-\frac{3}{4},-\frac{2}{3},-\frac{1}{2},-\frac{1}{3},-\frac{2}{5}, -\frac{1}{4}, -\frac{1}{5},0,\frac{1}{5},\frac{1}{4},\frac{2}{5},\frac{1}{3},\frac{1}{2}, \frac{2}{3}‌​,\frac{3}{4},1)\\ C_9 &amp; = (-1,-\frac{3}{4},-\frac{2}{3},-\frac{1}{2},-\frac{3}{5},-\frac{1}{3}, -\frac{2}{5},-\frac{1}{4},-\frac{1}{5},0,\frac{1}{5},\frac{1}{4},\frac{2}{5},\frac{1}{3}, \frac{3}{5},\frac{1}{2}, \frac{2}{3}‌​,\frac{3}{4},1)\\ C_{10} &amp; = (-1,-\frac{3}{4},-\frac{2}{3},-\frac{1}{2},-\frac{3}{5},-\frac{1}{3}, -\frac{2}{5}, -\frac{1}{4},-\frac{1}{5},-\frac{1}{6},0,\frac{1}{6},\frac{1}{5},\frac{1}{4},‌​\frac{2}{5},\frac{1}{3}, \frac{3}{5},\frac{1}{2}, \frac{2}{3}‌​,\frac{3}{4},1) \end{align}</p> <p>and therefore: $C = \lim_{k\to \infty}C_k$</p> <p>By construction, $C$ will exclude all rationals. We can also show that the lengths of all the intervals will converge to zero by considering the following subsequence $T$ of $S$</p> <p>$T=\{n : \Bbb{N}-\{0\} : \pm \frac{1}{n}\} \cup \{0\} = \{-1,-\frac{1}{2},-\frac{1}{3},-\frac{1}{4},-\frac{1}{5},-\frac{1}{6},...,0,...\frac{1}{6},\frac{1}{5},\frac{1}{4},\frac{1}{3},\frac{1}{2},1\}$</p> <p>and the difference between consecutive terms (except $0$) given by $\frac{1}{n}-\frac{1}{n+1} = \frac{1}{n(n+1)}$ which tends to zero as $n \to \infty$, and that any elements of $S$ will lie somewhere between the elements of $T$ thus the lengths of intervals with those endpoints will be $\leq \frac{1}{n(n+1)}$ for some $n \in \Bbb{N}$</p> <p>However the above conclusion result in a couple of confusing issues:</p> <ol> <li>$\Bbb{I} \cap [-1,1]$ is neither open nor closed (in the open interval topology of $\Bbb{R}$), but $C$ must exclude all rationals by construction (because $S$ enumerates all the rationals in $[-1,1]$, including troublesome limit of endpoints like $0$). This brought into question on what those progressively getting smaller intervals in $C$ are containing.</li> <li>Every interval, no matter how small, must contain uncountable many irrationals and countably many rationals. But $C$ excludes all the rationals, so that would mean those intervals contains only irrationals. But this contradicts with the fact that no uncountable subset of irrationals are open nor closed (though finite union of irrationals can be closed as finite union of singletons (which are closed sets) are closed) thus no open interval can contain only irrationals</li> <li>If the intervals tends to zero, it means their infimum length will be zero as $C$ only has countably many of them (thus by countable subadditivity of $\lambda^*$ this sums to zero). But we know this is incorrect as using the standard proofs in paragraph 1, we would conclude $\lambda^*([-1,1]\cap \Bbb{I}) = 2$ and not zero measure.</li> </ol> <blockquote> <p>Since $C$ must exclude all rationals by construction, what exactly are the intervals in $C$ are containing in order to be consistent with the issues raised in 1,2,3? Does $C$ actually contains intervals?</p> </blockquote>
0non-cybersec
Stackexchange
What food dish best encapsulates the culture of your home town?.
0non-cybersec
Reddit
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
Moving within Europe - Which country is responsible for your social security rights?.
0non-cybersec
Reddit
Recover user certificates from old domain profile. <p>I have had problems with my Windows 2008 server domain, so I have reinstalled the whole server and recreated the user profiles, but I forgot to extract the user digital sign certificates. Now, the old domain is not available and the computer have been changed to the new domain, so I cannot login to export the certificates. Is there anyway I can recover the user certificates from the old profile?</p> <p>Thank you very much for your help.</p> <p>Best regards</p>
0non-cybersec
Stackexchange
Tips on develop further on a legacy system?. <p>I was assigned to extend (and eventually maintain) a legacy system (mostly procedural, semi-ball of mud) without MVC. Any tips or suggestions for me going forward? :S</p>
0non-cybersec
Stackexchange
Topological localization of (infinite) inverse limits. <p>The classical localization of topological spaces at a given set of primes $\mathcal{P}$ is a functor $\mathcal{T}\xrightarrow{(-)_{(\mathcal{P)}}}\mathcal{T}$ from a suitable category of topological spaces to itself that has seen many equivalent definition. It factors $\mathcal{T}\xrightarrow{(-)_{(\mathcal{P)}}}\mathcal{T}_{\mathcal{(P)}}\hookrightarrow\mathcal{T}$ through the full subcategory of $\mathcal{P}$-local members of $\mathcal{T}$ and is left adjoint to the inclusion. Thus is preserves all colimits. It also preserves some limits. It preserves homotopy pullbacks and in particular fibre sequences. Which brings me to my question.</p> <p>What are the conditions for a homotopy limit to be preserved by localization? More importantly, how does one compute the localization of infinite homotopy limits?</p> <p>As an illustration I wish to calculate the rational homotopy type of the component of the based mapping space $Map_*^{B\iota}(BU(1),BU(2))$ where $\iota:U(1)\hookrightarrow U(2)$ is the canonical inclusion. I write $BU(1)=\mathbb{C}P^{\infty}$ as the homotopy colimit over $\mathbb{C}P^n$. Then I have </p> <p>$Map_*^{B\iota}(BU(1),BU(2))_\mathbb{Q}=\left(Map_*^{B\iota}(hocolim_n\mathbb{C}P^n,BU(2))\right)_\mathbb{Q}=\left(holim_n Map_*^{B\iota|}(\mathbb{C}P^n,BU(2))\right)_\mathbb{Q}$. </p> <p>On the inside I have </p> <p>$Map_*^{B\iota|}(\mathbb{C}P^n,BU(2))_\mathbb{Q}=Map_*^{B\iota|\mathbb{Q}}(\mathbb{C}P^n,BU(2)_\mathbb{Q})=Map_*^{B\iota|_\mathbb{Q}}(\mathbb{C}P^n,K(\mathbb{Q},2)\times K(\mathbb{Q},4))=K(\mathbb{Q},2)$</p> <p>and naively commuting localization with the homotopy inverse limit i get</p> <p>$Map_*^{B\iota}(BU(1),BU(2))_\mathbb{Q}=holim K(\mathbb{Q},2)=K(\mathbb{Q},2)$</p> <p>What is the obstruction to performing this naive commutation?</p>
0non-cybersec
Stackexchange
OneSignal - Send scheduled notification. <p>I want to send scheduled messages for OneSignal but instead of using their dashboard I want to use an API to do this and I did read their documentation but I could not find anything is there away to modify their current API so I can send the scheduled notification</p> <pre><code>function sendMessage(){ $content = array( "en" =&gt; $message, ); $fields = array( 'app_id' =&gt; "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", 'included_segments' =&gt; array('All'), 'data' =&gt; array("foo" =&gt; "bar"), 'contents' =&gt; $content ); $fields = json_encode($fields); print("\nJSON sent:\n"); print($fields); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://onesignal.com/api/v1/notifications"); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=utf-8', 'Authorization: Basic NGEwMGZmMjItY2NkNy0xMWUzLTk5ZDUtMDAwYzI5NDBlNjJj')); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, $fields); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); $response = curl_exec($ch); curl_close($ch); return $response; } $response = sendMessage(); $return["allresponses"] = $response; $return = json_encode( $return); print("\n\nJSON received:\n"); print($return); print("\n"); </code></pre>
0non-cybersec
Stackexchange
Why i am getting same output and plot for spline and cubic?. <p>Input of digital systems is usually analog but after processing signals in digital form they give back output in analog form</p> <p>I am trying to write a code for reconstruction of signal in matlab using interpolation technique but i am getting same output/plot for both interpolation types as shown in last plot of code.</p> <p>My code is below:</p> <pre><code>t= 0:0.001:1; fm= 10 fs= 8*48 x= sin(2*pi*fm*t) % Message Signal % Plotting discrete time sampled signal x[n] % Pulse Traain d= 0:1/50:1; y= pulstran(t,d,'rectpuls',0.001) % Sampling z= x.*y % Non-uniformly quantize the discrete time signal using u-law companding % method, u= 100 and number of bits= 8. % Quantization N= 8 V= max(x) u= 100 compsig= compand(x,u,V,'mu/compressor'); L= 2.^N D= [max(compsig)-min(compsig)]./(L-1); quants= quant(compsig,D); xq= compand(quants,u,max(quants),'mu/expander') % Encode the Signal into discrete levels. H_e= dsp.UniformEncoder(max(xq),N); encoder= step(H_e,xq) % Decoding the signal from discrete level and reconstruct using spline and cubic % interpolation to reconstruct the analog signal x'(t) from the % discrete time signal using $t= 0.001. H_d= dsp.UniformDecoder(max(xq),N); decoder= step(H_d,encoder) % Cubic Interpolation time= 0:0.0001:1; ci= interp1(t,decoder,time,'cubic') % Spline interpolation time=0:0.0001:1 si= interp1(t,decoder,time,'spline') figure(01) subplot(2,1,1) plot(t,x,'R','LineWidth',2) xlabel('Time') ylabel('Amplitude') legend('x') title('Message Signal') subplot(2,1,2) plot(t,y,'B','LineWidth',2) xlabel('Time') ylabel('Amplitude') legend('y') title('Pulse Train') figure(02) subplot(2,1,1) plot(t,z,'C','LineWidth',2) xlabel('Time') ylabel('Amplitude') legend('z') title('Sampled Signal') subplot(2,1,2) plot(t,xq,'G','LineWidth',2) xlabel('Time') ylabel('Amplitude') legend('xq') title('Quantized Signal') figure(03) subplot(2,1,1) plot(t,encoder,'M','LineWidth',2) xlabel('Time') ylabel('Amplitude') legend('encoder') title('Encoded Signal') subplot(2,1,2) plot(t,decoder,'K','LineWidth',2) ylim([-1 1]) xlabel('Time') ylabel('Amplitude') legend('decoder') title('Decoded Signal') figure(04) subplot(2,1,1) plot(time,ci,'B','LineWidth',2) ylim([-1 1]) xlabel('Time') ylabel('Amplitude') legend('ci') title('Cubic Interpolation') subplot(2,1,2) plot(time,ci,'R',time,si,'G') xlabel('Time') ylabel('Amplitude') legend('si') title('Spline &amp; cubic Interpolation') </code></pre> <p>How can i see difference in output/plots of both types of interpolation?</p>
0non-cybersec
Stackexchange
Attempted another cut crease with some CC from my last attempt.
0non-cybersec
Reddit
Didn't expect my fortune cookie to be so insightful.
0non-cybersec
Reddit
One Alluring Air Purifier.
0non-cybersec
Reddit
Supportive mom.
0non-cybersec
Reddit
Change menu at run-time. <p>How do I change the options menu at run-time in android 2.3.3? I have two xml menus and need to switch menu type at run-time. </p> <p>I would like to destroy or update the menu and when the user then presses the menu button, onCreateOptions menu is then called again selecting the appropriate xml menu.</p> <pre><code>@Override public boolean onCreateOptionsMenu(Menu menu) { if(OPTIONS_TYPE == 0) // Photo option getMenuInflater().inflate(R.menu.photomenu, menu); else // Photo + delete option getMenuInflater().inflate(R.menu.photodeletemenu, menu); return super.onCreateOptionsMenu(menu); } </code></pre>
0non-cybersec
Stackexchange
Coloring rows in View based NSTableview. <p>I have a view based nstableview. I want to color entire row based on some condtion for which I have used code below</p> <pre><code>- (NSTableRowView *)tableView:(NSTableView *)tableView rowViewForRow:(NSInteger)row { NSTableRowView *view = [[NSTableRowView alloc] initWithFrame:NSMakeRect(1, 1, 100, 50)]; [view setBackgroundColor:[NSColor redColor]]; return view;; } </code></pre> <p>The delegate method is called, but table doesn't seem to be using <code>NSTableRowView</code> returned by delegate method.</p> <p>Main aim here is coloring entire row based on some condition. Whats wrong in above implementation?</p>
0non-cybersec
Stackexchange
sign in the polarization of Hodge structures. <p>I have been trying to understand signs and conventions in the Hodge theory. Clearly, I am no expert in this area. I apologize if I ask stupid question(s) and make wrong comment(s).</p> <p>In Deligne's paper "Theorie de Hodge II", he defined the polarization of a $\mathbb Q$-Hodge structure $(V, h)$ of weight $n$ to be a homomorphism $\psi: V \otimes V \to \mathbb Q(-n)$ such that $(2 \pi \mathbf i)^n \psi(x, h(\mathbf i)y)$ is symmetric and positive definite on $V_\mathbb R$. Here $\mathrm i$ is a chosen root of $x^2+1=0$. The condition above is equivalent to $\psi(x,y) = (-1)^n\psi(y,x)$ and $(2 \pi \mathbf i)^n \mathbf i^{p-q}\psi_\mathbb C(z, \bar z)&gt;0$ for all $z \in V^{pq}$ ($n=p+q$).</p> <p>Clearly his choice of sign is so that, for a smooth complex projective variety $X$ of dimension $d$, the cup-product pairing on the primitive part of $H^n(X,\mathbb Q)$ given by $(x,y) \mapsto x \wedge y \wedge c_1(\mathcal O(1))^{d-n}$ is a polarization of weight $n$.</p> <ol> <li><p>My first question is probably my ignorance: I went back to check the Hodge-Riemann bilinear relation in Griffith-Harris' AG book. There is a sign of the form $(-1)^{n(n-1)/2}$ which doesn't seem to die no matter how I normalize things. Could someone give me a hint on how everything is converted? Or a reference where this is explained?</p></li> <li><p>Deligne claimed that if we had chosen the other root $-\mathbf i$ instead, the theory works out equivalently. But I didn't quite get this part. At least, if $\psi$ were a polarization before, we will have to take $(-1)^n \psi$ to get a polarization. I have a bit of difficult time to rap my head around this. There's gotta be something else changed here.</p></li> <li><p>Even more confusing to me: in the paper I just mentioned, Deligne's convention is that $h(z)$ acts on $V^{pq}$ by $z^p \bar z^q$. Later, he decided (for good cause of course) that $h(z)$ should act on $V^{pq}$ by $z^{-p} \bar z^{-q}$. For example, this is the case of his paper in Covallis on Shimura varieties. My feeling is that, due to the change of convention, one needs to change the positivity of $(2 \pi \mathbf i)^n \psi(x, h(\mathbf i)y)$ into the positivity of $(2 \pi \mathbf i)^n \psi(x, h(\mathbf i)^{-1}y)$. (The latter is the same as $(2 \pi \mathbf i)^n \psi( h(\mathbf i) x,y)$.) Deligne didn't seem to have addressed this change. But note that this has the same effect as changing $\mathbf i$ to $-\bf i$. Maybe this is just a convention thing? Or have I missed out something?</p></li> </ol> <p>Many thanks in advance!</p>
0non-cybersec
Stackexchange
Postfix authentication issues after I configured TLS. <p>I've setup my mail server with Postfix for SMTP and Dovecot for IMAP. Instead of virtual users I simply listened to the suggestion of someone from Server Fault and went with Linux users. I'm using RainLoop as a webmail service. I have configured SPF and in order to have my emails reach other providers, I have to use authentication.</p> <p>So I (tried to) setup TLS to work with the SSL certificate I have got by using the Let's Encrypt client. The following is my <code>main.cf</code> file:</p> <pre><code># domain name and public server ip are replaced with mydomain.co.il and 127.0.0.1 # See /usr/share/postfix/main.cf.dist for a commented, more complete version # Debian specific: Specifying a file name will cause the first # line of that file to be used as the name. The Debian default # is /etc/mailname. #myorigin = /etc/mailname smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) biff = no # appending .domain is the MUA's job. append_dot_mydomain = no # Uncomment the next line to generate "delayed mail" warnings #delay_warning_time = 4h readme_directory = no # TLS parameters smtpd_tls_cert_file=/etc/letsencrypt/live/mydomain.co.il/cert.pem smtpd_tls_key_file=/etc/letsencrypt/live/mydomain.co.il/privkey.pem smtpd_use_tls=yes smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtpd_tls_received_header = yes smtpd_tls_security_level = may smtp_tls_security_level = may smtp_tls_loglevel = 1 smtpd_tls_loglevel = 1 # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for # information on enabling SSL in the smtp client. smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination myhostname = mail.mydomain.co.il alias_maps = hash:/etc/postfix/aliases alias_database = hash:/etc/postfix/aliases transport_maps = hash:/etc/postfix/transport myorigin = mydomain.co.il mydestination = mail.mydomain.co.il, localhost.mydomain.co.il, localhost, hash:/etc/postfix/transport relayhost = mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.10.0/24 127.0.0.1 # last one is the server's public ip mailbox_command = procmail -a "$EXTENSION" mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = all inet_protocols = all mime_header_checks = regexp:/etc/postfix/header_checks header_checks = regexp:/etc/postfix/header_checks </code></pre> <p>And the following is my <code>master.cf</code> file:</p> <pre><code># # Postfix master process configuration file. For details on the format # of the file, see the master(5) manual page (command: "man 5 master" or # on-line: http://www.postfix.org/master.5.html). # # Do not forget to execute "postfix reload" after editing this file. # # ========================================================================== # service type private unpriv chroot wakeup maxproc command + args # (yes) (yes) (no) (never) (100) # ========================================================================== smtp inet n - y - - smtpd #smtp inet n - y - 1 postscreen #smtpd pass - - y - - smtpd #dnsblog unix - - y - 0 dnsblog #tlsproxy unix - - y - 0 tlsproxy submission inet n - y - - smtpd # -o syslog_name=postfix/submission -o smtpd_tls_security_level=encrypt -o smtpd_sasl_auth_enable=yes -o smtpd_reject_unlisted_recipient=no # -o smtpd_client_restrictions=$mua_client_restrictions # -o smtpd_helo_restrictions=$mua_helo_restrictions # -o smtpd_sender_restrictions=$mua_sender_restrictions # -o smtpd_recipient_restrictions= # -o smtpd_relay_restrictions=permit_sasl_authenticated,reject # -o milter_macro_daemon_name=ORIGINATING #smtps inet n - y - - smtpd # -o syslog_name=postfix/smtps # -o smtpd_tls_wrappermode=yes # -o smtpd_sasl_auth_enable=yes # -o smtpd_reject_unlisted_recipient=no # -o smtpd_client_restrictions=$mua_client_restrictions # -o smtpd_helo_restrictions=$mua_helo_restrictions # -o smtpd_sender_restrictions=$mua_sender_restrictions # -o smtpd_recipient_restrictions= # -o smtpd_relay_restrictions=permit_sasl_authenticated,reject # -o milter_macro_daemon_name=ORIGINATING #628 inet n - y - - qmqpd pickup unix n - y 60 1 pickup cleanup unix n - y - 0 cleanup qmgr unix n - n 300 1 qmgr #qmgr unix n - n 300 1 oqmgr tlsmgr unix - - y 1000? 1 tlsmgr rewrite unix - - y - - trivial-rewrite bounce unix - - y - 0 bounce defer unix - - y - 0 bounce trace unix - - y - 0 bounce verify unix - - y - 1 verify flush unix n - y 1000? 0 flush proxymap unix - - n - - proxymap proxywrite unix - - n - 1 proxymap smtp unix - - y - - smtp relay unix - - y - - smtp # -o smtp_helo_timeout=5 -o smtp_connect_timeout=5 showq unix n - y - - showq error unix - - y - - error retry unix - - y - - error discard unix - - y - - discard local unix - n n - - local virtual unix - n n - - virtual lmtp unix - - y - - lmtp anvil unix - - y - 1 anvil scache unix - - y - 1 scache # # ==================================================================== # Interfaces to non-Postfix software. Be sure to examine the manual # pages of the non-Postfix software to find out what options it wants. # # Many of the following services use the Postfix pipe(8) delivery # agent. See the pipe(8) man page for information about ${recipient} # and other message envelope options. # ==================================================================== # # maildrop. See the Postfix MAILDROP_README file for details. # Also specify in main.cf: maildrop_destination_recipient_limit=1 # maildrop unix - n n - - pipe flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient} # # ==================================================================== # # Recent Cyrus versions can use the existing "lmtp" master.cf entry. # # Specify in cyrus.conf: # lmtp cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4 # # Specify in main.cf one or more of the following: # mailbox_transport = lmtp:inet:localhost # virtual_transport = lmtp:inet:localhost # # ==================================================================== # # Cyrus 2.1.5 (Amos Gouaux) # Also specify in main.cf: cyrus_destination_recipient_limit=1 # #cyrus unix - n n - - pipe # user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user} # # ==================================================================== # Old example of delivery via Cyrus. # #old-cyrus unix - n n - - pipe # flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user} # # ==================================================================== # # See the Postfix UUCP_README file for configuration details. # uucp unix - n n - - pipe flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient) # # Other external delivery methods. # ifmail unix - n n - - pipe flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient) bsmtp unix - n n - - pipe flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient scalemail-backend unix - n n - 2 pipe flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension} mailman unix - n n - - pipe flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user} </code></pre> <p>I basically just enabled <code>sumbission</code>.</p> <p>RainLoop connects to both my IMAP server and SMTP server:</p> <p><a href="https://i.stack.imgur.com/O08ET.png" rel="nofollow noreferrer">RainLoop screenshot</a></p> <p>As long as "Use Authentication" is disabled or if I use the php <code>mail();</code> function, I'm able to send emails and receive them everywhere. They get marked as spam, so I figured out I need to enable authentication but if I do so; I'm unable to send emails, this is from my <code>mail.log</code> file:</p> <pre><code># i replaced my server's public ip address with 127.0.0.1 Jun 23 05:14:57 mailserver dovecot: imap-login: Login: user=&lt;shavit&gt;, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=16305, TLS, session=&lt;QVtwdek15swlOzfP&gt; Jun 23 05:14:57 mailserver postfix/smtpd[16306]: connect from mydomain.co.il[127.0.0.1] Jun 23 05:14:57 mailserver postfix/smtpd[16306]: Anonymous TLS connection established from mydomain.co.il[127.0.0.1]: TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits) Jun 23 05:14:57 mailserver postfix/smtpd[16306]: warning: mydomain.co.il[127.0.0.1]: SASL CRAM-MD5 authentication failed: authentication failure Jun 23 05:14:57 mailserver postfix/smtpd[16306]: disconnect from mydomain.co.il[127.0.0.1] ehlo=2 starttls=1 auth=0/1 quit=1 commands=4/5 Jun 23 05:14:57 mailserver dovecot: imap(shavit): Logged out in=11 out=401 Jun 23 05:14:57 mailserver dovecot: imap-login: Login: user=&lt;shavit&gt;, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=16310, TLS, session=&lt;BsR2dek16MwlOzfP&gt; Jun 23 05:14:57 mailserver dovecot: imap(shavit): Logged out in=90 out=884 </code></pre> <p>My SSL certificate is valid; I'm using it with <code>nginx</code> for 5 virtual hosts under the same domain and they all work, so this option could be eliminated.</p> <p>What am I doing wrong, or; how would I fix it? Help would be appreciated!</p>
0non-cybersec
Stackexchange
Area-preserving map of punctured disk to itself. <p>If <span class="math-container">$D_r = \{v\in \mathbb{R}^2 : 0 \lt |v| \lt r\}$</span>, consider the map <span class="math-container">$f_r: D_r \to D_r$</span> given by:</p> <p><span class="math-container">$$f_r(x,y) = \frac{\sqrt{r^2-x^2-y^2}}{\sqrt{x^2+y^2}}\left(-y,x\right)$$</span></p> <p>Geometrically, <span class="math-container">$f_r(v) \cdot v =0$</span> and <span class="math-container">$|v|^2 + |f_r(v)|^2=r^2$</span>, i.e. <span class="math-container">$f_r$</span> rotates <span class="math-container">$v$</span> by <span class="math-container">$\frac{\pi}{2}$</span> and rescales it to its “Pythagorean conjugate” wrt <span class="math-container">$r$</span>. It is easy to see that <span class="math-container">$f_r(f_r(v))=-v$</span>.</p> <p>While it is not hard to show by an explicit computation that the determinant of the Jacobian for <span class="math-container">$f_r$</span> is <span class="math-container">$-1$</span>, and hence <span class="math-container">$f_r$</span> is area-preserving, my question is whether there is a more direct or conceptual route to that conclusion. I don't think the mere fact that <span class="math-container">$f_r(f_r(v))=-v$</span> suffices, since this only tells us that the product of the Jacobian at two different points, <span class="math-container">$v$</span> and <span class="math-container">$f_r(v)$</span>, is minus the identity matrix.</p> <p>This function doesn't satisfy the Cauchy-Riemann equations, so it does not correspond to a holomorphic function of a complex variable. But I am curious as to whether it has been given a label in the literature; it seems like a kind of “conjugate” that might have shown up in a range of contexts in geometry or analysis.</p> <p>The map <span class="math-container">$f_r$</span> can be used to show that the volume of the unit ball in <span class="math-container">$\mathbb{R}^{2n}$</span> is equal to <span class="math-container">$\frac{\pi^n}{n!}$</span>, by means of the following argument. If we pick <span class="math-container">$n$</span> points <span class="math-container">$p_i$</span> uniformly in the square in <span class="math-container">$\mathbb{R}^2$</span> of side length 2, and compute the probability <span class="math-container">$P_1$</span> that:</p> <p><span class="math-container">$$|p_n| \le |p_{n-1}| \le \dots \le |p_1| \le 1$$</span></p> <p>we have:</p> <p><span class="math-container">$$P_1 = \frac{\pi^n}{4^n n!}$$</span></p> <p>since all <span class="math-container">$n$</span> points must lie in the unit disk, and there will be equal probabilities for each of the <span class="math-container">$n!$</span> permutations to have descending magnitudes.</p> <p>We can also pick <span class="math-container">$n$</span> points <span class="math-container">$q_i$</span> uniformly from the same square and ask whether:</p> <p><span class="math-container">$$|q_1|^2+|q_2|^2+\dots +|q_n|^2 \le 1$$</span></p> <p>i.e. whether the <span class="math-container">$n$</span> points taken together give the coordinates of a point in the unit ball in <span class="math-container">$\mathbb{R}^{2n}$</span>. The probability for this will be:</p> <p><span class="math-container">$$P_2 = \frac{V(B^{2n})}{4^n}$$</span></p> <p>If the <span class="math-container">$q_i$</span> correspond to a point in the unit ball, we can construct <span class="math-container">$n$</span> points:</p> <p><span class="math-container">$$p'_1 = f_1(q_1)$$</span> <span class="math-container">$$|p'_1|^2 = 1 - |q_1|^2$$</span> <span class="math-container">$$p'_2 = f_{|p'_1|}(q_2)$$</span> <span class="math-container">$$|p'_2|^2 = 1 - |q_1|^2 - |q_2|^2$$</span> <span class="math-container">$$p'_3 = f_{|p'_2|}(q_3)$$</span> <span class="math-container">$$\dots$$</span></p> <p>These <span class="math-container">$p'_i$</span> will then satisfy:</p> <p><span class="math-container">$$|p'_n| \le |p'_{n-1}| \le \dots \le |p'_1| \le 1$$</span></p> <p>Since each <span class="math-container">$f_r$</span> is area-preserving, the probability of arriving at these <span class="math-container">$p'_i$</span> will be the same as that of picking the <span class="math-container">$q_i$</span> from which they were computed. But the probability of the <span class="math-container">$q_i$</span> giving us a point in the unit ball in <span class="math-container">$\mathbb{R}^{2n}$</span> must then be the same as <span class="math-container">$P_1$</span>, since the <span class="math-container">$p'_i$</span> satisfy the relevant condition. So:</p> <p><span class="math-container">$$P_1=P_2$$</span></p> <p>and so:</p> <p><span class="math-container">$$V(B^{2n}) = \frac{\pi^n}{n!}$$</span></p>
0non-cybersec
Stackexchange
CGContextDrawPDFPage memory Leak - App Crash. <p>When I analyze my app with Instruments, I found out that data allocated by <code>CGContextDrawPDFPage</code> is not released immediately. App getting crash because of <code>CGContextDrawPDFPage</code>.</p> <p><a href="https://i.stack.imgur.com/DSlRm.png" rel="noreferrer"><img src="https://i.stack.imgur.com/DSlRm.png" alt="enter image description here"></a></p> <p><a href="https://i.stack.imgur.com/uNbD8.png" rel="noreferrer"><img src="https://i.stack.imgur.com/uNbD8.png" alt="enter image description here"></a></p> <p>Hello here is my code for drawing pdf in CATiledlayer</p> <pre><code> - (void)drawLayer:(CATiledLayer *)layer inContext:(CGContextRef)context { if (_PDFPageRef == nil) { return; } CGPDFPageRef drawPDFPageRef = NULL; CGPDFDocumentRef drawPDFDocRef = NULL; @synchronized(self) // Briefly block main thread { drawPDFDocRef = CGPDFDocumentRetain(_PDFDocRef); if( _PDFPageRef != (__bridge CGPDFPageRef)([NSNull null]) ) drawPDFPageRef = CGPDFPageRetain(_PDFPageRef); else return; } //CGContextSetRGBFillColor(context, 0.0f, 0.0f, 0.0f, 0.0f); //CGContextFillRect(context, CGContextGetClipBoundingBox(context)); if (drawPDFPageRef != NULL) // Render the page into the context { CGFloat boundsHeight = viewBounds.size.height; if (CGPDFPageGetRotationAngle(drawPDFPageRef) == 0) { CGFloat boundsWidth = viewBounds.size.width; CGRect cropBox = CGPDFPageGetBoxRect(drawPDFPageRef, kCGPDFCropBox); int pageRotation = CGPDFPageGetRotationAngle(drawPDFPageRef); CGSize pageVisibleSize = CGSizeMake(cropBox.size.width, cropBox.size.height); if ((pageRotation == 90) || (pageRotation == 270) ||(pageRotation == -90)) { pageVisibleSize = CGSizeMake(cropBox.size.height, cropBox.size.width); } float scaleX = boundsWidth / pageVisibleSize.width; float scaleY = boundsHeight / pageVisibleSize.height; float scale = scaleX &lt; scaleY ? scaleX : scaleY; // Offset relative to top left corner of rectangle where the page will be displayed float offsetX = 0; float offsetY = 0; float rectangleAspectRatio = boundsWidth / boundsHeight; float pageAspectRatio = pageVisibleSize.width / pageVisibleSize.height; if (pageAspectRatio &lt; rectangleAspectRatio) { // The page is narrower than the rectangle, we place it at center on the horizontal offsetX = (boundsWidth - pageVisibleSize.width * scale) / 2; } else { // The page is wider than the rectangle, we place it at center on the vertical offsetY = (boundsHeight - pageVisibleSize.height * scale) / 2; } CGPoint point = CGPointMake(offsetX, offsetY); //CGRect cropBox = CGPDFPageGetBoxRect(drawPDFPageRef, kCGPDFCropBox); int rotate = CGPDFPageGetRotationAngle(drawPDFPageRef); //CGContextSaveGState(context); // Setup the coordinate system. // Top left corner of the displayed page must be located at the point specified by the 'point' parameter. CGContextTranslateCTM(context, point.x, point.y); // Scale the page to desired zoom level. CGContextScaleCTM(context, scale , scale); // The coordinate system must be set to match the PDF coordinate system. switch (rotate) { case 0: CGContextTranslateCTM(context, 0, cropBox.size.height); CGContextScaleCTM(context, 1, -1); break; case 90: CGContextScaleCTM(context, 1, -1); CGContextRotateCTM(context, -M_PI / 2); break; case 180: case -180: CGContextScaleCTM(context, 1, -1); CGContextTranslateCTM(context, cropBox.size.width, 0); CGContextRotateCTM(context, M_PI); break; case 270: case -90: CGContextTranslateCTM(context, cropBox.size.height, cropBox.size.width); CGContextRotateCTM(context, M_PI / 2); CGContextScaleCTM(context, -1, 1); break; } // The CropBox defines the page visible area, clip everything outside it. CGRect clipRect = CGRectMake(0, 0, cropBox.size.width, cropBox.size.height); CGContextAddRect(context, clipRect); CGContextClip(context); CGContextSetRGBFillColor(context, 1.0, 1.0, 1.0, 1.0); CGContextFillRect(context, clipRect); CGContextTranslateCTM(context, -cropBox.origin.x, -cropBox.origin.y); CGContextSetInterpolationQuality(context, kCGInterpolationHigh); // CGContextSetInterpolationQuality(context, kCGInterpolationMedium); CGContextSetRenderingIntent(context, kCGRenderingIntentDefault); if(context != nil &amp;&amp; context != (__bridge CGContextRef)([NSNull null])) { CGContextDrawPDFPage(context, drawPDFPageRef); //CGContextRestoreGState(context); } } else // Use CGPDFPageGetDrawingTransform for pages with rotation (AKA kludge) { CGContextTranslateCTM(context, 0.0f, boundsHeight); CGContextScaleCTM(context, 1.0f, -1.0f); CGContextConcatCTM(context, CGPDFPageGetDrawingTransform(drawPDFPageRef, kCGPDFCropBox, viewBounds, 0, true)); } //CGContextDrawPDFPage(context, drawPDFPageRef); } CGPDFPageRelease(drawPDFPageRef); // Cleanup CGPDFDocumentRelease(drawPDFDocRef); } </code></pre>
0non-cybersec
Stackexchange
Fighting, WWE style.
0non-cybersec
Reddit
Refactor Pro versus Visual Assist X for C++ Development. <p>There are two major refactoring tools which can be installed for Visual Studio that provide C++ support. The full versions of both tools are $250, and they seem to offer similar functionality. They are:</p> <ul> <li><a href="http://www.devexpress.com/Products/Visual_Studio_Add-in/Coding_Assistance/" rel="noreferrer">Developer Express' Refactor Pro + CodeRush</a></li> <li><a href="http://www.wholetomato.com/products/default.asp" rel="noreferrer">Whole Tomato's Visual Assist X</a></li> </ul> <p>Which tool is better?</p> <p>EDIT: My initial evaluation of the tools seems to be that Refactor Pro/CodeRush has several more features, but is also quite buggy on occasion. It doesn't seem to like macros: <a href="https://i.stack.imgur.com/zoUzl.png" rel="noreferrer"><img src="https://i.stack.imgur.com/zoUzl.png" alt="" /></a><br /> <sub>(source: <a href="http://billy-oneal.com/forums/4-9-2010%2010-31-50%20PM.png" rel="noreferrer">billy-oneal.com</a>)</sub></p> <p>Here's Visual Assist's interpretation of the same: <a href="https://i.stack.imgur.com/0PBvo.png" rel="noreferrer"><img src="https://i.stack.imgur.com/0PBvo.png" alt="" /></a><br /> <sub>(source: <a href="http://billy-oneal.com/forums/4-10-2010%201-52-24%20AM.png" rel="noreferrer">billy-oneal.com</a>)</sub></p> <p>EDIT2: I think I like CodeRush over Visual Assist, but I'm not sure I can trust CR. CodeRush does seem to have problems parsing some C++ constructs, like the macros above. But it's UI is <em>much</em> more polished. For example: <a href="https://i.stack.imgur.com/R5eSz.png" rel="noreferrer"><img src="https://i.stack.imgur.com/R5eSz.png" alt="" /></a><br /> <sub>(source: <a href="http://billy-oneal.com/forums/4-10-2010%201-37-12%20AM.png" rel="noreferrer">billy-oneal.com</a>)</sub></p> <p>On the other hand Visual Assist X seems to have a much larger following among C++ developers, and it's code analysis is MUCH better. It doesn't seem to make mistakes like R! Pro was making from time to time.</p> <p>I think at this point I just have to play with both tools and see which one proves more useful. But I'm still curious if anyone has had horror / success stories with either tool.</p>
0non-cybersec
Stackexchange
Possible bug in VB.NET &#39;Like&#39; operator?. <p>Why is it that the following evaluates as <code>True</code>?</p> <pre><code>Dim result = "b" Like "*a*b" </code></pre> <p>Thanks.</p> <p>EDIT:<br> To generalize this a bit, the following returns <code>True</code>:</p> <pre><code>"String1" Like "*AnyText1*AnyText2*AnyText???******????*String1" </code></pre> <p>VBA works correctly, returning <code>False</code>.<br> PowerShell works correctly, returning <code>False</code>:</p> <pre><code>PS C:\Users\XXX&gt; "b" -Like "*a*b" False </code></pre> <p>EDIT2:<br> The link to the bug report:<br> <a href="https://connect.microsoft.com/VisualStudio/feedback/details/748415/a-bug-in-net-like-operator" rel="nofollow">https://connect.microsoft.com/VisualStudio/feedback/details/748415/a-bug-in-net-like-operator</a></p>
0non-cybersec
Stackexchange
I'mma lay here, WCGR?.
0non-cybersec
Reddit
Skate-inspired Anchor Mark Willis -Black Pelican Tattoo parlor - Boca Raton Fl..
0non-cybersec
Reddit
Share Application Program for All Users on Windows 10. <p>Just setup a Windows 10 Laptop, I have one base account which is administrator and 2 user accounts to be used by two other users.</p> <p>I installed an application ( <a href="https://scratch.mit.edu/download" rel="nofollow noreferrer">Scratch Desktop</a> ) from base user account but other users are unable to see this.</p> <p>Installation steps did not prompt in any way to make it available to all users. How to I make this program available to all users, anything that involves not copying the full program to each user profile folders is appreciated.</p> <p>OS: Windows 10 Pro</p>
0non-cybersec
Stackexchange
&quot;&#39;Category&#39; was defined in order to define &#39;functor&#39;, which was defined in order to define &#39;natural transformation&#39;&quot;. <p>I am looking for the source (and original version) of the above oft-repeated quotation. Mac Lane mentions it in <em>Categories for the Working Mathematician</em>, attributing it to Eilenberg-Mac Lane; however, I didn't see it while briefly skimming their paper <em>General Theory of Natural Equivalences</em>.</p>
0non-cybersec
Stackexchange
(NSFW: death) Post-mortem photograph of Rasputin showing the bullet wound in his forehead [400 × 291 pixels].
0non-cybersec
Reddit
AITA] for wanting my girlfriend's friend to pay late fees for rent?. So my girlfriend and I are sharing an apartment. We have a spare bedroom, and my girlfriend's friend needed a place for a month, so he moved in and agreed to pay the rent for the room (It's student apartments so rent goes by room instead of for the whole apt). Rent was due yesterday, originally he was going to pay some now and some later, but now asked to pay us a month from now. Well my girlfriend was relying on that money to pay for her portion of the rent as she doesn't get paid at her new job until next Friday. She's now going to get charged $30 today and $10 every day after that in late fees as a result, and I brought up that she should have him pay for at least part of those fees. She asked him, and he said he would try to get the money in two weeks instead of a month, but that is still going to rack up $170 in late fees. She thinks it's rude to ask him for extra money, but considering it is partially his fault for why the rent is late, I think it's reasonable to ask if he can pay *some* of it. Am I an asshole for that?
0non-cybersec
Reddit
y'all see skeletor burning one in time lapse? (from r/place).
0non-cybersec
Reddit
Gf threatens bf, firing gun indoors on his livestream.
0non-cybersec
Reddit
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
It's things like this that make me wonder where these peoples souls are....
0non-cybersec
Reddit
Complementary slackness in Hilbert spaces. <p>Suppose we were going to obtain the KKT conditions for a inequality constrained problem in $\mathbb{R}^n$</p> <p>\begin{align*} \underset{\mathbf{x}\in \mathbb{R}^n}{\text{min}} &amp;~ f(\mathbf{x}) \\ \text{s.t.}&amp;~ x_i \leq \beta ~\forall ~i=1...n \\ \end{align*}</p> <p>Introduce a slack variable \begin{align*} \underset{x\in \mathbb{R}^n}{\text{min}} &amp;~ f(x) \\ \text{s.t.}&amp;~ x_i - \beta + s_i = 0 &amp;~~\forall ~i=1...n\\ &amp; s_i \geq 0 &amp;~~\forall ~i=1...n \end{align*} Obtain the optimality conditions. Lagrangian:</p> <p>\begin{equation*} \mathcal{L} \left(x, \lambda, s, \mu \right) = f(x) + \mathbf{\lambda}^T (\mathbf{x} -\mathbf{\beta} + \mathbf{s}) + \mathbf{\mu}^T \mathbf{s} \end{equation*}</p> <p>KKT conditions: \begin{align} \nabla_x \mathcal{L} &amp;= \nabla f(x) + \mathbf{\lambda} &amp;=0\\ \nabla_{\lambda} \mathcal{L} &amp;= \mathbf{x} -\mathbf{\beta} + \mathbf{s}&amp;=0 \\ \nabla_{s} \mathcal{L} &amp;= \mathbf{\lambda} + \mathbf{\mu} &amp;=0\\ s_i &amp;\geq 0 ~~\forall ~i=1...n \\ \mu_i &amp;\leq 0 ~~\forall ~i=1...n &amp;~\text{dual feasibility} \\ \mu_i s_i &amp;= 0 ~~\forall ~i=1...n &amp;~\text{complementary slackness} \end{align} Doing some manipulations we can obtain: \begin{align} \nabla_x \mathcal{L} &amp;= \nabla f(x) + \mathbf{\lambda} &amp;=0\\ \lambda_i (x_i -\mathbf{\beta}) &amp;= 0 ~~\forall ~i=1...n &amp;~\text{complementary slackness} \end{align}</p> <p>and we can solve for these conditions. Now, how would we go about the same problem in a $L_2$?</p> <p>\begin{align*} \underset{x\in L_2}{\text{min}} &amp;~ f(x) \\ \text{s.t.}&amp;~ x \leq \beta ~a.e. \\ \end{align*}</p> <p>$f:L_2 \rightarrow \mathbb{R}$. Including a slack variable: \begin{align*} \underset{x\in L_2}{\text{min}} &amp;~ f(x) \\ \text{s.t.}&amp;~ x - \beta + s &amp;= 0 ~a.e. \\ &amp;~ s &amp;\geq 0 ~a.e. \\ \end{align*}</p> <p>Here for the Lagrangian, am I correct in doing the lagrange multiplier-constraints inner products in $L_2$ ? \begin{equation*} \mathcal{L} \left(x, \lambda, s, \mu \right) = f(x) + \langle \lambda, x -\beta + s \rangle_{L_2} +\langle \mu, s \rangle_{L_2} \end{equation*}</p> <p>KKT conditions $\forall \delta \lambda, \delta x, \delta \mu, \delta s$ \begin{align*} \mathcal{L}_x (\delta x) &amp;= \langle f'(x), \delta x \rangle_{L_2} + \langle \lambda, \delta x \rangle_{L_2} &amp;= 0\\ \mathcal{L}_{\lambda} (\delta \lambda) &amp;= \langle x - \beta + s, \delta \lambda \rangle_{L_2} &amp;= 0 \\ \mathcal{L}_{s} (\delta s) &amp;= \langle \lambda , \delta s \rangle_{L_2} + \langle \mu, \delta s \rangle_{L_2}&amp;= 0 \\ s &amp;\geq 0 \\ \mu &amp;\leq 0 \\ \mu s&amp;= 0 ~\text{a.e.} \end{align*}</p> <p>Solving \begin{align*} \mathcal{L}_{\lambda} (\delta \lambda) &amp;= \langle x - \beta + s, \delta \lambda \rangle_{L_2} &amp;= 0 ~ \forall \delta \lambda \\ s &amp;= -(x - \beta) &amp;~\text{a.e.}\\ \mathcal{L}_{s} (\delta s) &amp;= \langle \lambda , \delta s \rangle_{L_2} + \langle \mu, \delta s \rangle_{L_2} &amp;= 0 ~ \forall \delta s \\ \mu &amp;= -\lambda &amp;~\text{a.e.} \end{align*}</p> <p>Therefore, the KKT conditions for the continuous case are: \begin{align} \mathcal{L}_x (\delta x) &amp;= \langle f'(x), \delta x \rangle_{L_2} + \langle \lambda, \delta x \rangle_{L_2} &amp;= 0 ~ \forall \delta x\\ \lambda \left(x - \beta \right) &amp;= 0 ~ \text{a.e.} \end{align}</p> <p>Are these KKT correct? Is using the $L_2$ inner product the way to go or I should have used another space such as $L_{\infty}$?</p>
0non-cybersec
Stackexchange
Querystring search on array elements in Elastic Search. <p>I'm trying to learn elasticsearch with a simple example application, that lists quotations associated with people. The example mapping might look like:</p> <pre><code>{ "people" : { "properties" : { "name" : { "type" : "string"}, "quotations" : { "type" : "string" } } } } </code></pre> <p>Some example data might look like: </p> <pre><code>{ "name" : "Mr A", "quotations" : [ "quotation one, this and that and these" , "quotation two, those and that"] } { "name" : "Mr B", "quotations" : [ "quotation three, this and that" , "quotation four, those and these"] } </code></pre> <p>I would like to be able to use the querystring api on individual quotations, and return the people who match. For instance, I might want to find people who have a quotation that contains (this AND these) - which should return "Mr A" but not "Mr B", and so on. How can I achieve this?</p> <p>EDIT1:</p> <p>Andrei's answer below seems to work, with data values now looking like:</p> <pre><code>{"name":"Mr A","quotations":[{"value" : "quotation one, this and that and these"}, {"value" : "quotation two, those and that"}]} </code></pre> <p>However, I can't seem to get a query_string query to work. The following produces no results:</p> <pre><code>{ "query": { "nested": { "path": "quotations", "query": { "query_string": { "default_field": "quotations", "query": "quotations.value:this AND these" } } } } } </code></pre> <p>Is there a way to get a query_string query working with a nested object?</p> <p>Edit2: Yes it is, see Andrei's answer.</p>
0non-cybersec
Stackexchange
A friend volunteers at an old age home in Australia and was greeted with this today. She’s still crying..
0non-cybersec
Reddit
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
Theoretical question. If you would take physical appearance out of the equation - would workouts change?. Let's say you don't really care about being toned or big or muscular. You just want to get faster, stronger, more physically capable. Able to run faster for longer, carry heavy things with more ease. Just be a better working machine overall. (I've never been in the military but I imagine this is something they try to achieve in military training). Would the popular workouts stay the same or would one be advised on doing something else. One of the reasons I am asking is that I would like to get fit however I need my mind to be on board. My mind - although it would like for me to look good (currently I am what one would call skinny fat or what has recently been called the dad bod (lol) nearly 30 years old and male) does not accept looking good as the single argument to start inflicting pain to myself. It is not sufficient as an argument for me to start doing stuff I hate. I can however get on board with becoming a better human. A well oiled machine capable of more difficult feats - not just for the looks. I don't really want a six pack or the stress which comes with acquiring and keeping one. Also can't really get on board with acquiring everything in 30, 60, 90 days. I don't care about quick results more about changing my life altogether and become a more balanced, healthy human in the process. Maybe there even is a workout which wants to achieve precisely that or maybe it's all the same. Thoughts? Thank you
0non-cybersec
Reddit
Setting up Passenger + Nginx on Arch. <p>I'm trying to setup passenger and nginx on Arch, but I can't seem to get the nginx server to even start. </p> <p>I've followed the guide found here: <a href="https://wiki.archlinux.org/index.php/Nginx#Ruby_Integration_.28Ruby_on_Rails_and_Rack-based.29" rel="nofollow noreferrer">https://wiki.archlinux.org/index.php/Nginx#Ruby_Integration_.28Ruby_on_Rails_and_Rack-based.29</a> under option A using the ruby gems to do the installation. I have nginx installed in the /opt/nginx/ directory.</p> <p>I've symbolically linked /opt/nginx/sbin/nginx to /usr/bin/nginx and added the init script found at <a href="https://wiki.archlinux.org/index.php/Nginx/Init_script" rel="nofollow noreferrer">https://wiki.archlinux.org/index.php/Nginx/Init_script</a>. I've also changed the permissions to 755 and it is owned by root as suggested.</p> <p>I get the following error though when I run <code>sudo /etc/rc.d/nginx start</code></p> <pre><code>/etc/rc.d/nginx: line 5: /etc/conf.d/nginx: No such file or directory :: Checking configuration [BUSY] nginx: [crit] pread() "/opt/nginx/" failed (21: Is a directory) nginx: configuration file /opt/nginx/ test failed </code></pre> <p>What does this mean?</p>
0non-cybersec
Stackexchange
The show technical items button is missing. <p>I just installed Ubuntu 15.04 vivid i386. In the software center the option to show technical items is missing? I have no idea what to do.</p>
0non-cybersec
Stackexchange
I see your dad enjoying the the ride, and raise you three terrified daughters..
0non-cybersec
Reddit
Pulling Data in Excel into Separate Sheet. <p>I am looking to pull all rows in an excel sheet matching a certain condition programatically: Given 3 Sheets in a workbook: Sheet 1 Contains a spreadsheet with multiple rows and columns where some rows have repeated values.</p> <p>My goal is to be able to input a certain value for a column in Sheet 2 and have Sheet 3 list all rows in Sheet 1 that match that criteria. Thus, I want to avoid manually filtering and copying where possible. </p> <p>The only way I can think to do this is using Index and Match, but so far I have only been able to modify this to return the first matching result from Sheet 1, even if there are multiple rows containing that value. </p>
0non-cybersec
Stackexchange