EDIT 1 This question was closed almost immediately, since it's supposed to be a . I beg to differ since the &quot;original&quot; question is about general argument binding, where this question (correctly) resolves a new issue via @Phil's comment. I believe that .bind prepending arguments before the hidden argument event on which you may then call event.preventDefault() is not common knowledge for all. For other's sake, I believe this question will stay open. EDIT 2 Another knowledge bomb (no sarcasm) from @Phil. In original question it is shown, that instead of .addEventListener('event', callable.bind(this, data)) a possibly clearer way would be .addEventListener('event', e =&gt; callable(e, data)) meaning using an intermediate anonymous function that you may put arguments into. A bonus here is that any data fetched (e.g. from a form) is fetched at the time of triggering event, which is clearly advantageous. ORIGINAL QUESTION I likely didn't do the title rightly, so please comment a more appropriate one for me to edit. Best explaining with an example. This works: &lt;script&gt; form.addEventListener('submit', (e) =&gt; {     e.preventDefault();     const data = {         name: form.name.value,     };     fetch('logics-url.php', {             ...,             body: JSON.stringify(data),         })         .then(r =&gt; r.json())         .then(d =&gt; console.log(d))         .catch(e =&gt; console.error(e)); }); &lt;/script&gt;  Then I need the same logic-url.php called with different (additional) data when a button outside of the form is clicked. First I extracted the callable from inside of the addEventListener and this still works: &lt;script&gt; const callable = (e) =&gt; {     e.preventDefault();     const data = {         name: form.name.value,     };     fetch('logics-url.php', {             ...,             body: JSON.stringify(data),         })         .then(r =&gt; r.json())         .then(d =&gt; console.log(d))         .catch(e =&gt; console.error(e)); } form.addEventListener('submit', callable); button.addEventListener('click', callable); // button *is* defined in this scope &lt;/script&gt;  Now I want to send different data these two addEventListeners and this where it fails me. &lt;script&gt; const callable = (e, data) =&gt; {     e.preventDefault();     // Removed data here     fetch('logics-url.php', {             ...,             body: JSON.stringify(data),         })         .then(r =&gt; r.json())         .then(d =&gt; console.log(d))         .catch(e =&gt; console.error(e)); }  const data1 = {     name: form.name.value, }; form.addEventListener('submit', callable.bind(null, data1));  const data2 = {     name: form.name.value,     trigger: 1, }; button.addEventListener('click', callable.bind(this, data2)); &lt;/script&gt;  I foolishly tried binding e, when it does not exist yet, so I removed it. Then (as you can see) I tried binding null and this and they both resulted in error: # console Uncaught ReferenceError: e is not defined at callable  I tried different variations but most resulted in the above error. I also tried passing just dataN as a lone parameter and it resulted in: # console POST {...}/logics-url.php 400 (Bad Request) Error: SyntaxError: Unexpected token &lt; in JSON at position 0  Do I have to duplicate my code or is there another way?
The situation is somewhat like-  var someVar = some_other_function(); someObj.addEventListener("click", function(){     some_function(someVar); }, false);   The problem is that the value of someVar is not visible inside the listener function of the addEventListener, where it is probably being treated as a new variable.
How to wait in bash for several subprocesses to finish and return exit code !=0 when any subprocess ends with code !=0? How to wait in a bash script for several subprocesses spawned from that script to finish and return exit code !=0 when any of the subprocesses ends with code !=0 ?  Simple script:  #!/bin/bash for i in `seq 0 9`; do   doCalculations $i &amp; done wait   The above script will wait for all 10 spawned subprocesses, but it will always give exit status 0 (see help wait). How can I modify this script so it will discover exit statuses of spawned subprocesses and return exit code 1 when any of subprocesses ends with code !=0?  Is there any better solution for that than collecting PIDs of the subprocesses, wait for them in order and sum exit statuses? get the value from force:RecordData on Init handler Is there a way we can get the value from force:RecordData on init ? I am getting the onclick event of a button.  &lt;aura:handler name="init" value="{!this}" action="{!c.doInit}"/&gt;     &lt;aura:attribute name="recordId" type="String"/&gt;      &lt;aura:attribute name="showButton" type="Boolean" default="false"/&gt;     &lt;aura:attribute name="Opportunity" type="Object"/&gt;        &lt;aura:attribute name="parentOpp" type="Object"/&gt;     &lt;aura:attribute name="oppLoadError" type="String"/&gt;     &lt;force:recordData aura:id="oppRecordLoader"                       recordId="{!v.recordId}"                       fields="Id,                               Name,                               AccountId,                               Cohort_Sem__r.End_date__c,                               LeadSource,                               Staff_Referral_Detail__c,                               lead_source_detail__c"                       targetRecord="{!v.Opportunity}"                       targetFields="{!v.parentOpp}"                       targetError="{!v.oppLoadError}"                       /&gt;   JS:  doInit: function(component, event, helper) {                     var opp = component.get("v.parentOpp");                   console.log('Name Value: '+ opp.Name);     }   Error:     Action failed: c:createIWSRecord$controller$doInit [Cannot read   property 'Name' of null] quickActionHandlerHelper.js failed to create   component - forceChatter:lightningComponent Let $\Bbb R^+$ be the set of positive real numbers. Use Zorn's Lemma to show that $\Bbb R^+$ is the union of two disjoint, non-empty subsets, each closed under addition. What is the formal definition of polynomial ring of several variables? Let's consider a polynomial ring of single variable. One can define them informally by saying $P(X)=\sum_{i=1}^n a_n X^n$ while $X$ is an indeterminate variable. However, since mathematics is based on first-order logic, one can only talk about something that actually exists (as a set). So as its name says, indeterminate variable is not a sentence in $ZFC$. Nevertheless, we can formally define a polynomial ring $R[X]$ as a subset of $R^\omega$ whose support is finite. ($R$ is a commutative ring with unity) Just like a single variable, I want to know what would be the formal definition of a polynomial ring of several variables. What would be a formal definition? === I have figured out a candidate. That is,  Candidate for a &quot;Definition of a polynomial ring $R[X_1,...,X_n]$&quot;. ($R$ is a commutative ring with unity) Let $R[X_1,...,X_n]$ be the set of all functions $f:\omega^n \rightarrow R$ whose support is finite. Define $(f+g)(a,b,c)=f(a,b,c)+g(a,b,c)$ and $(f•g)(a'',b'',c'')=\sum_{a+a'=a''} f(a,b,c)•g(a',b',c')$ (Note that in this way, $+,•$ are well defined.) Then, it can be checked that $(R[X_1,...,X_n],+,•)$ is a ring.  Is this a formal definition of a polynomial ring? Approximation of real number to the power of irrational Say I have two numbers, $c\in\Bbb R^+\,,q\in\Bbb{R\setminus Q}$.  Is there a way to approximate the value of $c^q$?  This question bugging me because of how simple it sound in compare to how complicated it is. First I want to understand what a power of irrational number is, when talking about $\Bbb R^+$(I use this domain for sake of simplicity) we have very well defined actions for power a rational number, we can even use some theorems to get $c^{a/b}=\sqrt[b]{c^a}$, but when I am dealing with irrational number I can not do this.  I know that we have some definition for this because the solution of the equation $2^x=3$ is irrational.  So what exactly does it mean to take something to a irrational power and is there a way to approximate a numeric value for this? How do I choose grid and block dimensions for CUDA kernels? Failed review audit - for me quite clearly off-topic, can it be removed from the audit set? My Ubuntu 12.04 was normally updated through the Update Manager, something about gtk. Then I rebooted and now all that shows after the splash screen is a blue screen that only shows the cursor. In my Master thesis, I would like to have the title page without any page number and an acknowledgments section and the table of contents with roman numbers. The rest of the document should be numbered arabic.  I have tried this, to have roman numbers for the Table of contents and normal numbers for the rest.  \documentclass[12pt,ngerman,openany]{report} \usepackage{titlesec} \usepackage{titletoc} \usepackage{cite} \usepackage[a4paper]{geometry} %\usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[ngerman]{babel} %\usepackage{ngerman}{babel} \usepackage[T1]{fontenc} \usepackage{graphicx} \usepackage{float} \selectlanguage{ngerman} \usepackage{amssymb} \usepackage{amsmath} \usepackage{url} \usepackage{epstopdf} \usepackage{scrhack} \usepackage{listings} \usepackage{caption} \titleformat{\chapter}{\rmfamily\huge}{\textbf\thechapter.}{25pt}{\huge\textbf} \defcaptionname{ngerman}{\lstlistingname}{Code} \defcaptionname{ngerman}{\lstlistlistingname }{Codeverzeichnis}  \lstloadlanguages{R}  \lstset{% general command to set parameter(s)    basicstyle=\sffamily\footnotesize, % print whole listing small    keywordstyle=\sffamily\footnotesize\bfseries, % ubold black keywords    identifierstyle=, % nothing happens    commentstyle=\sffamily\footnotesize\slshape, % green comments    stringstyle=\sffamily\footnotesize, % typewriter type for strings    showstringspaces=false, % no special string spaces    numbers=left,    numberstyle=\sffamily\footnotesize,    stepnumber=1,    numbersep=10pt,    showspaces=false,    showtabs=false,    frame=lines,    morecomment=[l]{\%},    float=htbp,    numberbychapter=true  }   \begin{document} \let\cleardoublepage\clearpage   \pagenumbering{roman}  \tableofcontents  \clearpage  \vspace*{75mm} \chapter{Einleitung} \section{Motivation} bla bla bla \section{Ziel}  bla bla \chapter{Stand der Technik zur Mustererkennung} \section{Die Zeitreihen} bla bla \subsection{Beschreibung} bla bla \subsection{Erklärung}  bla bla  \subsection{Vorhersage} bla bla \subsection{Kontrolle} bla bla \section{Feature Extraktion} bla bla \subsection{Autokorrelation} \subsection{Was ist Autokorrelation?} bla bla   \subsection{Autokorrelation und Zeitreihen} bla bla  \subsubsection{Zeitreihe-Diagramm}  bla bla \subsubsection{Lagged Streudiagramm} bla bla  \subsubsection{Autocorrelation-Function (Korrelogramm)} bla bla \subsection{Spektralanalyse} \subsection{Was ist Spektral-Analyse} bla bla \end{document} Squeezing all the SEO out of a URL as possible I am working on an ecommerce site, I told our SEO consultant that I plan to make the URL scheme: /products/&lt;id&gt;/&lt;name&gt;. This is similar to Stackoverflow's URLs which are /questions/&lt;id&gt;/&lt;title&gt;.  He asked me if I could change the URL scheme to /p/&lt;id&gt;/&lt;name&gt; instead. I know why he wants this change, the word "products" isn't needed to find the correct product, and it doesn't offer any SEO, so shortening it to just p would make the relevant keywords in the &lt;name&gt; weigh more.  His main priority is maximizing SEO, but the part that I don't think he is considering is how this effects the semantics of the site. Also having the word "products" looks like it has meaning and a reason for being there, just having a p looks chaotic and ugly to me. I also don't think it makes that much of a difference does it? Stackoverflow doesn't use /q/&lt;id&gt;/&lt;title&gt; and they do just fine, I do realize that theres many factors at play here though, not just the URL.  So I want some outside opinions on which is the better way and why? Mention a specific potential adviser and project in the PhD statement of purpose I am writing my statement of purpose for my Ph.D. and I want to work in a specific field with a specific professor in the department that I am going to apply for and I have a very good experience in this field. I sent an email for that professor asking if he/she is accepting Ph.D. students and he/she did not respond. I built my whole statement of purpose based on my previous achievements and future plan for that specific area. I also mentioned that I am willing to work with that professor. My statement of purpose tells that I am very passionate about this field and I am only willing to work with that professor (if there were more than one professor working on the same area, I would mention all of them). if that professor doesn't accept new Ph.D. students, will I risk my admission to that school?   Will the committee response be something like this:  "the applicant really knows what he/she is going to do and there is a specific future plan and he/she also got a good experience in this field, but he/she sounds very strict to his plan and doesn't show any flexibility...REJECTED"? For primes $p≡3\pmod 4$, prove that $[(p−1)/2]!≡±1\pmod p$. I know to use Wilson's Theorem and that each element in the second half is congruent to the negative of the first half, but I'm not sure how to construct a proof for it. What is wrong with defining \bal as \begin{align}? I'm trying to define two commands \bal and \eal instead of inserting \begin{align} and \end{align} in my document, but in the code below, I'll get some errors. What is wrong with it?    \documentclass{article} \usepackage{amsmath} \makeatletter  \newcommand{\bal}{%  \begingroup  \align% \@ifstar{\nonumber}{}%  }  \newcommand{\eal}{\endalign\endgroup} \makeatother \begin{document} \bal* x=y \eal ‎\end{document} How can I disable the purple splash screen at boot? How can I disable the purple "Ubuntu" splash screen that displays at boot before the login screen has loaded? I'd prefer to just see plain text scroll by. There are so called "point releases" for LTS versions of Ubuntu. 10.04.3 for instance.  What are those "point releases" releases? Developer Accounts for ExactTarget I recently got a lenovo Y40 laptop and after i installed ubuntu 14.04 (also in the live usb) Wireless doesn't work. It says that it is disabled by hardware switch, however the hardware switch doesnt work (its intention is to put on airplane mode but does nothing when pressed in ubuntu) wireless works in windows and the BIOS has it enabled. I tried resetting the BIOS but it still doesn't work. Here are some command outputs  lspci:  03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 10) 04:00.0 Network controller: Intel Corporation Wireless 3160 (rev 93)   rfkill list all:   0: ideapad_wlan: Wireless LAN     Soft blocked: no     Hard blocked: yes 1: ideapad_bluetooth: Bluetooth     Soft blocked: no     Hard blocked: yes 2: hci0: Bluetooth     Soft blocked: no     Hard blocked: no 3: phy0: Wireless LAN     Soft blocked: no     Hard blocked: no   lswh:     *-network         description: Ethernet interface         product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller         vendor: Realtek Semiconductor Co., Ltd.         physical id: 0         bus info: pci@0000:03:00.0         logical name: eth0         version: 10         serial: f8:a9:63:31:2e:b6         size: 1Gbit/s         capacity: 1Gbit/s         width: 64 bits         clock: 33MHz         capabilities: bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation         configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=full firmware=rtl8168g-3_0.0.1 04/23/13 ip=192.168.1.4 latency=0 link=yes multicast=yes port=MII speed=1Gbit/s         resources: irq:64 ioport:4000(size=256) memory:c0604000-c0604fff memory:c0600000-c0603fff *-pci:3      description: PCI bridge      product: Lynx Point-LP PCI Express Root Port 4      vendor: Intel Corporation      physical id: 1c.3      bus info: pci@0000:00:1c.3      version: e4      width: 32 bits      clock: 33MHz      capabilities: pci normal_decode bus_master cap_list      configuration: driver=pcieport      resources: irq:59 memory:c0500000-c05fffff    *-network DISABLED         description: Wireless interface         product: Wireless 3160         vendor: Intel Corporation         physical id: 0         bus info: pci@0000:04:00.0         logical name: wlan0         version: 93         serial: a0:88:69:90:0a:38         width: 64 bits         clock: 33MHz         capabilities: bus_master cap_list ethernet physical wireless         configuration: broadcast=yes driver=iwlwifi driverversion=3.13.0-32-generic firmware=22.24.8.0 latency=0 link=no multicast=yes wireless=IEEE 802.11abgn         resources: irq:66 memory:c0500000-c0501fff UnboundLocalError on local variable when reassigned after first use The following code works as expected in both Python 2.5 and 3.0:  a, b, c = (1, 2, 3)  print(a, b, c)  def test():     print(a)     print(b)     print(c)    # (A)     #c+=1       # (B) test()   However, when I uncomment line (B), I get an UnboundLocalError: 'c' not assigned at line (A). The values of a and b are printed correctly. This has me completely baffled for two reasons:   Why is there a runtime error thrown at line (A) because of a later statement on line (B)? Why are variables a and b printed as expected, while c raises an error?   The only explanation I can come up with is that a local variable c is created by the assignment c+=1, which takes precedent over the "global" variable c even before the local variable is created. Of course, it doesn't make sense for a variable to "steal" scope before it exists.  Could someone please explain this behavior? I am thinking of buying a camera to learn photography. Most of the time I'll be shooting portraits and landscapes. But I am not sure where I should start. Most of my friends tell me that I should get an entry level DSLR, but I am not sure if I have the persistence and enthusiasm to carry it all day in a backpack. But the camera on my cellphone doesn't seem to be enough to begin with.  So what I want is some expert advice (preferably with professional experience). Can most compact fixed-lens or mirrorless cameras fit the situations I mentioned? Or do I really need to go to a DSLR to get a tool to learn photography? Deleting an element from an array in PHP