.click() from an object property on appended buttons in jQuery

I'm making several buttons from an object and append them to the only div in the body: #main, everything works fine except for actual click function: I can't seem to make the buttons alert different properties.  This is my object:  var BrushDesc = function (n, i, t) {     this.presetName = n;     this.elemId = i;     this.preset = t; }; var brush = {}; brush.circ = new BrushDesc("circle", "circle", "basic circle"); brush.rect = new BrushDesc("rectangle", "rect", "19-2"); brush.softy = new BrushDesc("round soft", "softy", "softy"); brush.rake = new BrushDesc("|||", "rake", "21-3");   that was my first attempt appending the buttons but this always alerts last .preset property of the object:  for (var i in brush) {     $('<button id="'+brush[i].elemId+'">'+brush[i].presetName+'</button>')     .appendTo("#main")     .click(function() {alert(brush[i].preset)});  }   So I thought 'okay :('. Then I made it differently and this seems to work but in the same time this looks really wrong (mostly because this relies on .elemId and brush.property having the same name:  for (var i in brush) {     $('<button id="'+brush[i].elemId+'" class="main">'+brush[i].presetName+'</button>')     .appendTo("#main") }  $(".main").click(function() {     var buttonId = $(this).attr("id");     for (var i in brush) {         if (brush[i].elemId == buttonId) alert(brush[i].preset)     } });   Can anyone please make it right?  edit: Thanks for pointing the Closures thread (haven't used them yet) Felix, but I'm not sure I understand how to apply this to my objects  var tps = []; function createTps(i) {return function() {alert(br[i].preset)}} //doh for (i = 0; i<5; i++) {tps[i] = createTps(i)} //but I should have keys here, not numbers?  var j = 0; for (var i in br) {     $('<button id="' + br[i].elemId + '" class="main">' + br[i].presetName + '</button>')     .appendTo("#main")     .click(function() {tps[j](); j++}); //yeah, sure }   edit2 Actually a friend of mine suggested to use Immediately-Invoked Function Expression instead of closure and it worked perfectly  for (var i in brush) {     (function (i) {         $('<button id="'+brush[i].elemId+'">'+brush[i].presetName+'</button>')         .appendTo("#main")         .click(function() {alert(brush[i].preset)});     })(i); }


I have an iPhone that was synced to an iTunes library. Then I upgraded my Mac, and forgot to backup the iTunes library and transfer it to the new Mac. Ever since, I have been manually managing my music by dragging and dropping it from the filesystem onto iTunes, and not "syncing".  And things have been working fine for the past few years. But now, after yet another Mac upgrade, and upgrading to iTunes 11, I can no longer manually manage my music on my iPhone. When I try to turn on "manually manage music and videos", iTunes says:  The iPhone “kPhone” is synced with another iTunes library on “kart's macbook”. Do you want to erase this iPhone and sync with this iTunes library?  I don't want to erase the whole phone -- apps, app data, app settings, synced data in apps, videos, books, etc. I just want to copy music onto the iPhone. I have already deleted the music that's already on the iPhone. How do I copy music?


$x!+1=y^2$, I found 3 solutions. They are $(4,5),(5,11),(7,71)$. Is there a $4$th solution?If not can you prove it?


Type casting when == used instead of ===

I generally don't prefer using == but today i was just experimenting with the following code including == and the results are a bit confusing to me. Can someone please explain what is happening?  All these are falsy values:   '', 0, false, undefined, null   Suppose i did:  if (undefined == null) {     alert('a'); } else {     alert('b'); }   The statements below give true:  null == undefined 0 == '' false == '' 0 == false   But why does the code below return false?  undefined == 0 undefined == '' null == 0


In a question paper I got the following two questions.   $u(z)=u(x,y)$ be a harmonic function in $\mathbb{C}$ satisfying $u(z)\le a|\ln|z||+b$ for some positive constants $a,b$ and for all complex numbers. Show that $u$ is constant. If for all complex numbers, $u(z)\le |z|^n$ for some $n\in \mathbb{N}$, then $u$ is a polynomial in $x,y$.   I am completely stuck with this one.


I keep doing classes and typing away at learning programming and in a few different lesson they say this is how you declare a null variable(java and Kotlin if i remember right python is a "none" not exactly the same).   But everything I read or learn says don't do it.  Why do it or is there a legitimate use for one?  REV 1.0 Below  I edited and rolled this question back some because a none after some more digging into the subject acts very similar as a null.  Instead of changing my question please make comments on how i can look at it differently or reframe or ask better questions.


Every element of a group has finite order

Suppose that $G$ is a group, and that the intersection over the non-trivial subgroups of $G$ is non-trivial, i.e., that $$\bigcap_{H<G\atop H\ne \{e\}} H\neq\{e\}.$$ I need to demonstrate that  every element of $G$ has finite order.  I tried showing that if the intersection is trivial, an element of infinite order would be there, but couldn't get anywhere.


I'm travelling to the US from the UK under the visa waiver programme (ESTA approved).  I'm going for 1 week, coming back to the UK for 3 days (for work reasons), then going back to the US for another 3 weeks. Is this going to be a problem at border control, i.e. are they going to think I'm trying to reset a 90-day visit even though I'm only there for a few weeks at a time?


I'd like to transform my data into pca (preprocessing data before I use data into classification model). I separate my data into data training and data testing.  I used princomp in R to process pca with my data training, and I've got the loadings(eigenvector) of the pca data training.   Is it correct if I multiplied datatest with the loadings from the datatraining and get the scores of pca datatesting?


Given the sum of this series, find the sum of another series.

I've stumbled across this problem that asks, given this series whose sum is that:  $$\sum_{n=1}^∞ \frac{1}{n^2} = \frac{{\pi^2}}{6}$$  Find the sum of this series: $$\sum_{n=1}^∞ \frac{1}{(2n-1)^2} $$ The second function is just the odd function of the first function, however, I do not know where to proceed from there.


How do you put multiple things under a limit?

I'm reading about inverse limits, and the notation sometimes requires some sort of index or set over which to take the inverse limit. It looks something like this:    How would I correctly TeX that? I tried something like             {\lim_{\longleftarrow}}_{H\in\mathscr{F}} but the arrow and the set are side by side, not one over the other.


Aligning objects in Illustrator does not produce expected result

I believe I am an expert Illustrator user, but I've never seen this weird behavior before.  The Align setting is set to "Align to Selection". However when I click "Horizontal Align" or "Vertical Align", the objects move away from each other. Each subsequent click on the Align Panel moves them further away from each other.    I tried resetting Bounding Boxes in the Transform panel, which proved fruitless.  Am I doing something wrong, or is this the latest Illustrator glitch?  Illustrator 23.0.4


When you vote on a post in the app (all sites), it remembers the vote on the server, but shortly after voting, the vote will appear to be unrecorded on the device until you refresh the page. If you try to vote again on the post, it gives you an error that You've already voted on this post, however it doesn't show the vote. (Until the page is refreshed)    App Version: 1.0.85 Device Manufacturer: motorola Device Model: MotoE2(4G-LTE)   OS Version: 5.1 (2)


How to change/fix system's locale when you setup in a language not official in your country?

How do I set up a global locale for the computer?  I have recently installed Kubuntu 14.04LTS in english but since I am in Spain, I chose Spain as a country and then changed locale options so that I get all country specific configuration such as digit grouping, decimal separator, date format, etc. I also added the spanish language.  Now all applications complain that locale is wrong. check-language-support tells me I'm using en_ES.UTF-8 as system's locale, and that locale is indeed wrong, there is no locale for english language in Spain.  I tried using Kubuntu's country/region & language settings but it doesn't fix it. I tried using export LANG=en_GB.UTF-8 and export LC_ALL=en_GB.UTF-8 and then sudo dpkg-reconfigure locales and that caused check-language-support to say that I now have a correct configuration but if it is, it's only in that konsole session. This problem also prevents konsole from showing unicode characters and I cannot use dead keys or enter any 'international character' such as ñ or ç (those work on other applications such as Firefox, that I'm using to post this question).  So the question is: How do I set up a global locale for the computer?  This is not a bug report, I will probably reinstall my computer eventually if I can't fix it. But I really want to know how I can perform this REALLY basic task.  Thank you.  $ check-language-support perl: warning: Setting locale failed. perl: warning: Please check that your locale settings:         LANGUAGE = "en:es:en",         LC_ALL = (unset),         LC_PAPER = "en_ES.UTF-8",         LC_ADDRESS = "en_ES.UTF-8",         LC_MONETARY = "en_ES.UTF-8",         LC_NUMERIC = "en_ES.UTF-8",         LC_TELEPHONE = "en_ES.UTF-8",         LC_IDENTIFICATION = "en_ES.UTF-8",         LC_MEASUREMENT = "en_ES.UTF-8",         LC_TIME = "en_ES.UTF-8",         LC_NAME = "en_ES.UTF-8",         LANG = "en_ES.UTF-8"     are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_MESSAGES to default locale: No such file or directory locale: Cannot set LC_COLLATE to default locale: No such file or directory hunspell-en-ca libreoffice-help-en-gb libreoffice-l10n-en-gb libreoffice-l10n-en-za mythes-en-au wspanish  $ cat /etc/default/locale LANG="en_US.UTF-8" LC_NUMERIC="es_ES.UTF-8" LC_TIME="es_ES.UTF-8" LC_MONETARY="es_ES.UTF-8" LC_PAPER="es_ES.UTF-8" LC_NAME="es_ES.UTF-8" LC_ADDRESS="es_ES.UTF-8" LC_TELEPHONE="es_ES.UTF-8" LC_MEASUREMENT="es_ES.UTF-8" LC_IDENTIFICATION="es_ES.UTF-8"   $ locale locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_MESSAGES to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: No such file or directory LANG=en_ES.UTF-8 LANGUAGE=en:es:en LC_CTYPE="en_ES.UTF-8" LC_NUMERIC=en_ES.UTF-8 LC_TIME=en_ES.UTF-8 LC_COLLATE="en_ES.UTF-8" LC_MONETARY=en_ES.UTF-8 LC_MESSAGES="en_ES.UTF-8" LC_PAPER=en_ES.UTF-8 LC_NAME=en_ES.UTF-8 LC_ADDRESS=en_ES.UTF-8 LC_TELEPHONE=en_ES.UTF-8 LC_MEASUREMENT=en_ES.UTF-8 LC_IDENTIFICATION=en_ES.UTF-8 LC_ALL= $ update-locale perl: warning: Setting locale failed. perl: warning: Please check that your locale settings:         LANGUAGE = "en:es:en",         LC_ALL = (unset),         LC_PAPER = "en_ES.UTF-8",         LC_ADDRESS = "en_ES.UTF-8",         LC_MONETARY = "en_ES.UTF-8",         LC_NUMERIC = "en_ES.UTF-8",         LC_TELEPHONE = "en_ES.UTF-8",         LC_IDENTIFICATION = "en_ES.UTF-8",         LC_MEASUREMENT = "en_ES.UTF-8",         LC_TIME = "en_ES.UTF-8",         LC_NAME = "en_ES.UTF-8",         LANG = "en_ES.UTF-8"     are supported and installed on your system. perl: warning: Falling back to the standard locale ("C").


If the Winter Soldier is a Soviet Agent, how did HYDRA obtain him as an asset?

In the film Captain America: The Winter Soldier, a flashback explains how     Bucky was 'recovered' after his fall from the train.   I can't recall whether it is explicitly stated that he fell into the custody of the Soviet Union, but I know this to be the case in the 616 and he speaks Russian in the film.  The bunker under Camp Lehigh contains      Arnim Zola, who provides a piece of expository dialogue describing how he was acquired through "Operation Paperclip", colloquially known in Europe as The Brain Drain.   At the conclusion of WWII, Europe was divided up between what would eventually become the EU and the USSR. In order to keep players off the table, a great number of European 'assets' were repatriated as Americans:     Arnim Zola being one of them, and it is implied that the Winter Soldier is another.   If the Winter Soldier was already a Soviet asset, how have HYDRA (a German/American brain-drain coalition of Fascism) come to be in possession of him? If the Soviets created the Winter Soldier as a weapon against American-Intelligence/HYDRA/SHIELD, why is he fighting on their side? does the film explain this at all, or have I missed something?


Large standard errors in Logistic Regression Model

Below you will see a screen grab off the tail of my results, where you get to my control variables. In short, I ran 4 competing models to explain a phenomenon.  The Dataset was originally very large - however, in order to make the AIC and BIC comparable to one another, I decided to put them all into a data frame using the Complete.cases function. There  The result is that the sample size is vastly reduced to 240 and many coefficients and Standard Errors are large.  Actually, that's an understatement - the standard errors are very large indeed.  Sorry to ask a simple question but do I have problems here?  Henry  Combinedframe <- data.frame(bes$influence,bes$groupbenefits,bes$satisfaction,bes$guilty,bes$civicduty,bes$democracy,bes$personalbenefits,bes$toobusy,bes$age,bes$gender,bes$ethnic,bes$religion,bes$education,bes$labourcrime,bes$laboureducation,bes$labourimmigration,bes$labournhs,bes$labourterrorism,bes$labourecon,bes$Govfair,bes$minor,bes$demosat,bes$persretro,bes$natretro,bes$perspro,bes$natpro,bes$interest,bes$attention,bes$newspaper,bes$contacted,bes$asked,bes$know1,bes$know2,bes$know3,bes$know4,bes$know5,bes$know6,bes$know7,bes$know8,bes$vote,bes$realchoice,bes$goodcand,bes$sayvsdo,bes$brown,bes$cameron,bes$clegg,bes$browncomp,bes$cameroncomp,bes$cleggcomp,bes$attachment,bes$fairelections,bes$trustwestminster,bes$trustparties) Combined <- Combinedframe[complete.cases(Combinedframe),] View(Combined)  #################COMBINED DATA FRAME MODELS####################  Model1b <- glm(bes.vote~ bes.influence+bes.groupbenefits+bes.satisfaction+bes.guilty+bes.civicduty+bes.democracy+bes.personalbenefits+bes.toobusy+bes.age+bes.gender+bes.ethnic+factor(bes.education)+bes.religion, data=Combined, family=binomial) summary(Model1b)  Model2b <- glm(bes.vote~ bes.labourcrime+bes.laboureducation+bes.labourimmigration+bes.labournhs+bes.labourterrorism+bes.labourecon+bes.Govfair+bes.minor+bes.demosat+bes.persretro+bes.natretro+bes.perspro+bes.natpro+bes.gender+bes.age+bes.ethnic+factor(bes.education)+bes.religion, data= Combined, family=binomial) summary(Model2b)  Model3b <- glm(bes.vote~ bes.interest+bes.attention+bes.newspaper+bes.contacted+bes.asked+bes.know1+bes.know2+bes.know3+bes.know4+bes.know5+bes.know6+bes.know7+bes.know8+bes.age+bes.gender+bes.ethnic+factor(bes.education)+bes.religion, data= Combined, family=binomial) summary(Model3b)


For $n \in \mathbb{N}$, prove that $\int_{0}^{\infty}x^{n}e^{-x}dx=n!$

Well I am aware of the exponential representation of a factorial using summation but does this hold true for an integral as well? How should I prove this? Is it simple induction or is there more to this?


How to use the parskip package? (space in between paragraphs)

Sorry, because I think it's a many times asked topic. But I don't find an example which help me to understand how to create a white space between paragraphs.  I think parskip is the package I need to use but I don't know how to use it.  I have this sample of LaTeX trying to understand how to use parskip package. What am I doing wrong?  \documentclass{report}  \usepackage{parskip}  \begin{document} \setlength{\parskip}{0pt} % 1ex plus 0.5ex minus 0.2ex} \setlength{\parindent}{0pt}  \section{Section Headings}  We explain in this section how to obtain headings for the various sections and subsections of our document.  \subsection{Headings in the `article' Document Style}  In the ``article'' style, the document may be divided up into sections, subsections and subsubsections, and each can be given a title, printed in a boldface font, simply by issuing the appropriate command. \parskip Lorem ipsum `comillas simples' sit amet, consectetur adipiscing elit. Fusce at augue nisi. Mauris vel metus velit. Nunc vitae augue justo, non euismod risus. Nullam et bibendum nisl. Vestibulum nec leo lectus. Phasellus non dui et ipsum malesuada venenatis vitae ut risus. Phasellus tincidunt erat sollicitudin leo auctor sed porta leo commodo. Nullam et adipiscing libero. Ut et mi ac dui facilisis faucibus. Fusce eget magna a quam volutpat accumsan. Duis dictum luctus ligula, at facilisis leo blandit sit amet. Phasellus congue ornare lectus scelerisque malesuada. Praesent et cursus nulla. Quisque aliquam felis ac nunc scelerisque a consectetur elit mattis. \\  \end{document}   Will this spacing work in the entire document?


RAID-1 HDD data access in another system

I have Dell Power Edge R210 ii with RAID 1 implemented (2 x 1TB) and windows server 2008 R2. My server got some hardware issues which is not booting and I tried to connect hard drives to a windows 10 system as external and there both of hard drives are detected but cant access them and also their partition is not listed as well. Any way to access the data of these hard drives?


'Alt'+'Shift' problems on GNOME3 (Ubuntu 18.04+)

I want to use Alt+Shift as keyboard layout switcher. The main configuration utility doesn't allow me to do that (it's a default switcher for almost all computer users). Ok, no problem, I can setup it in GNOME Tweak Tool.  But when I press Alt+Shift in e.g. Firefox, it shows me hidden main menu (like if I press single Alt). How can I fix it and make Alt+Shift combination work correctly in all applications?


Mobius transformation from upper plane onto the unit disc

Let $H =\{ z = x +iy \in \mathbb C : y>0 \}$ and $D = \{ z \in \mathbb C : |z| <1\}$ be the open unit disc . Suppose $f$ is a mobius transformation which maps conformaly onto $D$. Suppose that $f(2i) = 0$. Pick each correct statement from below.          $1.$ $\ f$ has a simple  pole at  $z = -2i$.          $2.$ $\ f$ satisfies $f(i)\overline{f(-i)} = 1$          $3.$ $\ f$  has essential singularity at $z = -2i$          $4.$ $\ |f(2+2i)| = \frac{1}{\sqrt5}$       I know that any analytic function from $H$ onto $D$ is of the  form $f(z) = e^{i\theta}\frac{z-z_o}{z-\bar z_o}$, where $z_o$ is the zeroes of $f$, so $f(z) = e^{i\theta}\frac{z-2i}{z-\overline 2i}$,,  thus $f(z) = e^{i\theta}\frac{z-2i}{z+2i}$. Thus $f$ has a simple pole at  $z = -2i$. So 1) is true and 3) is false.  Now $f(i) =  \frac{-e^{i\theta}}{3}$ and $f(-i) =  -3e^{i\theta}$   Therefore $f$ satisfies $f(i)\overline{f(-i)} = 1$, so 2) is also true.  for 4) $|f(2 +2i)| = |\frac{2}{2 +4i}| = \frac{1}{\sqrt 5} $   I would be  thankful if someone check my solution.


After appending a div onclick is not working. Please help me.  jQuery(document).ready(function() {     jQuery(".chack").click(function(){         jQuery( "#pc_form" ).append('

apply
');     });      jQuery(".apply").click(function(){           alert();         });  });

apply here

click


Unable to install Ubuntu (and other Linux distro)

recently I got interested in Linux and I wanted to install a beginners-friendly distribution. So I first decided to install Deepin, but it got stuck at the loading logo and nothing from the solutions worked. I've tried to install other distributions like Mint Cinnamon, Manjaro and Ubuntu, but the instalation ended the same way - it loads, shows the logo and freezes/ gets stuck. I did the installations via bootable USB Drive. My laptop is ASUS K550V (Intel Core i7-6700HQ - 3.5Gz; 8GB RAM; nVidia GTX 950M). Smart Boot from BIOS was disabled by default.


My 1 year 3 months daughter wakes up crying suddenly at night.  I try medicine for stomach pain, leg pain, check the AC (As it is hot summer) but this happens every day from last one month. Actually before 20-25 days she was suffering from acute diarrhea and doctor said it is due to virus. She had severe rashes also at that time. Now everything is cured. this is just for extra information if this has any relation with this sleep problem. Also after that she is still having problem related to motion. some of the days she gets constipation.


Is it possible to see cp speed and percent copied?

I'm having problems when copying large files using nautilus (it gets stuck). I need to copy, using cp. I would like to know if there are any parameters that shows the % copied and also the transfer speed.


Find all rings $R$ satisfying $\mathbb Z \subset R \subset \mathbb Z[\frac {1}{2}]$.   Solution: Let $f \in R$. Then $f= \frac {m}{2^n}$ for some integers $m,n$.  Since $2^{n-1} \in R$, hence $\frac {m}{2} \in R$. Hence one gets that $ \frac {1}{2} \in R$, so $R=\mathbb Z[\frac {1}{2}]$, so there is no ring $R$ satisfying given conditions.     What are the other possible solutions of this problem?    P.S: You can give a solution using any theorem from commutative algebra also.


Using Administrator Credentials to login as a User to Their Desktop

Other than memorizing and documenting each user's credentials, is there way that I can use the Windows Domain Administrator credentials to login to a workstation-user's desktop as if I were them?  I think this is called impersonation, but my searches are finding articles dedicated to running scripts as a particular user, while I need this ability for non-script-administrative purposes.  Sometimes, after hours (for example), I need to see desktops from the User's perspective, and make modifications to aid their work-flows. I have some users who can't find an application unless it is a desktop shortcut! So I need this for stuff like this, and other things too.  Update: I found this question on Server Fault:    None of the answers offered much hope. I guess I'll just have to change the user's password if I don't know what it is an tell them what I changed it to next work-day?  As an admin, I wish I could just login with my admin-credentials to any non-admin user. In Linux, I can do this using the su command.


Automated way to extract irregularly sized sprites from a sprite sheet

I have a sprite sheet from a classic video game (if you're curious, Final Fight) that I'd like to be broken up into indivual images to be used in . However, the images aren't on an even grid, and all have a different amount of space between them.  Is there an automated way to export images based on contiguous pixels or something like that?


Is catching only "Exception" acceptable?

I'm working on a project and all of the catch statements are catching "Exception ex". Is this acceptable? (e.g. 1000's of Exception ex and no sub classes of Exception anywhere)  I'm aware this depends on the situation but I'm trying to get more of a grasp on it, from my perspective you could be missing things that happen when doing this and potentially make it harder to track down issues later?


Infection makes people grow new sense organs; protagonist permits himself to be infected for love

I don't recall enough material for this to be a novel, but I may have simply forgotten a great deal.  The protagonist (young, male, uninfected) is transporting an infected young woman to either a quarantine area or a safe zone.  If I'm not conflating stories, this was set in the U.S. and he's headed roughly for Florida.  I don't recall if he's doing this out of a sense of what's right, or because he's been recruited/paid to do it.  The infection causes people to grow novel sense organs, like the ability to taste things with their hands.  (There may be further effects as the infection progresses, but that happens off-screen.)  They naturally become friendly, and one night he wakes up to find she's running her hands over his face - which will transmit the infection to him.  There are some (2?) scientists involved who are sympathetic/helpful; they offer to try to keep him from getting infected, which essentially involves an acid bath.  He changes his mind at the last minute, deciding to accept being infected to stay with the young woman.  One of the scientists is infected, and in order to stay focused on his work he chooses to chemically burn off any sense organs that grow on him.  I feel like I read this about 12-15 years ago.


particular solution to $y^{(4)} -2y'' +y = xe^x $ using undetermined coefficients

I am trying to find the particular solution to the $y^{(4)} -2y'' +y = xe^x $ and currently am misunderstanding what to do.   My steps:   the polynomial operator concerned is $p(s)= s^4 -2s^2 + 1 $ which  0 at 1:  $p(1) = 0 $  so now i know that the solution will be something like:  $y_p = (Ax^3 + Bx^2)e^x$  where the parentheses show that it is a linear operator on the last coefficient.   so far I think that my method is to differentiate this four times and collect up the terms of each $y_p$ according to the original equation and see what A and B are equal to.   I assume this is okay to do with linear operators?   $y_p' = (Ax^3 + Bx^2)e^x + (3Ax^2 + 2Bx)e^x$  $y_p'' = (Ax^3 +(6A + B)x^2 + (4B + 6A)x + 2B)e^x$  can I collect terms from different linear operators like i did with $y_p''$   and I assume that to find the particular solution I must find $y_p''''$ as it is in the original equation


How does Windows processor affinity work with hyperthreaded CPUs? Let's use an example (pictured) of a system with four cores, each with a hyper-threaded virtual core.  Which cores correspond to each "CPU" below? Does (say) CPU 6 and CPU 7 below represent one core; the HT and the real core? If, for example, CPU 6 represents a real core and CPU 7 an HT core, will a thread assigned just to just CPU7 get only the left over resources of a real core? (assuming the core is running other tasks) Is the hyperthreading managed entirely within the processor such that threads are juggled internally? If so, is that at the CPU scope or the core scope? Example: If CPU 6 and 7 represent one core, does it not matter which a process is assigned to because the CPU will assign resources as appropriate to a running thread? I notice that long-running single-threaded processes are bounced around cores quite a bit, at least according to task manager. Does this mean that assigning a process to a single core will improve performance by a little bit (by avoiding context switches and cache invalidations, etc.)? If so, can I know I am not assigning to "just a virtual core"?  This is all very vague and confusing to me. HT is great, but it sure seems to reduce the transparency of resource allocation.


Anonymous function inheriting variable from parent scope which contains variable

I am trying to declare anonymous functions in a loop, but one of the variables contains the variable name. This is the code I am using: $GREEN = "MY GREEN"; $RED = "MY RED"; $BLUE = "MY BLUE"; $colors = array( 'red', 'green', 'blue'); for ($i = 0; $i < count($colors); $i++)  {     $color = strtoupper($colors[$i]);      ${$colors[$i]} = function ($text) use ($color) {           echo $text . " is " . $color . "\n";       }; } $green("HELLO"); $red("HELLO"); $blue("HELLO");  The result shows: HELLO is GREEN HELLO is RED HELLO is BLUE  But I would like it to show: HELLO is MY GREEN HELLO is MY RED HELLO is MY BLUE  I cannot manage to get it done in PHP.  Obviously use ($color) is not what I need, but use (${$color}) also does not work.


how to enable Create git repository on mac in Xcode exist Project

hello I want to ask something when we create new Xcode project then I forgot to enable button Create git repository on my mac then how to enable this and how to add my code on SVN....for git is use ?


NumPy: finding N largest elements in a matrix

Edited since my last question was a duplicate, but I'm struggling with this as well. I'm currently working with a matrix and can easily find the largest element with  M[M != 1].max()   However, I'm interested in getting the N largest elements and can't find an easy way to do this with matrices. Is there an efficient solution?


I have this lambda and would like it to return Distinct list.  var ResourceTypeNameList = Resources.Select(r => new bl_SelectBox{ text=r.ResourceTypeName, value=r.resourceTypeID }).Distinct();   Am I missing something or should that return a distinct list?


How do you get a Subversion diff summary to ignore mergeinfo properties?

I have the Subversion 1.6.5 client and 1.5.4 server. And I mostly only care about diffs on fully repository paths, not working copies.  When diffing branches, ones that have been merged already show up as identical except for the  properties.  This is a touch annoying for a human who has to then look through the changes looking for anything that might be a real change.  However it's somewhat worse in our usecase as we have scripts that run around checking on the merge state of various things and the mergeinfo properties cause them to highlight a lot of things as being out of sync when they aren't.  Is there a way to get the diff summary to ignore the mergeinfo properties?


Let a be a positive integer. What is $\gcd(a,2a), \gcd(a,2+a)$ and $\gcd(a,1+a)$?

I want to find some arithmetic way of solving these. For the first one:  $$\gcd(1,2) = 1 \Rightarrow 2 = 1*2 + 0 \\ \gcd(a,b) = d \Rightarrow \gcd(ak,bk)=dk,\\ \gcd(a,2a) = a$$  How do you do something like this for the others?


Mann-Whitney U test and K-S test with unequal sample sizes

I want to compare two distributions, to see if they are significantly different. They represent task time completions (so they range from 1 to around 1000 seconds) in two different months. They are not normally distributed. I want to see if their central tendencies are significantly different (at a first glance the mode, mean and median between the two months seem very close, just 3-4 seconds difference), but also to see if their shapes are similar (again, at a first glance, they look similar). I am currently carrying this analysis with SPSS 20. I have the Mann-Whitney test for testing central tendencies and the Kolmogorov-Smirnov test for the shape of the distribution, (although I have read that the K-S test is an overall comparison test for the distributions).  Also, in the first month I have 300,000 observations and in the second month 122,000 observations. So, a lot of data ... but disproportionate. Is this an impediment to running these tests, the fact that the sample sizes are not equal? I ran both Mann-Whitney and K-S and they both seem to reject the null. How much should I trust the results given my sample sizes? Do you suggest any alternative tests? Thanks


Why are the only division algebras over the real numbers the real numbers, the complex numbers, and the quaternions?

Why are the only (associative) division algebras over the real numbers the real numbers, the complex numbers, and the quaternions?  Here a division algebra is an associative algebra where every nonzero number is invertible (like a field, but without assuming commutativity of multiplication).  This is an old result proved by Frobenius, but I can't remember how the argument goes.  Anyone have a quick proof?


When is "the" pronounced "dhee" / "dh" / "dhaa"?

Is it "dhee", "dh" or "dhaa"? I have heard people pronounce it in these three ways. Are all of them correct or does it depend on context?


I want to ask a question I am a new user to Ubuntu and I am    going to install it on my PC and Remove Windows as I have read a lot    about Ubuntu and how it's solid based system and that it's more    stable and stronger but to be honest I am a bit afraid of installing    it as I don't have the drivers CD so Does Ubuntu need drivers or not    ? and how do I check that all the drivers are installed and updated    and work correctly ? and If I want to install a driver will Ubuntu    help me to search for it and install it ?  and will Ubuntu install the sound card . the internet card and the graphics etc. automatically or not waiting for your replies    cheers :)


How to migrate Android device, including SD card?

I have a Huawei Ascend G6, which uses a 32GB SD card to store most app data. I now bought a Huawei Y6 to migrate to and want to retain as much app data as I can. How would I go about to transfer my apps (data) to the new device?  The Y6 has Lollipop, so when booting the device, I was asked which apps to install. So I got all apps installed now. So how do I go about transferring configuration data? I assume I can't just put my SD card into the Y6 and be done with it?


Rep graph overview thing™ is white (only in latest Chrome)

As you can see, if you go to the reputation graph on your profile on Stack Overflow, the bars in the bottom overview will be white. This makes them invisible unless they are selected.  Eeek!  This does not happen on meta or any other site. Also, I cannot seem to reproduce it on others' profile. Possibly a bug only on your own profile? EDIT: I think I've existed for too long. If I change the CSS on one of the bars to stroke: none, then it becomes green. I think the outline is covering the fill because the bars are too skinny. EDIT2: Confirmed hypothesis by reproducing on Jon Skeet's graph. Proposed solution: enforce minimum bar width and add horizontal scrollbar. EDIT3: Can only repro on Chrome 29.0.1547.57 (Official Build 217859) m (the latest version). Norepro on older versions of Chrome, IE9 (winces), all versions of FF, and all versions of Safari. EDIT4: Can be fixed simply by running the JavaScript $('rect').css('stroke-width', '0') or a userstyle rect { stroke: none }. I may make a user[style|script] to fix this.


How can I use launchd to auto update brew?

I followed the instructions on the page  and created (as root) my own plist file named com.personal.brew.plist and located in /Library/LaunchDeamons/:  <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict>     <key>Label</key>     <string>com.personal.brew</string>     <key>ProgramArguments</key>     <array>         <string>brew</string>         <string>upgrade</string>     </array>     <key>KeepAlive</key>     <false/> </dict> </plist>   The issue is that it's not doing anything. What I want to achieve is have brew check for upgrades once every week (ex.: each Sunday), after boot. How can I change the script to do this?  I'm on Mojave 10.14.1.


I have been using the  module in Drupal 6 and am looking at the  for a Drupal 7 install. I have seen some discussion  but I am looking for any reasons for choosing one or the other.   Is there a reason to choose one over the other? If so, why or why not? I have heard there may be complexity issues and/or performance issues with Search API. Is this true?


Non-constant polynomials in $\mathbb Z[x]$ can't generate maximal ideals

I am wondering if anyone can validate my proof for this problem I am working on.  Question: Let $f(x)$ be a non-constant polynomial in $\mathbb Z[x].$  Prove that $\langle f(x)\rangle$ is not maximal in $\mathbb Z[x]$.  Clearly $\frac{\mathbb Z[x]}{\langle f(x)\rangle}$ is a field iff $\langle f(x)\rangle$ is a maximal ideal.  Proof: $\langle f(x)\rangle = \{g(x)f(x) \mid g(x) \in \mathbb Z[x]\}$. Thus $\langle f(x)\rangle$ is just all non-constant polynomials.  Let $a \in \frac{\mathbb Z[x]}{\langle f(x)\rangle} = \{ a_0 + \langle f(x)\rangle \mid a_0 \in \mathbb Z\}$. Thus $a_0$ is a constant and is not 'absorbed' by $\langle f(x)\rangle$.  Does there exists an element $b \in \frac{\mathbb Z[x]}{\langle f(x)\rangle} = \{ b_0 + \langle f(x) \rangle \mid b_0 \in \mathbb Z[x]\}$ s.t. $ab = 1 + \langle f(x)\rangle$ (the identity).  But $\langle f(x)\rangle$ absorbs all non-constant polynomials, thus $a_0$, $b_0$ must be non-constant, and $a_0 b_0 \in \mathbb Z$.  Clearly, not all elements of $\mathbb Z$ have multiplicative inverses, and there does not exist elements   $a = \{a_0 + \langle f(x)\rangle \mid a_0 \in \mathbb Z\}$, $b = \{b_0 + \langle f(x) \rangle \mid b_0 \in \mathbb Z[x]\}$ where $a_0 b_0 = 1 + \langle f(x)\rangle$.  Therefore, not all elements of $\frac{\mathbb Z[x]}{<f(x)>}$ are units, $\frac{\mathbb Z[x]}{\langle f(x)\rangle}$ is not a field, $\langle f(x)\rangle$ is not a maximal ideal of $\mathbb Z[x]$.


How could I write the "\b" character in a file?

I am trying to write a file containing the "\b" character as a string, but when open the file it is omitted.  Here is my code:  with open('proof.tex','w') as archivo:     archivo.write('''\documentclass[12pt, a4paper]{article} \begin{document} $S=\sum ^{100}_{i=0}a_{i}\left( x\right) $ \end{document}''')   And here is the text generated in the output file:  egin{document} $S=\sum ^{100}_{i=0}a_{i}\left( x\right) $ \end{document}


How to find the mime type of a file in python?

Let's say you want to save a bunch of files somewhere, for instance in BLOBs. Let's say you want to dish these files out via a web page and have the client automatically open the correct application/viewer.  Assumption: The browser figures out which application/viewer to use by the mime-type (content-type?) header in the HTTP response.  Based on that assumption, in addition to the bytes of the file, you also want to save the MIME type.  How would you find the MIME type of a file? I'm currently on a Mac, but this should also work on Windows.   Does the browser add this information when posting the file to the web page?  Is there a neat python library for finding this information? A WebService or (even better) a downloadable database?


This word proverbial has been bothering me a lot lately. I cannot understand it even after translating it into my native language. I would like to know its meaning as well as its origin.


I can’t connect to localhost on Mac high Sierra

I have followed this guide to set-up Apache on High Sierra:   I used it to set it up on Sierra.  But when I go to  I get "Hmm. We’re having trouble finding the site "  A suggestion on this similar question: localhost on macOS High Sierra. Which I've tried, but still cannot connect to localhost:(  I tried install mamp and reinstall it then install ampps but still that problem , I write in terminal sudo apachectl start then sudo apachectl stop and again start but nothing changes.  Please help me i tried to solve problems for 2 weeks ago :(


How do I delete a wall in Timber and Stone?

I was building a wall and placed an order to build a timber door. I noticed later that there is a door and a wall overlapping each other.  I tried to dig/mine but to no avail. Any suggestions or a possible way to remove that piece of wall?


Can the kinetic energy be a function of the position vector?

,I got one confusion when reading Goldstein's Classical Mechanics (page 20, third edition). After getting the equation $$ \sum \left\{\left[\frac{\mathrm{d}}{\mathrm{d}t}{\left(\frac{\partial T}{\partial \dot{q_{j}}} \right)} - \frac{\partial T}{\partial q_{j} } \right] - Q_{j} \right\} \ \delta q_{j} = 0 $$ then it says that     Note that in a system of Cartesian coordinates the partial derivative of $T$ with respect to $q_{j}$ vanishes. Thus, speaking in the language of differential geometry, this term arises from the curvature of the coordinates $q_{j}$. In polar coordinates, e.g., it is in the partial derivative of $T$ with respect to an angle coordinate that the centripetal acceleration term appears.   My question is:  Is the above statement general, i.e., that the kinetic energy $T$ does not depend on the position. I wonder why velocity can't depend on the particle's position vector. I mean, why couldn't we have cases where $\vec{v} = \vec{v}(\vec r ,t)$, so that the kinetic energy depends on $q_{j}$ or $\vec{r}$?    I will use the example of the second answer in this post   the second answer,   suppose we have a velocity distribution of gas whose function is $\vec {v}=\vec {v}(x,y,z,t)$  then the partial derivative with respect to $x$ is  $$\frac{\partial T} {\partial x}=mv\frac{\partial v} {\partial x}$$  since $v$ depends on $x$, I think in this case. $\frac{\partial T}{\partial q_{j} }$ does not vanish.


Too big vertical spacing between equations

My vertical spacing between multiple equations are too big, how can I reduce it? each equation most have an individual label.  Here's my preamble:  \documentclass[11pt,openany]{mitthesis} \usepackage[a4paper, margin=1in, twoside, openright]{geometry} \usepackage[utf8]{inputenc} \usepackage{graphicx} \usepackage[export]{adjustbox} %ramme rundt bilder \usepackage{fancyhdr} \usepackage[nottoc, notlot, notlof]{tocbibind} \usepackage[hyphens]{url} \usepackage[hidelinks]{hyperref} \usepackage[super,square]{natbib} \usepackage{booktabs} \usepackage{pdfpages} \usepackage[labelfont=bf, font=small, labelsep=period]{caption} \usepackage{longtable}                    % For lange tabeller \usepackage{setspace} \setstretch{1.15} \usepackage{color,soul} %highlighting \usepackage{float} \usepackage{enumitem}   %lister \setlist{noitemsep}     %ingen vertical spacing i liste \usepackage[version=4]{mhchem} %kjemi-formler \usepackage{tabularx} %hindre for brede tabeller \usepackage[none]{hyphenat} %fjern automatiske bindestreker \usepackage{mathtools} %matte  \usepackage[utf8]{inputenc} % Required for inputting international characters \usepackage[T1]{fontenc} % Output font encoding for international characters  \usepackage[bottom]{footmisc}   %footnote \usepackage{array} \usepackage{ragged2e} %tabeller (flush) \usepackage[]{bm} \usepackage{perpage}  \MakePerPage{footnote}   Here's the code:  This is some text before the equations: \begin{equation}     a = b     \label{eq:1} \end{equation}  \begin{equation}     b = c     \label{eq:2} \end{equation}  \begin{equation}    c = r    \label{eq:3} \end{equation}  The spacing is fine if I only have one equation:  \begin{equation}     x = y \end{equation}  Some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text...\\   And the pdf:


UK Citizen - About to Sell Microsoft Store Apps - What is Effectively Connected Income

I am a UK citizen living in the UK and tax based in the UK. I have created a small Windows Store App which will be sold at about $4. I will be very lucky to get about 250 sales in a year (ie $1,000 per year). In my Windows Store account it is asking me about 'Effectively Connected Income'. I have not got a clue what they are on about.  It says the following:  "Certificate of Foreign Status Numbers in parentheses refer to line numbers on the official IRS W8 forms. Is the income you receive from Microsoft effectively connected with the conduct of a trade or business in the United States? Persons/entities must file an annual U.S. income tax return to report income claimed to be effectively connected with a U.S. trade or business (See Effectively Connected Income)"  It then has two radio buttons with 'Yes' and 'No'.   What do I click? Do I really have to submit tax forms to the US every year? How on earth do I go about doing that?


Best way to turn CSV directly into Variables for Arithmetic Operation?

I am new to Python and trying to essentially do the following four things   Pull numerical data (likely floats) from a csv Turn those floats into variables Perform an operation (multiplication, addition, subtraction, etc.) on those variables Output those variables to a new list   I am attempting to perform multiplication in the code below, but instead it ends up just printing the value 3 times.   import csv with open('pull_vars.csv', 'r+') as pullfile:     reader = csv.reader(pullfile)        mydict = {rows[0]:rows[1] for rows in reader} for rows in mydict:     mydict[rows] *= 3 print(mydict)   My input  {'1': ' 1', '2': ' 2', '3': ' 3', '4': ' 4', '5': ' 5', '6': ' 6', '7': ' 7', '8': ' 8', '9': ' 9'}   My output ends up looking like this  {'1': ' 1 1 1', '2': ' 2 2 2', '3': ' 3 3 3', '4': ' 4 4 4', '5': ' 5 5 5', '6': ' 6 6 6', '7': ' 7 7 7', '8': ' 8 8 8', '9': ' 9 9 9'}   How can I perform the operation on the value (as a number) versus as a string? Thanks for any help! EDIT 1: The operation I want to do is multiply all values in my dictionary (generated via CSV) by 3.  EDIT 2: before, I showed the dictionary created from my csv input, rather than the csv input itself. My CSV input is.   1, 1 2, 2 3, 3 4, 4 5, 5 6, 6 7, 7 8, 8 9, 9


why can't i change the setting of primative mesh objects in object mode?

When ever i try to change the setting of my mesh primitive in object mode, the panel with the configuration setting is visible, but i can't click on it. It seems that the only way i can get access to the configuration panel for primitive mesh objects is by going into edit mode for any mesh, deleting it, then adding a primitive object, which enable me to have access to the configuration panel for said mesh primitives.  problem:    (unpractical) Solution:    I really need an alternative. I wish to find a method or setting configuration that will allow me to have access to the primitive mesh setting as i add it in objects mode, and NOT have to go into edit mode, delete object, then add primitive(this is disruptive to  my workflow.)  all solution are considered, thank you!


What is the principle of underdetermination?

While studying I read about the principle of underdetermination of scientific theories. I made some researches online but I am more confused than before. I read about the Quine-Duhem holistic thesis, but I do not know if is the same as underdetermination.


Python: UnboundLocalError: local variable 'n' referenced before assignment

I keep getting the error: "UnboundLocalError: local variable 'Pitch' referenced before assignment" is there any way to fix this?  import winsound, random  Pitch = random.randint(1000, 10000) Duration = random.randint(100, 500)  def random():     winsound.Beep(Pitch, Duration)     Pitch = random.randint(1000, 10000)     Duration = random.randint(100, 500)     winsound.Beep(Pitch, Duration)     Pitch = random.randint(1000, 10000)     Duration = random.randint(100, 500)     winsound.Beep(Pitch, Duration)     Pitch = random.randint(1000, 10000)     Duration = random.randint(100, 500)     winsound.Beep(Pitch, Duration)     Pitch = random.randint(1000, 10000)     Duration = random.randint(100, 500)     winsound.Beep(Pitch, Duration)  random()


When I run sudo apt-get update on Ubuntu 14.04, I get the following error:  E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable) E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it? sourabh@sourabh-Inspiron-5520:~$ ^C   How can this be fixed?


Can I use Sony lenses on a Nikon camera?

I was searching on the internet but I can't find any result, even saying that I can't use it.  I have the following cameras: a Sony a7R II and a Nikon D610. I'm able to find adapters to use my Nikon's FX lenses on my Sony E mount, but I cannot find any adapter to use my Sony's E mount lenses on my Nikon D610 camera. It is possible to achieve this?


Non-static method cannot be referenced from static context on applying WebView.setWebViewClient and Publlic void at smae time

I am currently working on webview where I need user to dowanload pdf , mp4 files from link and found solution in some forum but as I paste the given code..I'm constantly getting error of Non-static method cannot be referenced from static context in line WebView.setWebViewClient(new WebViewClient() . I'm new to programming can anyone suggest me what am I doing wrong Here??  Thanks in advance.      public class MainActivity extends AppCompatActivity {  WebView webView;  @Override protected void onCreate(Bundle savedInstanceState) {     super.onCreate(savedInstanceState);     setContentView(R.layout.activity_main);       WebView webView = (WebView) findViewById(R.id.webView);     webView.getSettings().setJavaScriptEnabled(true);        webView.setWebViewClient(new WebViewClient() {           public void onPageFinished(WebView view, String url) {             findViewById(R.id.image1).setVisibility((View.GONE));             findViewById(R.id.webView).setVisibility(View.VISIBLE);          }     });     webView.loadUrl("file:///android_asset/index.html");      WebView.setWebViewClient(new WebViewClient() {         @Override         public void onReceivedError(WebView view, int errorCode,                                     String description, String failingUrl) {             Log.d("WEB_VIEW_TEST", "error code:" + errorCode + " - " + description);         }          @Override         public boolean shouldOverrideUrlLoading(WebView view, String url) {             // handle different requests for different type of files             // this example handles downloads requests for .apk and .mp3 files             // everything else the webview can handle normally             if (url.endsWith(".apk")) {                 Uri source = Uri.parse(url);                 // Make a new request pointing to the .apk url                 DownloadManager.Request request = new DownloadManager.Request(source);                 // appears the same in Notification bar while downloading                 request.setDescription("Description for the DownloadManager Bar");                 request.setTitle("YourApp.apk");                 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {                     request.allowScanningByMediaScanner();                     request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);                 }                 // save the file in the "Downloads" folder of SDCARD                 request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "SmartPigs.apk");                 // get download service and enqueue file                 DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);                 manager.enqueue(request);             }             else if(url.endsWith(".mp3")) {                 // if the link points to an .mp3 resource do something else             }             // if there is a link to anything else than .apk or .mp3 load the URL in the webview             else view.loadUrl(url);             return true;         }     });   }   }


Save entire process for continuation after reboot

I developed an algorithm for a fairly hard problem in mathematics which is likely to need several months to finish. As I have limited resources only, I started this on my Ubuntu 12.04 (x86) laptop. Now I want to install some updates and actually restart the laptop (the "please reboot" message is just annoying).  Is there a way to save an entire process including its allocated memory for continuation beyond a reboot?  Here is some information about the process you might need. Please feel free to ask for further information if needed.   I called the process in a terminal with the command "./binary > ./somefile &" or "time ./binary > ./somefile &", I cannot really remember. It's printing some debug information to std::cerr (not very often). It's currently using roughly 600.0 kiB and even though this will increase, it's unlikely to increase rapidly. the process runs with normal priority the kernel is 3.2.0-26-generic-pae, the cpu is an AMD, the operating system is Ubuntu 12.04 x86. it runs since 9 days and 14 hours (so too long to cancel it ;-) )


Command line args :String objects created on heap?

Please find the code snippet below :  public static void main(String[] args)  {     System.out.println(args[0]=="abc"); }   I am getting the output as false (believe me I am passing abc as command line args i.e. java Main abc from command line)         Can somebody explain me the reason behind "false" in the output? what I could conclude is command line args are created on heap,but couldn't find the concrete reason/explanation for the same.I understand String comparison and difference between equals and ==.Are command line args not stored in String pool?


What is the "geometrical" intuition behind L'Hospital's rule?

Is there a "geometrical" intuition behind L'Hospital's rule? I have recently found out the "geometrical" meaning of Taylor's approximation series and I was wondering if there is something analogous for L'Hospital's rule.


How to pass PHP variables to Javascript/jQuery?

I found this way to send variables from PHP to Javascript.  Inside the template.tpl.php file, I have the following code.  <?php    echo '
'.json_encode($variables).'
'; ?>   Within Javascript, I have the following code:  (function ($) {   $(document).ready(function() {        var variables = jQuery.parseJSON($('.drupal-vars').html());        //Remove if youwant to clean the code.       $('.drupal-vars').remove();   });  }(jQuery));   I found another , but it's more complicated, although it may be better architectured.   Is there a better way to do it? How ugly is what I am doing here?     The tutorial goes like:     I'll start by creating a hook_menu() implementation to establish a   page callback:  <?php function helper_menu() {    $items = array();    $items['js-vars'] = array(     'title' => t('Javascript Variables'),     'description' => t('Javascript Variables'),     'page callback' => 'helper_page_callback_js_vars',     'access arguments' => array('access content'),     'type' => MENU_CALLBACK,       );    return $items;  } ?>       Next, I'll define the page callback:  <?php function helper_page_callback_js_vars() {    // include module javascript file   drupal_add_js(drupal_get_path('module','helper') . '/js/helper.js');    // define variables you'd like to pass to the DOM   $js_vars = array(     'js_vars' => array(       'message' => t('Hello @username', array('@username' => $GLOBALS['user']->name)),       'an_array' => array(         'color' => t('red'),         'name' => t('Eric'),       ),     ),   );    // pass variables to javascript   drupal_add_js($js_vars, 'setting');    // generate some page output   return "TEST";  } ?>       And here is the contents of the javascript include file I stuck in my   module directory:  $(document).ready(function(){    // debug variables directly in FireBug   console.debug(Drupal.settings.js_vars);    // popup mesage passed from Drupal   alert(Drupal.settings.js_vars.message);  });


How to fix the width/length of ytick label in pgfplots?

I want to align three tikzpictures/pgfplots picture below each other. But they have different ytick labels (varying lenghts/widths). Check the attached screenshot.  Is there a possibility to determine a fixed length/width for the ytick labels?


How To Find Out Exact Angle Measurements of Object in Photo

Hi Folks: I am having a guitar body built and I am having no little trouble illustrating certain changes I'd like to see made. The builder is using a CNC and is loading in measurements that I've given him, but certain angles simply aren't looking right to me. I've attached a few photos which show-crudely-what I'm driving at. The top body is the guitar I am copying and the bottom a proto of the copy. It seems the point at which the downward slope begins should be lower on the proto-how do I express this precisely? Regards.


Python: build a dictionary from two lists

having failed to post the first question in a clear way, I will try to be more specific.  I have two 2d matrices, one with 5 columns (let's call it data) and the other with 7 (let's call it BMU). Let's call the 5 column submatrix photometry and the last two columns respectively z and z_err.  What I would like to do is, excluded the last two columns of BMU, calculate all the euclidean distances between the data objects and the BMU objects, then for each data objects find the closest k BMU objects. (here I rearrange the distance matrix and so I can't associate a distance to a specific BMU object)  Done so, I would like to retrieve this closest k objects in the BMU matrix and use the 6th and 7th column to perform some operation.  In order to store and retrieve all these informations that I need, I was trying to create some sort of dictionary. So, when I calculate the distances, I can use an ID to associate the particular distance to the features of the BMu object (photometry, z and z_err) even if I have to rearrange them.   thanks for any help :)


I was wondering if the light meter in my Nikon D5200 will be similar with my Ricoh XR500? I took a picture in my D5200 using the light meter on my slr film(ricoh xr500) but it was underexposed by 1 or 2 stops.


TRP HY-RD brake pistons won't retract to take new pads

I'm replacing pads on my TRP Hy-Rd brakes. These are cable actuated hydraulics. Using tire levers, wrenches, etc. I have not been able to push the two pistons far enough apart to fit the rotor between the pads. I can move one piston, but the other follows, so there's no increase in the gap. I've tried pushing the pistons apart both with and without the old pads in place. Not having any luck. Any suggestions?


Could the favourites mechanism be extended to include comments?

I've seen a similar thread for  and a question concerning the very feature I mean in  but no actual suggestion. I decided to post one in order to see if other users agree that such a feature would be of use and also to find out if it would be technically feasible (requiring a sane amount of code modification).  Among the comments on Stack Overflow (and other SE sites), there are some genuine gems. Be it a piece of advice, a suggestion or just a hilarious remark, a comment is sometimes worth returning to.  While I know how to bookmark the comments in my browser, I find this pretty annoying while switching computers (it's hard to keep sync between different browsers). I'd like to keep them in one place, preferably in my SO profile.  Personally, I'd love and use a feature like this. What do you think about it?


How do I disable g++ displaying notes for errors?

When compiling, errors are often accompanied by a lengthy series of notes (cyan). Is there a g++ flag to disable this, only showing the error itself?


Question is to Prove that $(\mathbb{Z}/2^n \mathbb{Z})^*$ is not  cyclic Group for $n\geq 3$.  Hint : Find two subgroups of order $2$.  I somehow feel that a cyclic group can not have two distinct groups of same order. but, I am not sure about the proof.  I have no idea how to proceed for this.   any hint would be appreciated.  Thank You.


I have the following question:  Let $f$ be a holomorphic function on $\mathbb{D}$. Assume $f(0) = 0$ and $\Re f ≤ A$ on $\mathbb{D}$ for some constant $A > 0$. Show that $|f(z)| ≤ \frac{2A|z|} {1 − |z|}$ for all $z ∈ \mathbb{D}$.  The $f(0)$ hypothesis and the fact that $f$ is defined on $\mathbb{D}$ makes me think that this could involve some type of Schwartz Lemma. But, the there is no reason to think that the function is bounded by $1$. I also do not know how to dissect the $\Re f \leq A$ part. Any help would be greatly appreciated.


How can I shoot an arrow if I know the shot power and target?

I am trying to shoot an arrow at a target with a 100% success rate.  Given the initial force applied to the arrow, the gravity, the location of the archer, and the location of the target, how can I do this in Unity?  I have read , and it contains the equation I am using:    However, this is only accurate when I am at the maximum distance from the object given its power.  (Above the maximum distance means that the arrow cannot reach the target.)  The closer I move to the target, the less accurate the arrow shot becomes, as it travels past the target.  The angle is increased resulting in the arrow traveling a shorter distance as I'd expect, but it is not increased by enough.  The script spawns an arrow (a simple sphere) and launches it towards a target.  It fires once per second, but the closer to the target the archer is, the more inaccurate the arrow is.  The case of the archer being too far from the arrow is not handled, but that is not my concern right now.  using UnityEngine; using System.Collections;  public class Archer : MonoBehaviour {     public GameObject arrow; //Simple 3D Sphere     public GameObject target; //Simple 3D Cube     public float power = 25.0f;     public Vector3 aim;      private void Start()     {         StartCoroutine(ShootArrows());     }      private IEnumerator ShootArrows()     {         while (true)         {             yield return new WaitForSeconds(1.0f);             Vector3 spawnPosition = new Vector3(transform.position.x, transform.position.y, transform.position.z);             GameObject arrowInstance = Instantiate(arrow, spawnPosition, Quaternion.identity) as GameObject;             arrowInstance.GetComponent<Rigidbody>().AddForce(Aim() * power, ForceMode.VelocityChange);         }     }      private Vector3 Aim()     {         float xAim = target.transform.position.x - transform.position.x;         float yAim = Mathf.Rad2Deg * Mathf.Atan(((Mathf.Pow(power, 2) + Mathf.Sqrt((Mathf.Pow(power, 4) - (-Physics.gravity.y) * (-Physics.gravity.y * Mathf.Pow(HorizontalDistance(), 2) + 2 * VerticalDistance() * Mathf.Pow(power, 2))))) / -Physics.gravity.y * HorizontalDistance()));         float zAim = target.transform.position.z - transform.position.z;         Vector3 aim = new Vector3(xAim, yAim, zAim).normalized;         return aim;     }      private float HorizontalDistance()     {         float xDistance = target.transform.position.x - transform.position.x;         float zDistance = target.transform.position.z - transform.position.z;         float distance = Mathf.Sqrt(Mathf.Pow(xDistance, 2) + Mathf.Pow(zDistance, 2));         return distance;     }      private float VerticalDistance()     {         return Mathf.Abs(target.transform.position.y - transform.position.y);     } }   My best guess is that I am using the equation correctly, but I am plugging the angle into Unity wrong.  Why is my script giving me inaccurate results?


Currently I'm using ubuntu 9.04. I need to update this to a recent version 12.04, 12.10 or 13.04? Is this possible? Can someone point me to a instruction page to do this?


I want to use justifying command from this package but it could not be installed. Everytime I use \usepackage{ragged2e} I get this error:     File `ragged2e.sty' not found. \usepackage.   How could I install it or align the text another way?  It's beamer presentation


Is there a way to customize the tool tip of a custom object in the VS Debugger?

Say you have a custom class call it Foo. When you then have an instance of this class, during debugging, if you mouse over this object, you'll either see the fully qualified namespace name of the type, or if you override ToString in this class, you'll see that. Is there any way to customize what the tool tip will say?


Enclosing vs. not enclosing a variable's value in quotes in bash

When I do something like this:  x="hi echo hello"   or  x='hi echo hello'   Then x will contain the string hi echo hello.  But when I don't use quotes:  x=hi echo hello   Then x will contain the string hi, and the command echo hello will be executed.    But what about when a variable's value only consists of a single word, is there a difference between the following:  x="hi" x='hi' x=hi


How to define a proof environment which can be displayed/hidden? [combining two TeX solutions]

I once asked for a solution to suppress vertical space right after the beginning of a proof environment; see the link (1) below. I use this quite heavily, it works very well.   I recently asked how to hide/display solutions in an exercise; see the link (2) below. It also works very well.   I now would like to construct a proof environment which allows for the hide/show feature. So exactly combining the two solutions of the above problems. I tried my best but I'm not a TeX expert... see below (I obtain: ./mini.tex:55: LaTeX Error: \env@proof@save@env undefined.)  \documentclass{scrartcl}  \usepackage{amsmath} \usepackage{mathtools} \usepackage{amssymb} \usepackage{amsthm} \usepackage{environ} \usepackage{ifthen}  \newboolean{showProof}% for showing proofs \setboolean{showProof}{true}% setting the switch  \newboolean{sol}% for solution environment \setboolean{sol}{true}% setting the switch  % proof environment which suppresses vertical space % see (1) http://tex.stackexchange.com/questions/66739/how-to-suppress-vertical-space-between-proof-environment-heads-and-itemize-envir \makeatletter \renewenvironment{proof}[1][Proof]{\par   \pushQED{\qed}%   \normalfont\topsep2\p@\@plus2\p@\relax   \trivlist \item[\hskip\labelsep   \sffamily\bfseries #1]\mbox{}\hfill\\*\ignorespaces }{%   \popQED\endtrivlist\@endpefalse } \makeatother  % solution environment which allows to show/hide of content % see (2) http://tex.stackexchange.com/questions/172404/solution-environment-via-true-false-switch?noredirect=1#172408 \makeatletter \NewEnviron{solution}[1][sol]{   \gdef\@tmp{#1}   \ifthenelse{\boolean{#1}}{\par\noindent{\sffamily\bfseries Solution}\par\noindent\BODY}{\ignorespaces} }[\ifthenelse{\boolean{\@tmp}}{}{\ignorespacesafterend}] \makeatother  % trial to define proof environment with the feature that content can be % shown/hidden (mix of the above two solutions) \makeatletter \RenewEnviron{proof}[1][showProof]{   \gdef\@tmp{#1}   \ifthenelse{\boolean{#1}}{%     \par\pushQED{\qed}%     \normalfont\topsep2\p@\@plus2\p@\relax     \trivlist\item[\hskip\labelsep     \sffamily\bfseries #1]\gdef\mycurrenvir{proof}\global\starttheoremtrue\mbox{}\hfill\\*\ignorespaces     \BODY}{\ignorespaces} }[\ifthenelse{\boolean{\@tmp}}{%   \gdef\mycurrenvir{\relax}   \popQED\endtrivlist\@endpefalse }{\ignorespacesafterend}] \makeatother  \begin{document} This is some statement we would like to prove: $\exp(i\pi)=-1$ \begin{proof}   This should be displayed if and only if showProof is set to true. \end{proof} \end{document}


Error even after enabling --shell-escape in TeXworks and installing gnuplots 5.4, when using gnuplot {4*x**2 - 5}

On my troubleshooting of the code got from page 42/571 of the pgfplots package: \documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{width=7cm,compat=1.17} \begin{document} \begin{tikzpicture} \begin{axis} \addplot+ [id=parable,domain=-5:5,] gnuplot {4*x**2 - 5} node [pin=180:{$4x^2-5$}]{}; \end{axis} \end{tikzpicture} \end{document}  I followed the steps as below:  Installed successfully the gnuplot version 5.4 patchlevel 1 On my TeXworks window went to Edit->Preference shown below:  The TeXwrks preference window pops up. I hit on typesetting tab. In Processing tool section I hit on pdfLaTeX, as below:  Then Hit on Edit... box. To get the tool configuration window as below:  I hit on + box and type --shell-escape, as below:    Using up-arrow I move the --shell-escape up on top of $fullname and hit ok:    Then Run the code using pdfLaTeX getting the following error:   ! Package pgfplots Error: Sorry, the gnuplot-result file 'f2_addplot_pgfplots_p p42.parable.table' could not be found. Maybe you need to enable the shell-escap e feature? For pdflatex, this is '>> pdflatex -shell-escape'. You can also invo ke '>> gnuplot .gnuplot' manually on the respective gnuplot file.. See the pgfplots package documentation for explanation. Type  H   for immediate help. ... l.8 ...t {4*x**2 - 5} node [pin=180:{$4x^2-5$}]{};  Do you know how to fix it?


Can I somehow put Viber notification  on top of the Unity panel (near Dropbox and others)?! It's pretty ugly to stay in top left corner...


Randomly select a proportion of files from a given directory

There are about 10000 files under a given directory. Are there any command that can help me randomly pick 1000 files from it and put them into another directory. The picked files should be removed from the original directory.


Suppose  G is simple with degree sequence $d_1 \leq d_2\leq ....\leq d_n$, and for $k \leq n-d_n-1$, $d_k \geq k$. Show G is connected.  I posted this question before, and got an answer, but I couldn't understand it fully. (Especially about why $d_1 \geq n-d_n-1$.) Here's a link to that answer.     Anybody, help me, please.


Decimal degree coordinates: how many decimal places to use for ...?

When using coordinates in decimal degrees, how many decimal points actually make sense?   For example, say one is producing a table of locations of base camps in a report, there's no point in displaying a number like 62.946916, -135.018639 when 62.95, -135.02 is sufficient. On the other hand when giving someone a waypoint for GPS navigation 62.947, -135.019 is more warranted (manually keyed in, why type 6 digits when 3 will do?), while for locating a geocache 4 positions is desired, and 6+ for a survey stake.  In other words, what is the easiest way to determine for any given purpose how many decimal places should be displayed?  There are technical answers at , but they're not readily adaptable to a quick reference handbook style of usage. I'm looking for a handy chart to refer to like "the nth decimal place is X distance in ground units (at Y latitude)", or "the nth decimal place is X distance in ground units (at ___ major city/landmark)".


How can I create a copy of an Oracle table without copying the data?

I know the statement:  create table xyz_new as select * from xyz;   Which copies the structure and the data, but what if I just want the structure?


How can cellular phones in Batman produce effective radar-like effects?

In The Dark Knight a city-wide surveillance system resembling sonar is portrayed. What is the in-universe explanation of how Gotham's phone's speakers and microphones are able to be used to generate and interpret the waves used to operate Batman's surveillance system?


I went to the self-advertized pstricks web site,     and tried to run a few examples in TeXShop version 3.51 on Mac OSX Yosemite.  The examples I tried are cycloid.tex, game0.tex, and curve0.tex.  These appear to be self-contained, syntactically complete examples, but they all fail with similar error messages  ! Undefined control sequence. <recently read> \c@lor@to@ps  l.82      dAngle=90,nAngle=4](0,0)(0,360){1}{1}{1}   suggesting that \c@lor@to@ps is not defined properly somewhere in the pstricks stack. I thought rather than go down the rabbit hole of trying to debug this, I'd ask the community, because it appears that something systematic and cosmic is wrong, either with the distribution of pstricks in TeXShop / MacTeX / TeXlive, or perhaps pstricks is just dead, being replaced by Tikz?  I don't know.  BTW, fails with the same kinds of error messages at the console with pdflatex  pdfTeX 3.14159265-2.6-1.40.15 (TeX Live 2014) kpathsea version 6.2.0 Compiled with libpng 1.6.10; using libpng 1.6.10 Compiled with zlib 1.2.8; using zlib 1.2.8 Compiled with xpdf version 3.03


Giant slayer, witch hunter: why the singular form?

It is clear that the meaning of the collocations is: slayer of giants hunter of witches  But, why do they stay in singular when they are in a juxtaposition? What is their grammatical funticion? Which case is that?


$f:[0,1]\to[0,1]$ be a continuous function. Let $x_1\in[0,1]$ and define $x_{n+1}={\sum_{i=1}^n f(x_i)\over n}$.Prove, $\{x_n\}$ is convergent

I have tried a little bit which as follows- Since $f(x_n)\in[0,1]$, $\{f(x_n)\}$ has a convergent subsequence say $y_n=f(x_{r_n})\ \forall n\in\Bbb{N}$ Let, $\lim y_n=l\implies \lim \frac{y_1+y_2+\cdots+y_n}{n}=l\implies \lim \frac{f(x_{r_1})+f(x_{r_2})+\cdots+f(x_{r_n})}{n}=l$ But I am getting no idea to proceed and prove the convergence of $\{x_n\}$. I have also tried to prove the sequence to be cauchy which goes- $x_{m+1}-x_{n+1}={\sum_{i=1}^m f(x_i)\over m}-{\sum_{i=1}^n f(x_i)\over n}\le {\sum_{i=1}^m f(x_i)\over n}-{\sum_{i=1}^n f(x_i)\over n}$ (since $m\ge n)$ $\implies |x_{m+1}-x_{n+1}|\le \frac{|f(x_m)|+|f(x_{m-1})+\cdots+|f(x_{n+1})|}{n}\le\frac{m-n}{n}$ (since $f([0,1])\subseteq [0,1])$ Now, what will I get if I tend $m,n\to\infty$? But I need to do something more in the 2nd case since I have nowhere used the continuity of $f$.  Can anybody give an idea to prove it? Thanks for assistance in advance.


How do I style a class in a div that has a parenthesis in it

I'm trying to implement flags from a image file, its fetched by curl so i cannot change the class. The class has a parenthesis in it, and as parenthesis are invalid operators(?) in css im unable to style it. Does anyone know how i can be able to add style to it?


how do I tune for one-day-a-year traffic

I run a site as a service for the statewide high school swimming community. I do this for love of the sport, so I can't spend a ridiculous sum on hosting, etc. Nor do I need to - except for one day a year.  The coaches all submit their regional entries through my site, and in typical fashion all wait until the due date to do it. That was yesterday, and my site which never fell over all season ground to an unresponsive halt at least 4 times throughout the day. It was never gone for more than an hour, and it always came back. (I issued apache restarts just to be sure).  My question is: how can I tune Apache to handle a one day surge of users? It makes no sense to pay for more hardware for an entire year when I only need to caox one day of increased performance. I've tried reading about prefork.c and worker.c but I just don't understand it well enough. Here's my current config:  <IfModule prefork.c>  StartServers       1  MinSpareServers    1  MaxSpareServers    5  ServerLimit       10  MaxClients        10  MaxRequestsPerChild  4000  </IfModule>   <IfModule worker.c>  StartServers       1  MaxClients        10  MinSpareThreads    1  MaxSpareThreads    4  ThreadsPerChild     25  MaxRequestsPerChild  0  </IfModule>   The most users I would ever expect at once would be 400. Likely much less than that though. I only had about 70 yesterday and it didn't perform very well. Any suggestions?  UPDATE:    728 root      20   0  317m  20m 7752 S  0.0  2.7   0:49.58 httpd 19700 webuser   20   0  489m  37m 6792 S  0.0  4.9   0:00.72 httpd 19737 webuser   20   0  493m  42m 6624 S  0.0  5.5   0:00.59 httpd 19756 webuser   20   0  494m  43m 6604 S  0.0  5.7   0:00.58 httpd 19758 webuser   20   0  495m  44m 6780 S  0.0  5.8   0:00.97 httpd 19777 webuser   20   0  493m  42m 6620 S  0.0  5.5   0:01.08 httpd   Took a look at the resources, and I'm not sure what I'm looking at.  The process owned by root should be the one that runs Apache.  Are those owned by webuser spawned by Apache itself?  Why are they so big?  Server has about 3/4G RAM, if I figure 1/2 for Apache, and processes are holding 40M, how can i estimate the number of simultaneous users possible?


how can I make cron run a job right now, for testing/debugging? without changing the schedule!

I have a cron job that is scheduled to run everyday, other than changing the schedule, is there any other way to do a test run of the command right now to see if it works as intended?    EDIT: (from the comments) I know the command works fine when enter it in shell (my shell), but I want to know if it works correctly when cron runs it, it could be affected by ENV or shell specific stuff (~ expansion) or ownership and permission stuff or ...


Are the only sets in $\mathbb{R^1}$ which are both open and closed $\mathbb{R^1}$ and $\emptyset$?

As the topic, how to prove that the only set in $\mathbb{R^1}$ which are both open and close are the $\mathbb{R^1}$ and $\emptyset$. I tried to prove by contradiction, but i can't really show that the assumption implies the contrary.


How to remove "Open in terminal" option in right click

Iv installed Ubuntu-GNOME and immediately after that as an old habit I tried to add "Open in terminal" Option in my right click menu. By using   sudo apt-get install nautilus-open-terminal   and  nautilus -q     But then I realized that I already have this option in my right click menu, And now I dont know how can I disable nautilus-open-terminal. I searched nautilus in my softwares but I found nothing.   also tried to use   apt-get --purge remove nautilus-open-terminal    But I faced this error:  E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied) E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?   How can I fix my Right-Click menu?


Could downloading Tumblr videos damage/infect Mac?

I have downloaded quite some Tumblr videos, both cat videos, funny clips, porn. I downloaded them manually, you can save them with right click and save-as with right method - no download program used.  I have old external hard drive where I keep them, downloaded both in Mac and in Windows. After clean install (due to technical issues not malware), I was going to put my collection back to fresh Mac, but heard these videos could contain malicious code/trojans/malware?  Haven't done it for a month now - likely never will again just in case - but it would be pity to delete them all so... do I have to for security reasons?  My question is - how likely could videos downloaded from Tumblr be malicious? After all, it is one platform for many different blogs - cat videos, funny clips, porn - they are all uploaded to same server so how likely is they can be infected by a) uploader b) tumblr itself?


How to pin a window on top of other windows in OS X?

I used to use an app called  that let me pin windows on top of all other windows on the Desktop. However, Afloat stopped being maintained at some point and it doesn't work with more recent versions of OS X.  I then used an app called , which installed as a SIMBL plugin but then that stopped working with OS X El Capitan.  Is there a way to get either of these apps to work with OS X El Capitan? Or is there another solution I can try?


I would like to cut videos using ffmpeg for machine learning.   How can I ensure that if I cut (for example) 1s of video @25fps this will provide exactly 25 frames of synchronized audio and video?  I have seen that ffmpeg looks for keyframes at time of cutting, picking the nearest one. I had troubles as it was generating negative timestamps and filling the end of the cut video with copied frames.   I understand that metadata does not display real fps and so on.  So what would be the pipeline to obtain precise cuts with the exact amount of frames aligned with the audio stream?   Thaanks


What are the main issues with gauge theories of gravity?

From what I understand, the obvious problems with a gravity being a posed as a gauge theory of the Lorentz group are the residual tetrad fields having no obvious gauge theoretic interpretation, as well as this group simply not being the full set of diffeomorphisms. Gauging the full Poincare group appears to not only consider the full set of spacetime isometries but also provides a description of the tetrad fields as gauge potentials for the translation symmetries in the group.   What are the remaining obstacles to a convincing gauge theory of gravity?


How do I create an enumeration style like in the picture below (I mean things that look like concave { and })?    The Comprehensive Symbol List doesn't seem to know anything about those symbols. Googling didn't yield any useful results as well. I'm starting to suspect these symbols to be user-defined in some way.


I've seen in several places that that given a well-ordered set, $X$, any initial segment $S = \{x | x < a\}$  may not be order isomorphic to $X$.  Is it still possible that there is a non-order-preserving bijection between $S$ and $X$?


Share Files over the Network - What packages?

I see a pop up that says  Share Files over the Network This feature cannot be enabled because the required packages are not installed on your system  Simple enough, but what packages do I need?


My head hurts - 2 separate lights & 2 separate switches affecting each other

Update on dining room wiring! With pics! Here’s hoping some one can help me out! A - switch with source line and line to light (B) B - light with wire connecting to second light (C) C - 2nd light (was ceiling fan without light) with clipped off wire and wire to switch (D) D - single pole switch for 2nd light -C  Situation: Switch A turns on light B and turns off light C (if it was on, if it was off it did nothing) Switch D, if switch A was off, would turn on/off 2nd light C - if switch A was on switch D did nothing  I hope that makes sense and now enjoy my pic skills   I have a situation in my dining room. It’s long so one side is the dining room light and the other end has a ceiling fan. Both have their own single switches. If the ceiling fan is turned on and running, and I turn on the dining room light the ceiling fan turns off. And vice versa. The incoming power goes thru the dining switch up to the dining room light over to the ceiling fan and then down to the fan switch. Any clue how I would fix that?


How to recreate this type of gradient in the iOS 9 music logo?

I was wondering if anyone knew or could point to a tutorial of how to create this type of gradient.   How is it done with three colors and with such a smooth transition between the colors without banding?


Does app review rejection list all issues?

Our app was rejected recently with reason Google+ signin, which we understood is not according to Apple policy and need to fix.  While discussing about this issue we came across an interesting question with Apple review process, does Apple review team list all issues (if more than one exists) while rejecting app (or) would they stop reviewing other areas as soon as they found an issue (in our case Google+ signin)?


Excel converts comma delimited to tab delimited when saving

I create data in Excel 2013 and save it as .csv. We have an application that imports files of type .address so after saving the file as customer.csv, I change the extension to customer.address. This is a custom file format specific to us, but essentially this is just CSV.   When I want to edit this customer.address file, I open this in Excel by selecting the    Delimited option Select Comma in Delimiters Finish   I edit my changes and when I press Save, this is the default dialog box that pops-up.     When I click Yes, it saves my file as Tab delimited not Comma delimited.  What I'm actually expecting is this, to preserve the commas.    How do I make this work such that when I save, the default option should be CSV (Comma delimited)?


Can any metric on $\Bbb R^n$ be bounded above and below for any other metric?

Let $d_1(x,y)$ and $d_2(x,y)$ be any two metrics on $\mathbb{R}^n$. Can it be shown that,  $$c\cdot d_2(x,y) \le d_1(x,y) \le C\cdot d_2(x,y)$$  for all $x,y \in \mathbb{R}^n$ for some fixed positive constants $c,C$? If not, under what conditions could such a relation hold (for a compact set it seems straightforward)? If yes, does this result hold for two arbitrary topological metric spaces as well?  Thanks!


How do I make a game object move at an angle in an integer-indexed grid?

I'm making a game in SDL2 and C++. I want a way to make any game object move in a specific direction. I've thought of assigning each object a direction in radians, from 0 until 2 PI where 0 would represent movement in the positive x direction, and PI movement in the negative x direction (0.5 PI would be positive y, 1.5 PI negative y, etc).   My problem occurs when trying to translate these directions into actually moving an object on the screen - moving objects with directions of 0, 0.25 PI, 0.5 PI, 0.75 PI, etc are trivial, as one would either decrement or increment only x, or only y, or alternate x and y.   To approximate other angles of movement in x and y, I figured I could calculate how much each object should move in x, before it increments y, (or vice versa, depending on whether the direction is bigger or smaller than 0.25 PI, and assuming we're only considering the positive x and y quadrant ). And then restricting how many moves in x and y the object makes each time it is moved, in an attempt to preserve the speed of the object, though this would still result in an object moving along an axis moving slower than one moving in at an angle. Is this a reasonable solution?  Is there a more elegant or precise way of accomplishing this problem?


Regarding the differences between malloc and new in terms of their respective mechanisms of handling memory allocation?

What are the differences between malloc and new in terms of their respective mechanisms of handling memory allocation?


QGIS-Processing runalg and Memory Layer issue

I'm trying to make a script for converting polygons to lines. But I'm having some issues while generating temporary layers.  In this script, I iterate through all the features of the input layer to run the function "qgis:simplifygeometrics" on each of them, after that I merge all layers back together. (This is a simplified case of my script)  However, I'm getting the following error when I run my script : TypeError: 'QgsVectorLayer' object has no attribute '_getitem_' and can't find out why.  Any help is welcome, I'm new to Python and SEXTANTE!  Code:  #Creation of the virtual output layer vOutputLayer = SextanteVectorWriter(vOutputLayer, None, fields, QGis.WKBPolygon, layer.crs())  feats = sextante.getfeatures(layer) for inFeat in feats:      #Creation of the virtual input layer     vInputLayer = QgsVectorLayer("Polygon", "tmp_input_vector", "memory")     vInputLayer.addFeature(inFeat)     vInputLayer.updateExtents()      #Creation of the virtual layer for the simplified geometries     simplifiedLayer = QgsVectorLayer("Polygon", "tmp_simplified_vector", "memory")      #Simplify Geometries function     sextante.runalg("qgis:simplifygeometries", vInputLayer, 1.0, simplifiedLayer)     simplifiedLayer.updateExtents()      #Merging of layers     sextante.runalg("qgis:mergevectorlayers", simplifiedLayer, vOutputLayer, vOutputLayer)   Complete error :  Traceback (most recent call last): File "C:\OSGeo4W\apps\qgis-dev\python\plugins\sextante\core\GeoAlgorithm.py", line 145, in execute self.checkOutputFileExtensions() File "C:\OSGeo4W\apps\qgis-dev\python\plugins\sextante\core\GeoAlgorithm.py", line 238, in checkOutputFileExtensions if not os.path.isabs(out.value): File "C:\OSGeo4W\apps\Python27\lib\ntpath.py", line 57, in isabs s = splitdrive(s)[1] File "C:\OSGeo4W\apps\Python27\lib\ntpath.py", line 125, in splitdrive if p[1:2] == ':': TypeError: 'QgsVectorLayer' object has no attribute '__getitem__'


I wanted to know, how can I factor $x^6 +5x^3 +8$, I have no idea. Is there any method to know if a polynomial is factored. Just some advice will do.  Help appreciated.  Thanks.


Check In at Changi Airport Transfer Desk with Separate Itinerary Ticket / Dual Nationality / Different Names

Does anyone have experience checking in at a Singapore Airlines transfer desk within Changi Airport, where the flight ticket for the second leg was separately booked using a different passport/name (dual nationality)?  Both tickets would use the same airline (Singapore Airlines), there would not be any checked baggage.  From the Changi Airport , it appears to be possible to check in without having to exit immigration. However they also mention various cases where it is not possible (budget carrier, different carriers & bags not checked through, etc). So, just to be sure, I would like to know if others have done this before without any problems?  Thanks


I bought something two days ago - quick question

I have this question that my brain cannot understand because for me it seems to be very illogical. Please, try to explain this to me. It is both english problem but also my native language problem.  For example: If I bought something two days ago. (e.g. Monday, so today is Wednesday) I can't say during Wednesday that I haven't bought anything for 2 days.  Because I skiped just one day and I can still buy something today no? So I would say which makes more logic to me: I haven't bought anything for 1 day.  Same as if I was at the club on Monday now is Wednesday, I would say I haven't been to that club for 1 day. Since today I can still go there. However, i saw more people using it the other way. Which in my opinion is illogical.  They say: I haven't bought anything for 2 days OR I haven't been to that club for 2 days meaning the last time they were there was two days ago. However how logical is it? Imagine you come to that club on Wednesday if you were there on Monday and say to the same barman you saw there on Monday that you haven't been here for 2 days and he would look like: what? are you stupid? You weren't here just one day.  Like as the first question, I haven't purchased anything for 2 days is valid only if you last purchased something on monday and today is thursday, in my opinion, because we should not count monday since you already bought something.  Does anybody get my point? Thanks for answers and your help.


Verb + gerundive or Verb + infinitive, what is preferable?

What is preferable to use: verb + gerundive or verb + infinitive?  For example:  I tried checking it   or   I tried to check it  if both are possible then what's the difference? Are there any specific use cases for both gerundive and infinitive in such a construction?  Thank you.


Lookup Tables Best Practices: DB Tables... or Enumerations

If we have to store the available positions at a company (i.e. Manager, Team Lead, ... etc). What are the best practices for storing it? I have two opinions with comments... "sure, welcoming yours"        Storing it as DB table with columns ID and Name, and deal with it using queries and joins.     Storing it as Enum and forget about the DB table.    In my opinion, I will choose the first solution if I have changing items. So that I won't hard code these options as Enum. I may choose the Enum solution, if I have no doubt that data won't change (for example, Gender: Male, Female).  NOTE: I code in English, and the UI Culture may be Arabic. If I will work with the Enum Solution, I will hard code the culture-based strings in the presentation layer, is it okay from the best practices perspective!!!!  I would like to know your opinions and if my thoughts correspond to what is most recommended "Best Practices"??


How to derive the least square estimator for multiple linear regression?

In the simple linear regression case $y=\beta_0+\beta_1x$, you can derive the least square estimator $\hat\beta_1=\frac{\sum(x_i-\bar x)(y_i-\bar y)}{\sum(x_i-\bar x)^2}$ such that you don't have to know $\hat\beta_0$ to estimate $\hat\beta_1$  Suppose I have $y=\beta_1x_1+\beta_2x_2$, how do I derive $\hat\beta_1$ without estimating $\hat\beta_2$? or is this not possible?


I have this script which gives me number results like "4236.13741375". How can I get an output with a price format? Ex. "4,236.14" instead of "4236.13741375". <script type='text/javascript' > function startCalc(){       interval = setInterval("calc()",1); } function calc(){  // ITEM 1 START  d_r1_qte = document.autoSumForm?.d_r1_qte?.value ?? 0; d_r1_unitprice = document.autoSumForm?.d_r1_unitprice?.value ?? 0; d_r1_price = d_r1_qte * d_r1_unitprice; document.autoSumForm.d_r1_price.value =  d_r1_price; // ITEM 1 END  // INVOICE FOOTER START  d_rtotal = d_r1_price;  d_rtotaltx = ((d_rtotal/100)*15)+d_rtotal;  d_fadmin = (d_rtotaltx/100)*3; document.autoSumForm.d_fadmin.value = d_fadmin; d_stotal = d_fadmin + d_rtotal; document.autoSumForm.d_stotal.value = d_stotal; d_tps = (d_stotal/100)*5; document.autoSumForm.d_tps.value = d_tps; d_tvq = (d_stotal/100)*9.975; document.autoSumForm.d_tvq.value = d_tvq; d_total = d_stotal + d_tps + d_tvq; document.autoSumForm.d_total.value =  d_total; // INVOICE FOOTER END }


I find that I often do the following:  %> cd bla/bla %> ls   I would like it that whenever I cd into a directory it automatically does an ls.  I fiddled with my .bashrc for a while, but couldn't figure out how to make it happen.


How many physical processors does Windows 8 Support?

This  gives this comparison chart for the four Windows 8 Editions (Core is usually just called Windows 8). I notice specifically, about half-way down, the max physical processors is listed as 1 for "Core" and 2 for all other.  In the second image i see physical processors listed as 8 in a Windows 8 Task Manager.  My question is, what is the limit then? Can anyone verify the article or the screenshot?  Was this a mock-up? Another Edition? (Server perhaps?)      To clarify, i am looking for links to official microsoft.com articles detailing these specifications.  I have been unable to find any.


A square matrix $A$ is called nilpotent is $A^k=0$ for some positive integer $k$.  Let $A$ and $B$ be square matrices of the same size such that $AB = BA$ and $A$ is nilpotent. Show that $AB$ is nilpotent.   Following that is $AB$ not equal to $BA$ in part (b), must $AB$ be nilpotent?  I don't get how to prove this. Since $A$ can represent any matrix. I have no idea how to show it.


How I can pass a form to twig template in Drupal 8?  For example, I get this:  a form: mymodule/src/Form/MyForm.php  Then on my Controller:  public function myController() {      ??????      return [         '#theme' => 'mytemplate',         ??????         ]; }   mytemplate.html.twig  {{ ????? }}


Too many decimal places when using Java?

I am currently trying to get my program to round to 2 decimal places, but seem to be unable to.  Here is my code:   double ounce; double grams;  grams = 0.00; System.out.println("This programme will print a table that can be used to convert ounces to grams, from values 1-15."); System.out.println("One ounce is equal to 28.35 grams.\n\nOunces \t\t\t Grams");  ounce = 0; do {   ounce++;   grams+=28.35;   System.out.println((""+ounce+"\t\t\t"+grams+"")); } while (ounce <15);   The output looks like this:       Ounces           Grams 1.0                  28.35 2.0                  56.7 3.0                 85.05000000000001 4.0                  113.4 5.0                  141.75 6.0                  170.1 7.0                  198.45 8.0                  226.79999999999998 9.0                 255.14999999999998 10.0                 283.5 11.0                311.85 12.0                340.20000000000005 13.0                368.55000000000007 14.0                 396.9000000000001 15.0            425.2500000000001   Lastly, my numbers under "grams" are not aligning exactly proper. Any ideas how to get them to align perfectly?


Suppose an entire function $f$ is real if and only if $z$ is real. Prove that $f$ has at most $1$ zero.

Let $f$ be an entire function. Suppose $f(z)$ is real if and only if $z$ is real. Prove that $f$ has at most $1$ zero. How to prove? Totally I have no idea... Please give the solution in detail since I do not understand.


Accessing a folder that I can't "name" in the shell

I have a stubborn folder that someone must have created accidentally and that has persisted all this time. I can see it with:  # find /var/www/html -maxdepth 1 -type d   which gives me:  /var/www/html /var/www/html/files /var/www/html/.?   unfortunately the question mark there is not the actual character ?, it merely seems to denote that there is no proper glyph and/or translation for that character. So something like rmdir is out of the question. My system has UTF-8 as the default locale as so many modern Ubuntu systems, but admittedly the folder in question may have originated on a RHEL or CentOS box (tared up and unpacked).  # env|grep LANG LANG=en_US.UTF-8   When trying to cd .\? (as mentioned before it is not actually ?) I get auto-corrected to . by bash and actually end up in /var/www/html/. for some reason. Now if I can't "name" this folder usefully, I cannot access it in any way. How can I get rid of it without putting the whole system in jeopardy?  Now I installed detox already but that only seems to act on files, not folders, according to its documentation and besides it still requires that I be able to name the object somehow to do something with it.


I have shown that a smooth solution of the problem $u_t+uu_x=0$ with $u(x,0)=\cos{(\pi x)}$ must satisfy the equation $u=\cos{[\pi (x-ut)]}$. Now I want to show that $u$ ceases to exist (as a single-valued continuous function) when $t=\frac{1}{\pi}$.  When $t=\frac{1}{\pi}$, then we get that $u=\cos{(\pi x-u)}$.  With single-valued function is it meant that the function is 1-1 ?  If so, then we have that $\cos{(2 \pi-u)}=\cos{(4 \pi -u)}$, i.e. for two different values of $x$, we get the same $u$, and so for $t=\frac{1}{\pi}$, $u$ is not 1-1.  But if this is meant, how are we sure that for $t \neq \frac{1}{\pi}$ the function is single-valued?


Why was the Prometheus more advanced than the Nostromo?

I am aware that the Prometheus was an important research ship whereas the Nostromo was just a mining ship, but that alone is not a satisfactory explanation for the sheer technological difference between these two ships.  The Nostromo used CRD screens and a really basic computer operating system.  The Prometheus, a much older ship, had freaking hologram computers.  One might argue that this is merely a matter of price, but consider this.  Physical hardware is heavier and more bulky than holographic readouts, and both weight and space would be important on a mining ship (I know weight is meaningless in space, but the heavier a ship is, the more fuel it has to expend both entering and exiting a planet's gravity).  Furthermore, the Prometheus approximately 100 years older than the Nostromo.  How could the owner of the Nostromo be unable to afford tech that is at least 100 years old?  It would be like a miner in today's world being forced to use bronze tools and wooden logs for transport because he can't afford steel tools or the wheel.  Please bear in mind, I am not asking why the Nostromo looks so low tech.  I am happy to believe that in the Alien universe that tech was appropriate.  My question is "why is the Nostromo so low tech when there was far more advanced tech available over 100 years ago?"


External display, keyboard & mouse connected to MacBookPro. Good or bad?

Whenever I have a fixed place to work, I like to use my MacBook Pro as shown:     Connected to an external display in mirror mode, not extended screen mode. Connected to external keyboard (Wireless Bluetooth, by Apple) and mouse (ThinkPad, Wired). Lid closed with the keyboard placed above it.   I have had this habit for a while and I haven't any doubt about it until recently when I observed something  happening to the MacBook's screen.  Is this a good or bad practise for the MacBook's lifespan?