Suppose $G$ is a group and $H_1, H_2\leq G$ such that $H_1\cup H_2=G.$  How can I prove that either $G=H_1$ or $G=H_2$?

"Let $G$ be a group, and suppose $G=H \cup K$, where $H$ and $K$ are subgroups.  Show that either $H=G$ or $K=G$."  Let $h \in H$ and $k \in K$.  Then $hk \in H$ or $hk \in K$ (since every element of $G$ is in either $H$ or $K$).  If $hk=h'$ for some $h' \in H$, then $k=h^{-1}h'$, so $k \in H$.  If $hk=k'$ for some $k' \in K$, then $h=k'k^{-1}$ so that $h \in K$.  If for all $h \in H$ we have $h \in K$, or if for all $k \in K$ we have $k \in H$, then $H \subseteq K$ or $K \subseteq H$.  Then since $G=H \cup K$, we must have either $H=G$ or $K=G$.  I'm not sure if the first paragraph of my 'proof' implies the second.  I've shown that for arbitrary $h \in H$, $h \in H$ and possibly $h \in K$, and similar for $k \in K$.  I don't know how to wrap it up (or perhaps this route won't lead anywhere at all).  If this way won't work, I'd just like a hint on a new direction to take.  Thanks.


I have 2 operating systems on my pc: windows 8.1 and Ubuntu. Windows 8.1 has internet connection, but Ubuntu does not. Is there a way I can download GCC for Ubuntu on my drive and then transfer and install it from there? what do I have to keep in mind when installing?  Note: I have never installoed a program on Ubuntu before!!  Specs: ubuntu 13.10 32bit windows 8.1 64bit   After trying the awnser I got this error:

I have a friend who has got a computer that is not connected to the Internet. Is there any way to install software offline easily?


I'm looking for a simple word to use as the name of a function in a computer program that widely employs a naming metaphor. For this reason, I need a simple verb that can substitute (the instruction) "Become born."

Is there any one word for the act of being born?  The closest things I could think of are:   I was born I come to life She is giving birth to me   I'm interested in knowing if there is one word to describe this; something similar to "I die."  (In Norwegian, we can use the word fødes).  Context:  I am creating a computer program, where I have several "mortal entities." These entities, amongst other methods, have a method named Die(), which defines everything that they do as they die. I would also like to create another method for what they do as they "bore."


The question:  You are playing a card game where the dealer selects three cards from a playing deck; 1 red and two black. The dealer shuffles the three cards and lays them face down next to each other, so that only he knows the position of the red card. He then asks you to guess where the red card is; but he does not turn over your selected card. You win the game if you guess correctly which card is the red card. After your choice of card is made, the dealer turns over one of the cards you did not select, which is a black card (every time the game is played, the card that the dealer will turn over at this stage of the game is a black card). Now the dealer asks if you would like to change your mind. Are you better to change your mind, stick to your first selection, or doesn't it matter? Your answer must be fully justified with mathematical working. Hint: To get a feel for this question, think about the case where there are many cards (say 1000), but still only 1 red card and the dealer overturns all but 2 (998 cards).  --  Now I'm confused with how to approach this problem. I have a feeling that you need to gather the probabilities from before the event of the dealer putting the cards face down, and then after choosing a card and having to choose whether or not to change your mind.  Can anyone help me on approaching this question? Would be very appreciative. Thanks.

I was watching the movie 21 yesterday, and in the first 15 minutes or so the main character is in a classroom, being asked a "trick" question (in the sense that the teacher believes that he'll get the wrong answer) which revolves around theoretical probability.  The question goes a little something like this (I'm paraphrasing, but the numbers are all exact):  You're on a game show, and you're given three doors. Behind one of the doors is a brand new car, behind the other two are donkeys. With each door you have a $1/3$ chance of winning. Which door would you pick?  The character picks A, as the odds are all equally in his favor.  The teacher then opens door C, revealing a donkey to be behind there, and asks him if he would like to change his choice. At this point he also explains that most people change their choices out of fear; paranoia; emotion and such.  The character does change his answer to B, but because (according to the movie), the odds are now in favor of door B with a $1/3$ chance of winning if door A is picked and $2/3$ if door B is picked.  What I don't understand is how removing the final door increases the odds of winning if door B is picked only. Surely the split should be 50/50 now, as removal of the final door tells you nothing about the first two?  I assume that I'm wrong; as I'd really like to think that they wouldn't make a movie that's so mathematically incorrect, but I just can't seem to understand why this is the case.  So, if anyone could tell me whether I'm right; or if not explain why, I would be extremely grateful.


I found the same question ( here), but the answer uses characteristic functions and fourier inversion theorem, but this is exercise in chapter long before characteristic functions.

Supposing $X$, $Y$ and $Z$ and mutually independent real random variables, how can we prove that $X+Y$ and $Z$ are independent from the definition? If not from the definition, using $\sigma$-algebras?  I know that if $X$ and $Y$ are not independent this doesn't work so I know I have to make use of their independence in my proof but I can't figure out how. And it means that if I write the following, I'm making a mistake, and I can't find it:  $$\mathbb{P}(X+Y \leq k,Z \leq l)=\int_{\mathbb{R}} \mathbb{P}(X=x,Y \leq k-x, Z \leq l) dx=\int_{\mathbb{R}} \mathbb{P}(X=x,Y \leq k-x) \mathbb{P}(Z \leq l) dx = \mathbb{P}(Z \leq l)\int_{\mathbb{R}} \mathbb{P}(X=x,Y \leq k-x)dx= \mathbb{P}(Z \leq l) \mathbb{P}(X+Y \leq k) $$  PS: I have seen the proof here but it much more advanced stuff, kind of a sledgehammer...


I know that there exists a unique group of order $n$ if and only if $(n, \phi(n))=1$.  I also know how to obtain the number of abelian groups of a certain order  There are exactly 5 groups of order 8, two of them are non-abelian and there are exactly 5 groups of order 12, three of them are non-abelian.  I noticed that $\phi(8)=4=(8,4)$, $\phi(12)=4=(12,4)$ and that $2=\frac{8}{4}$,$3= \frac{12}{4}$.   So, my question is are there exactly $\frac{n}{\phi(n)}$ or $\frac{n}{(\phi(n),n)}$ non abelian groups of order $n$?   Or is there any way to know how many non-abelian groups of a certian order there are?

I have tried to solve it for the case when $n=1,2,3,4$ which i found that there is only one group for $n=1$, one group for $n=2,$ one group for$ n=3 $ and two groups for $ n=4$, then my question come, if i were given a number $n$ which is larger, how do i know how many different groups are there?  (I treat two isomorphic groups as the same group in this question.)


I'd like to know how to disable sftp or FTP access in general for a certain user through SSH. I've found many articles describing how you can enable sftp without SSH access, but sadly no article on how to do the opposite.

I would like to know how to set up root, sudo, sftp-only user accounts which won't be required public key authentication at log in. I would also like to know how to set up sftp-only users' home directories where they can't access upper level other directories.


There's one Apostol's Exercise that asks to show that if $f : \mathbb{C} \to \mathbb{C}$ is a polynomial function with real coefficients, then $f(z)=f(i)$ for every complex number $z \in \mathbb{C}$. But I'm certain that this is false, because it would be saying that every polyonomial is constant. And indeed, finding a counterexample is pretty straightforward. Let $f(z)=1+z+z^2$ and compute $f(1+i) =2+3i$ and on the other hand $f(i)=i$ which are clearly different.   Since the seccond item of the exercise asks to show that using this fact we can prove that the complex zeroes of $f$ occur at pairs of complex conjugates, I've managed to replace the first question by proving that $f(z)=f(\bar{z})$ for every $z$.  Is my conclusion correct? Is this really a typo?  Thanks very much in advance.

Exercise problem. I do not need a full solution because I am trying to solve myself. Just a hint would be great. Let $f$ be a polynomial with real coefficients. How to show that $f(z) = f(i)$ for every complex $z$?


1) "Today the number of referrals passed are 24"  2) "Today the number of  referrals passed is 24"  Please help. Using 'IS' or 'ARE' which is correct?

Possible Duplicate:          From the grammatical view both are correct, but please explain the difference in meaning:   The number of students in the class is fifteen. A number of students were late for class.


How to find the maximum possible value of $\big| (z_1-z_2)^2+(1-z_1)(1-z_2) \big|$   given that $|z_1|=|z_2|=1$ ?  I cannot think of any easy method to do it. Any suggestion?  P.S: Avoid using multivariable calculus.

How to find the maximum and minimum value of $\left|(z_1-z_2)^2 + (z_2-z_3)^2 + (z_3-z_1)^2\right|$ (where $|z_1|=|z_2|=|z_3|=1$ are complex numbers.) ?  My try:  $$\begin{align}\left|(z_1-z_2)^2 + (z_2-z_3)^2 + (z_3-z_1)^2\right| &\leq |z_1-z_2|^2 + |z_2-z_3|^2 + |z_3-z_1|^2 \\ &\leq (|z_1|+|z_2|)^2 + (|z_2|+|z_3|)^2 + (|z_3|+|z_1|)^2 \\ &\leq 2^2+2^2+2^2 \leq 12\end{align}$$  However the answer given is $8$. Where am I going wrong and how to do it correctly?


I know this problem may occur when I declare function and not define it.  But this is not the case.  //In the 'H' file. Template class. BSNode(T data);   \\In the cpp definitions  template <class T> BSNode<T>::BSNode(T data) {     _root = this;     _data = data;     _right = NULL;     _left = NULL; }   And still, I get the next Error:  Error   1   error LNK2019: unresolved external symbol "public: __thiscall BSNode<int>::BSNode<int>(int)" (??0?$BSNode@H@@QAE@H@Z) referenced in function _main  c:\Users\a\OneDrive\ss\visual studio 2013\Projects\Project5\2\Source.obj    2_TREES   What also may cause this Error to occur if its not the incompatibility between the 'H' and the 'cpp' files?

Quote from :     The only portable way of using templates at the moment is to implement them in header files by using inline functions.   Why is this?  (Clarification: header files are not the only portable solution. But they are the most convenient portable solution.)


My two-year-old was playing with my (locked) Galaxy Nexus, and when she eventually handed it back to me, it was at the "Welcome" new phone setup screen.    I'm guessing that she managed to hold down buttons and eventually end up at the factory reset option.  So I guess my first question is, was the phone definitely factory reset?  Is there any other case in which the phone would boot up to this screen?  Second, assuming it was a factory reset, and I have never setup any backup software or anything like that, what are my options for recoving pictures and SMS messages?  I assume that my only real option is to somehow snapshot the raw disk device(s) onto my computer and from there run file recovery software on the image.  Is that the case, or are there other options?  If so, how do I copy the raw disk device(s)?  Thanks.

A person at a phone store reset all the contents of my Motorola Moto G Android phone, and I did not give them permission to do so. I had many important pictures and videos, but the even more important thing were the audio recordings I had created.  Is there ANY WAY to recover this data? I know it was reset, but I'm very stressed and would appreciate a pointer of a way to effectively recover some or all of the data without comprising it in the process. I am not using the phone, and had shut it off entirely. I'm aware that the more you use it, the more it overwrites the data. I NEVER had a backup, dumb, I know.  Thank you folks!  **Edit: I recovered most of my photos and videos just now through Google+, most of it was synced! But how can I recover my voice recordings ? That's what's most important to me. I used this app.   Unfortunately, my phone model never supported SD cards, so there's nothing there.


Hello I am writing the code to read in xmls on my machine, it runs perfect already on another machine but on my machine it gives an error in one line of code  it reads 500, 600 xml and in the end creates a spreadsheet but at line 41 of an error I think it is in the function a.length  follow the code  /*  * To change this license header, choose License Headers in Project Properties.  * To change this template file, choose Tools | Templates  * and open the template in the editor.  */ package teste;  import java.io.File; import java.io.FileWriter; import java.io.IOException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import org.xml.sax.SAXException;  /**  *  * @author francielle.garcia  */ public class Sistema {      public static void main(String[] args) throws SAXException, IOException, ParserConfigurationException {         DocumentBuilderFactory fabrica = DocumentBuilderFactory.newInstance();         DocumentBuilder builder = fabrica.newDocumentBuilder();         Document xml;         Element e;                 File a[];          File lerxml = new File("C:\\Users\\francielle.garcia\\Desktop\\Ler XML\\localXML.xml");         xml = builder.parse(lerxml);         NodeList locais = xml.getElementsByTagName("localXML");         e = (Element) locais.item(0);         String local = e.getTextContent();          File diretorio = new File(local);          a = diretorio.listFiles();         int i;         for(i = 0; i < a.length; i++){ // linha do erro             xml = builder.parse(a[i]);              NodeList payloads = xml.getElementsByTagName("payload");             e = (Element) payloads.item(0);             String payload = e.getTextContent();              NodeList timeStamps = xml.getElementsByTagName("stuMessages");             e = (Element) timeStamps.item(0);             String timeStamp = e.getAttribute("timeStamp");               File arquivo = new File("C:\\Users\\francielle.garcia\\Desktop\\Ler XML\\xml.csv");             arquivo.createNewFile(); //Caso voce queira criar um novo arquivo a partir de cada formulario use esse comando             try (FileWriter fw = new FileWriter(arquivo, true)) {                 fw.write(payload + ";" + timeStamp+"\r\n");             }         }         System.out.println("Numero de Linhas Geradas: "+i);       }   follow the error  run: Exception in thread "main" java.lang.NullPointerException     at teste.Sistema.main(Sistema.java:41) C:\Users\francielle.garcia\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1 FALHA NA CONSTRUÇÃO (tempo total: 0 segundos)

What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?


I'm currently running 14.04lts but i want to upgrade to 15.04. The things is that in the file where you change the prompt=lts to normal, when I try to change it to normal i can't save it and i just want to know how.

I can't seem to edit and save config files in the root system (eg: /etc/dhcp/dhcpd.config); it just says "permission denied" or the save option is blocked in the text editor.  I'm pretty sure I'm a root user, but how do I make sure? If I am a root user, how do I fix this?


Show that if $a_1>b_1>0,a_{n+1}=\sqrt{a_nb_n}$ and $b_{n+1}=\frac{a_n+b_n}{2}$, then $a_n$ and $b_n$ both converge to a common limit.  It seems a bit intuitive but I am not able to get it in writing. I tried using Cauchy's test but it isn't helping(introducing more variables). Some help please. Thanks.

I am given this problem: let $a\ge0$,$b\ge0$, and the sequences $a_n$ and $b_n$ are defined in this way: $a_0:=a$, $b_0:=b$ and $a_{n+1}:= \sqrt{a_nb_n}$ and $b_{n+1}:=\frac{1}{2}(a_n+b_n)$ for all $n\in\Bbb{N}$    To prove is that both sequences converge and that they have the same limit. I don't know how to show this. I have spent 2 hours on this, no sign of success


I have learnt that a fraction with a surd in its most simplest form should have the surd in the numerator and not the denominator? Why is it convention not to leave the surd on the denominator? Is it just arbitrary convention or does it have an actual purpose?

In grade school we learn to rationalize denominators of fractions when possible. We are taught that $\frac{\sqrt{2}}{2}$ is simpler than $\frac{1}{\sqrt{2}}$.  says that "there is a bias against roots in the denominator of a fraction". But such fractions are well-defined and I'm failing to see anything wrong with $\frac{1}{\sqrt{2}}$ - in fact, IMO it is simpler than $\frac{\sqrt{2}}{2}$ because 1 is simpler than 2 (or similarly, because the former can trivially be rewritten without a fraction).  So why does this bias against roots in the denominator exist and what is its justification? The only reason I can think of is that the bias is a relic of a time before the reals were understood well enough for mathematicians to be comfortable dividing by irrationals, but I have been unable to find a source to corroborate or contradict this guess.


Say you are a high school student or a young undergrad. You are being taught about complex numbers and you are told that $i = \sqrt{-1}$.  You go home and you write this: \begin{equation} \begin{aligned} 1 & = 1 \\ 1 & = \sqrt{1} \\ 1 & = \sqrt{(-1)(-1)} \\ 1 & = \sqrt{-1}\sqrt{-1} \\ 1 & = i \times i \\ 1 & = i^2 \\ 1 & = -1 \end{aligned} \end{equation}  You are dismayed. The infamous imaginary numbers are inconsistent after all!    The best answer would be the clearest explanation of why the "proof" is faulty, keeping in mind the level of the student. An explanation is extra clear if t presents insights to the student, as well as being correct and concise.

We know $$i^2=-1 $$then why does this happen? $$ i^2 = \sqrt{-1}\times\sqrt{-1} $$ $$ =\sqrt{-1\times-1} $$ $$ =\sqrt{1} $$ $$ = 1 $$  EDIT: I see this has been dealt with before but at least with  I'm not making the fundamental mistake of assuming an incorrect definition of $i^2$.


In one of my Google Chrome profiles, opening a new tab displays the text about:blank in it. This has become increasingly annoying because my muscle memory is such that I start typing the URL foo.com immediately after opening a new tab, and with this pre-filled text, it ends up being about:blankfoo.com.     From a quick comparison of the preferences between this profile and another one (where this doesn't happen), I couldn't find anything that was obviously off, but perhaps I am not looking in the right place.  Is there a way to remove this pre-filled text from a new tab?

I want to open a tab and nothing but a tab. So far, I have used  and specified a blank redirect URL, which becomes about:blank. But when I press CMD/CTRL + T it gives focus to the location bar but puts the cursor after about:blank. Is there a way to either clear about:blank entirely or select all the text, so I can start typing straight away and not have to CMD/CTRL + A and backspace/delete?  EDIT:  I tried :  html {     display: none !important; }   With the  for URL chrome://newtab but it didn't work.


How is the $\frac{1}{r^2}$   dependence of the electric field intensity due to a stationary point charge consistent with the concept of field lines?

When we're dealing with problems in electrostatics (especially when we use Gauss' law) we often refer to the density of electric , which is inversely proportional to the radius in the case of a single point charge (all field lines are directed radially).   My question may sound dumb, despite the fact that this concept is quite intuitive, but if you think about it there is actually an infinite amount of field lines which we can draw everywhere (one through every point), so speaking of an area where field lines are more "dense" or "sparse" doesn't make much sense to me.  With this in mind, why can we still use such a concept? Why does it really work?


I want to convert Date format from 2017-02-08 00:00:00.0 to dd/MM/yyyy(08/02/2017). I tried with the following code.            String dateInString  =bean.getDate();           Date date = null;           SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");            if (bean.getDate().matches("^[0-9]{2,4}(-[0-9]{1,2}){2}\\s[0-9]{1,2}(:[0-9]{1,2}){2}\\.[0-9]{1,}$")) {                 try {                     date = formatter.parse(dateInString);                 } catch (ParseException e) {                     e.printStackTrace();                 }           }    But I am getting NullPointerException in date = formatter.parse(dateInString); line.


document.querySelector('#showButton').addEventListener('click', showBtn);  function showBtn(){   let containerDivElement = document.querySelector('#button-container');    let button = document.createElement('button');      button.id = "btnId";   button.innerHTML = "Click me!";    // append elemnt to the container div    containerDivElement.appendChild(button);      document.querySelector('#btnId').addEventListener('click', createAlert('Ouch!')); }  function createAlert(message){   alert(message); } .container{   width: 75%;   margin: 0 auto;   display: flex;   flex-wrap: wrap;   justify-content: space-around; }
     <button id="showButton">Show button</button>

     I'm a junior developer who's developing a deep understanding of JavaScript, and while I was working on some demo a weird event grasped my attention.   The previous demo showcases the weird event, I used an addEventListener() to attach an event handler to the showButton element of type click which causes the showBtn() to be called that creates other button element and appends it to the container div.   Also, In the showBtn() I created other addEventListener() to attach an event handler to the second button of type click that causes createAlert() to be called and this function takes an argument (message) to show it in an alert.   The weird event is when I pass a parameter to the createAlert function using addEventListener() of the element that has been created by the showBtn(), the createAlert() click event occurs when the ShowButton is clicked.  As I found out, it's wrong to pass a parameter in this way, but this made me curious to know the reason for this wired result.

The situation is somewhat like-  var someVar = some_other_function(); someObj.addEventListener("click", function(){     some_function(someVar); }, false);   The problem is that the value of someVar is not visible inside the listener function of the addEventListener, where it is probably being treated as a new variable.


I'm currently testing a html form which sends the data through php to the sql database. The problem I'm facing is special characters break the form and don't update the database. I haven't tested all the special characters but mainly ` and ' are the culprits. I've tried mysql_escape_string, preg_replace and add_slashes with no success. What am I missing?  $description = preg_replace('/[^A-Za-z0-9\ %&$=+*?()!.-]/', ' ', $_POST['description']); $description = preg_replace("/[\n\r]/"," ",$description);  // Items Insert foreach ($item as $index=>$value) { $sqlItems .= "     INSERT INTO quote_items (quote_id, item, description, amount, gst)     VALUES ('$last_id', '$item[$index]', '$description[$index]', '$amount[$index]', '$gst[$index]'); "; }   Thanks in advance!

If user input is inserted without modification into an SQL query, then the application becomes vulnerable to , like in the following example:  $unsafe_variable = $_POST['user_input'];   mysql_query("INSERT INTO `table` (`column`) VALUES ('$unsafe_variable')");   That's because the user can input something like value'); DROP TABLE table;--, and the query becomes:  INSERT INTO `table` (`column`) VALUES('value'); DROP TABLE table;--')   What can be done to prevent this from happening?


What is the command that shows your computer's personal IP address? I have tried   ip addr show   But that shows much more than I want to see.

How can I see my IP address on Ubuntu? I used   ifconfig eth0   but it only displays HWaddr and I don't see where the IP address is.


How much memory is free? From my understanding i have 1GB of memory, and it says free is 71MB?   But why does it say that i have 536 free in buffers? So am I really using all my ram or not?               total       used       free     shared    buffers     cached Mem:           994        923         71          0        111        352 -/+ buffers/cache:        458        536 Swap:            0          0          0

I have just turned on my PC and have two applications running; Thunderbird and Firefox. Whatever else is running is part of Ubuntu's feature set (as well as a few indicators).  This has been ongoing for weeks, so I'm not sure if it's normal behaviour or not.  Right now, my memory usage indicator says that Ubuntu is using 41% of my 6GB of RAM. I haven't even opened Gimp or my other day-to-day things. I'll be buying another 6GB of RAM, this week, so that I don't run out when using Gimp or Openshot, for example.  An overview of my running applications shows that Nautilus is using the most, yet it isn't even open. This seems a little excessive, or am I missing something?


I have a brand new HP Envy 17-j020us Core i7 w/Win8 laptop that I cannot boot on any live DVD. I,ve tried 12.04,12.10 and 13.04. I've tried Secure boot off and on, Legacy boot off and on. Grub loads fine but the screen goes black after selecting "Try" or "Install". DVD runs for several minutes but video never appears. I suspect a video problem on boot but it could be anything? I have a rough idea how to edit boot options in grub but I dont know what those video options would be? Any help is greatly appreciated. EDIT: found another post similar that mentions option"nomodeset", will try that when I get home tonight. Other post however mention my intel HD4600 graphics being supported, so my initial thought of it being video related seems unlikely. EDIT: Boot disks were turning screen brightness to ZERO! This is known bug from what I've read? And its on all three versions...12.04-12.10-13.04. Now If I can figure out how to mark this solved///  HP Envy 17-j020us

I am trying to boot Ubuntu on my computer.  When I boot Ubuntu, it boots to a black screen.  How can I fix this? Table of Contents:


I used to thing that HashSet is a pretty fast data structure implementation because it uses hashes (and is implemented via HashMap in its turn). I was solving some problems and decided to check performance issue, so here it is:     You are given an array with numbers - [11, 3, 11, 11, 3, 2, 0, -2, 2]    You are supposed to write a function that returns the number that appears "odd" number of times.    Here is my solution:  public class OddNumInArray {  public static List<Integer> oddNumList(int [] ar){     Collection <Integer> l = new ArrayList<>();     for (int n: ar) {         if (l.contains(n)) {             l.remove(n);         }         else {             l.add(n);         }     }     return (List) l; }  public static Set<Integer> oddNumHSet(int [] ar){     Set <Integer> l = new HashSet<>();     for (int n: ar) {         if (l.contains(n)) {             l.remove(n);         }         else {             l.add(n);         }     }     return l; }  public static void main(String [ ]arg) {     int [] a1 = new int [10000000];     for (int i=0; i<10; i++){         a1[i]=(new Random()).nextInt(5);     }     long cur= System.nanoTime();     System.out.println(oddNumList(a1));     long c1 = System.nanoTime()-cur;     System.out.println("TIME CONSUMED:" +c1);     cur= System.nanoTime();     System.out.println(oddNumHSet(a1));     long c2 = System.nanoTime()-cur;     System.out.println("TIME CONSUMED:" + c2);     System.out.println("c1/c2*100: "+ (new Double(c1)/new Double(c2)*100)); }  }   And here is an output:  [1, 0] TIME CONSUMED:101804000 [0, 1] TIME CONSUMED:183261000 c1/c2*100: 55.55137208680516   So, why is implementation with ArrayList is quicker than one with HashSet by almost 2 times? Thank you.

How do you write (and run) a correct micro-benchmark in Java?  I'm looking for some code samples and comments illustrating various things to think about.  Example: Should the benchmark measure time/iteration or iterations/time, and why?  Related:


in combination when we have a binomial lattices like $(x+y)^n$ the coefficient of $x^ky^{n-k}$ is equal with $C(k,n)$ ...  for example we have $(x+y)^4$ so we have this $4$ factor $(x+y)(x+y)(x+y)(x+y)$ and we want to find the coefficient of $x^2y^2$ ?  I want a complete answer thanks !!

How was the binomial coefficient of the binomial theorem derived?  $$\frac{n!}{k!(n-k)!}$$


I'm aware similar questions have been asked and answered but I can't seem to get them to apply to my issue.   Below is the code that sends an ajax post when the form is submitted    $form.on("submit", function(event) {     event.preventDefault();      $.ajax({       url: url,       data: JSON.stringify({ description: desc }),       type: "POST",       contentType: "application/json",       dataType: "json",       success: function(data) {          $(".list").append(           '
<input type="checkbox" value="' +             data.id +             '">description
"         );         createOnClicks(data.id);       },       error: function(error) {         //list errors      },       complete: function() {        //reset form       }     });   });   this is part of the createOnClicks() function:  function createOnClicks(id) {     var listId = "#" + id;      $(listId).on("click", function(event) {       var value = $(this).is(":checked");        if (value) {         console.log("checked");         $.ajax({           url: "/listapi/" + id + "/complete",           type: "POST",           contentType: "application/json",           dataType: "json",           success: function(data) {             console.log(data);             $(listId)               .parent("li")               .addClass("complete");           }         });       } else { ...      } });   createOnClicks works correctly when it is called on elements that are there when the page loads, but won't work on elements that are added with the ajax post.   $(listId) returns an empty object when called within createOnClicks(), despite on the line above `console.log(listID) shows the appropriate value.

I have a bit of code where I am looping through all the select boxes on a page and binding a .hover event to them to do a bit of twiddling with their width on mouse on/off.  This happens on page ready and works just fine.  The problem I have is that any select boxes I add via Ajax or DOM after the initial loop won't have the event bound.  I have found this plugin (), but before I add another 5k to my pages with a plugin, I want to see if anyone knows a way to do this, either with jQuery directly or by another option.


In a Visual C# project's properties, I can go into Assembly Information and change both the assembly version and the file version. I've found that when I change the assembly version, a new folder is created in C:/Users/[username]/AppData to save any changes to user-scoped settings. This means any changes that were made in a previous version are lost and the settings are restored to their defaults. This can especially be a problem if the settings store important information like file paths and the application is shared by multiple users and the new user doesn't know how to change the settings to make it the way it was before the update.  Is there a standard solution to this problem? How do applications normally save a user's settings when the assembly version changes? Do applications normally just not change the assembly version at all unless they want to reset the settings to their defaults? I could just store data in a different file but I want to know if this can be done while still using user.config.  Also, how do I see what an exe's assembly version is? In its properties, the details tab shows "file version" and "product version" but they both reflect the file version that was set in Visual Studio.

Basically the problem is that each time the assembly version changes (i.e. the user installs a new version of the application) all their settings are reset the the defaults (or more accurately a new user.config file is created in a folder with a different version number as the name)  How can I keep the same settings when upgrading versions, since using ini files or the registry seem to be discouraged?  When we used Clickonce it seemed to be able to handle this, so it seems like it should be able to be done, but I'm not sure how.


A typical example in category theory is to consider a given group $G$ as a category with one object. Then, $\hom(G, G)$, the set of arrows from $G$ to $G$, is defined to be the elements of $G$.  My problem is that I can't understand the relation between the set of arrows from $G$ to $G$ and the set of element of $G$. Is it that to each arrow is associated an element of $G$? How? It is hard for me to grasp the idea. Any help would be appreciated.     There is a question with a similar title ; but I couldn't find my answer there.

Is it possible to define a group as a category?  What exactly will be objects of this category and how will we say that every element should have an inverse?


public class Chair {    private String typeChair;    private String materials;    private String color;    private double legs;    private double pricePerChair;     public void setTypeChair(String t) {       typeChair = t;    }    public String getTypeChair() {       return typeChair;    }    public void setMaterial(String m) {       materials = m;    }    public String getMaterials() {       return materials;    }    public void setColor(String c) {       color = c;    }    public String getColor() {       return color;    }    public void setLegs(double l) {       if (l >= 0 && l < 10) {          legs = l;       } else {          System.out.println("Legs must be between 0 and 9");       }    }    public double getLegs() {       return legs;    }    public void setPricePerChair(double p) {       if (p > 0) {          pricePerChair = p;       } else {          System.out.println("Price must be greater than 0");       }    }    public double getPricePerChair() {       return pricePerChair;    }    public double getCost() {       double cost = 0;       if (materials == "vinyl") {          cost += (pricePerChair * 0) + pricePerChair;       } else if (materials == "leather") {          cost += (pricePerChair * .4) + pricePerChair;       } else if (materials == "cloth") {          cost += (pricePerChair * .1) + pricePerChair;       }        return cost;    }    }   hello, i'm having trouble getting the cost of a chair from the material. the material is input from the user. if the material is vinyl, the additonal cost is 0%, leather is .4%, and cloth is .1%. everytime i run my main method, the cost prints 0. whats the problem in the code?

I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug.  Is == bad? When should it and should it not be used? What's the difference?


One question keeps bothering me. Tessio was a traitor. It is also well seen even before the Don died. It was his crew that was supposed to guard the hospital where Don was lying. Barzini also knew upfront that Luca is trying to infiltrate the family. So, then why didn't Tessio rat the whole plan out? He was in the room when Michael suggested killing Sollozzo and the policeman. He didn't rat Michael out even when they found out where the restaurant is located. Or did he, and Barzini closed his eyes on that because it was what he wanted to happen? Or perhaps I'm wrong and Tessio became a traitor only after Don has died.

If Tessio was a traitor to the family, why he didn't reveal Michael's plan to kill Sollozzo?


I am presently reading a novel in present-day India about an outcast (Dalit) woman who has to clean the latrines of her neighbors in a small village.  This brought back to my mind a story I read very long ago. In an isolated space colony there is one man who is an outcast because he deals with feces (or the other way round). They have advanced technology so in fact all the "dirty" job is really done by machinery and the guy really only deals with supervising the machinery, but he is an outcast all the same.  I tried to google "science fiction" + outcast + feces and also with "excrement" in 3rd position, and also with a synonym in four letters, to no avail. (SF sends me to San Francisco)  Rings a bell ?

It's a short story that I read in a book at some point in the 1990's. It was the French translation, so it might have been older. I believe it was a short story by Isaac Asimov, set in the early days of the Galactic Empire from Foundation, but I may be wrong.  The story had someone sent to visit an asteroid colony, might have been a mining colony, for some reason. The visitor is a sort of official and soon realizes that there's something wrong when he interacts with the local officials, and he's told the guy in charge of maintaining the plumbing is on strike.  Short explanation ensues and the visitor learns that no one in the colony would make direct contact with the plumber because he is unclean thus outcast, since he also deals with waste and the dead. Visitor offers to go negotiate on behalf of the colonists because he's not bound by their caste system, to which the colony official happily agree. The negotiations go well and the plumber resumes his work.  However, when the visitor tries to go back to the colony, he finds the way blocked and he is directed, through automated doors and voices coming out of speakers, back to his shuttle and asked to leave the colony because, since he was in contact with the plumber, he's become unclean too thus the colony officials cannot get in contact with him anymore.


I am wondering why the input to D2 will not be floating when the switch is open. If the switch is open, wouldn't it act like a mini antenna and provide a random input to the D2 pin?

In my quest to understand electrical engineering, I have stumbled across this tutorial:    I have understood the diagrams until I got to switches. I am not sure how switches work on the breadboard or the diagrams. This is the specific one I am thinking of (this is of a pull down resistor):    The implementation is:    Based on the diagram, what I think is happening is: Power goes to the switch, if the button is up then the circuit is not completed. If the button is pressed then the current takes the path of least resistance to pin2 because it has more pull (100ohm < 10kohm).  The way it is described in the tutorial sounds like when the button is up, the circuit is still complete, but the 10k ohm resistor pulls the power to the ground. I am not positive how or why if both the 10k ohm and 100ohm are receiving equal current, the current would get pulled to the ground through a higher resistance than is open to pin 2.


I have installed the latest factory image for Android Lollipop version from Google site to my Nexus 5 device.  When I am updating apps from Play Store, "Update all" option is not working. Some of individual apps like Maps, Calendar also shows indefinite spinner. Google Fit, Google Keep, Maps and Play Music apps are not updating. Getting error:      Could not be downloaded due to an error (495)

"Facebook" could not be downloaded due to an error. (495)   How do I solve this error?


I am trying to implement template singleton pattern but I got the following error. How should I overcome this error?  Below is singleton_template.h  #include <iostream> #include <string> /* * Burada yapılan herşey ".h" dosyası içerinde olmalı */ template<typename T> class Singleton { private:    static T* _instance;    Singleton(const Singleton&);    Singleton & operator=(const Singleton& rhs);  protected:    Singleton();  public:    static T* getInstance()    {      if(!_instance)      _instance = new T;      return _instance;    }     void destroyInstance()    {        delete _instance;        _instance = NULL;    } };  template<typename T> T* Singleton<T>::_instance= NULL;   Here is the singleton_template.cpp  #include <iostream> #include <string> #include "singleton_template.h"  class GKM : public Singleton<GKM> { public:    GKM()   {     std::cout << "Single GKM created"<<std::endl;   }   virtual void initialize(){return;}  };  class Turnstile: public GKM  { public:   Turnstile(){std::cout << "Single turnstile created add: "<< this<<std::endl;}   virtual void initialize(){std::cout <<"Turnstile"<< std::endl;}  };  int main() {   GKM* trn= Turnstile::getInstance();   trn->initialize();   return 0; }   Here is what I get after a failed compilation:     /tmp/ccfD0Xgx.o: In function GKM::GKM():   singleton_template.cpp:(.text._ZN3GKMC2Ev[_ZN3GKMC5Ev]+0xd): undefined   reference to Singleton<GKM>::Singleton() collect2: error: ld   returned 1 exit status

Quote from :     The only portable way of using templates at the moment is to implement them in header files by using inline functions.   Why is this?  (Clarification: header files are not the only portable solution. But they are the most convenient portable solution.)


Let $A=\mathbb{C}[t]$ and $B=\mathbb{C}[t^2,t^3]$. We can naturally regard $A$ as a $B$-module. I want to show that $A$ is not flat $B$-module.   Let $f:A\otimes_B A \to B\otimes_B A,\ x\otimes y \mapsto t^2x\otimes y$.  $f(1\otimes t)=f(t\otimes 1)$, so it is enough to show that $1\otimes t \neq t\otimes 1$ in $A\otimes_B A$. But I can't show it. How to prove it?  Thanks!

I wish to show that the injection $k[y^2, y^3] \rightarrow k[y]$ is not flat.    I know of geometric ways to see this, but I wish to see explicitly $k[y^2, y^3]$-modules (or localizations thereof) $0 \rightarrow M' \rightarrow M$ which does not remain injective upon tensoring with $k[y]$. Is such a search futile?


Once I was asked a question during the interview.  Hence I have a function void f(std::string), and I call a function as this f("int"). So that my function must create a local int x in its body. Is there a way to get the type from const char*. I know that boost::mpl::vector does solve this kind of problem. Can anyone tell me the technique?

I have a file: Base.h  class Base; class DerivedA : public Base; class DerivedB : public Base;  /*etc...*/   and another file: BaseFactory.h  #include "Base.h"  class BaseFactory { public:   BaseFactory(const string &sClassName){msClassName = sClassName;};    Base * Create()   {     if(msClassName == "DerivedA")     {       return new DerivedA();     }     else if(msClassName == "DerivedB")     {       return new DerivedB();     }     else if(/*etc...*/)     {       /*etc...*/     }   }; private:   string msClassName; };  /*etc.*/   Is there a way to somehow convert this string to an actual type (class), so that BaseFactory wouldn't have to know all the possible Derived classes, and have if() for each one of them? Can I produce a class from this string?   I think this can be done in C# through Reflection. Is there something similar in C++?


When I insert the disc it says,   "D:\  The directory name is invalid"  I bought it here:    I'm using Windows 10.  I tested with a different Windows 10 Computer, and the disc wasn't empty. But when I use my PC, the disc is read as empty.  I haven't fiddled with any settings regarding discs.  The problem isn't that I can't install Baldur's Gate; It's that my PC reads the disc as empty for some reason.  Why won't it run?    I uninstalled the CD rom device from device manager.  Then I rescanned for new hardware.

I have a couple of old CD games such as Mig-29 Fulcrum, F-16 Novalogic and F-22 Raptor etc. and I want to install them. When I load the CD in my laptop it runs and open's up the launcher but when I click the "Install Game" nothing happens.   The setup launcher doesn't launch. Why?  Is this because it is a 32 bit installer or 16 bit Installer? (I have windows 10 64 bit). I even manually go to the setup located in the CD and try to run it in compatibility mode, admin Mode etc, but the setup Application doesn't run/open up/start. How do I make the setup application to run on my laptop?


I am reading an algebra book now.       Let $p(x) \in \mathbb{R}[x]$ and $\deg p = n$.   Let $\alpha \in \mathbb{C} - \mathbb{R}$ and $p(\alpha) = 0$.        Then, $p(\bar{\alpha}) = \overline{p(\alpha)} = 0$.        So, $p(x)$ is divisible by $(x-\alpha)(x-\bar \alpha)$.        $(x-\alpha)(x-\bar \alpha) = x^2 - 2 \Re(\alpha) x + |\alpha|^2 \in \mathbb{R}[x]$.        So, there is a polynomial $q(x) \in \mathbb{R}[x]$ such that $p(x) = (x^2 - 2 \Re(\alpha) x + |\alpha|^2) q(x)$.     Why $q(x) \in \mathbb{R}[x]$?  Is it necessary to prove that $q(x) \in \mathbb{R}[x]$? Or, is it obvious that $q(x) \in \mathbb{R}[x]$?    My proof is here:    There is $q_1(x) \in \mathbb{C}[x]$ such that $p(x) = (x-\alpha)(x-\bar \alpha) q_1(x)$ in $\mathbb{C}[x]$. There is $q_2(x), r_2(x) \in \mathbb{R}[x]$ such that $p(x) = (x^2 - 2 \Re(\alpha) x + |\alpha|^2) q_2(x) + r_2(x)$ in $\mathbb{R}[x]$ and $2 > \deg r_2$. $p(x) = (x-\alpha)(x-\bar \alpha) q_1(x) = (x^2 - 2 \Re(\alpha) x + |\alpha|^2) q_2(x) + r_2(x)$ in $\mathbb{C}[x]$. By a theorem about long division, $q_1(x) = q_2(x), r_2(x) = 0$. So, $p(x) = (x^2 - 2 \Re(\alpha) x + |\alpha|^2) q_2(x)$, and $q_2(x) \in \mathbb{R}[x]$.

let $P \in \mathbb{R}[X]$ be a real polynomial divisible by a polynomial $Q \in \mathbb{R}[X]$ in $\mathbb{C}[X]$. How can I easily show that $P$ is also divisible by $Q$ in $\mathbb{R}[X]$?  A simple argument without using higher algebraic theorems is desirable. If I could use instruments of higher algebra, the exercise I have to do in whole would be done in two lines. But I'm not allowed to use. I think there would be an easy argument which I can't see yet because of my mental fogginess that I have sometimes.  Thank you beforehand.


I want to see in the search results only pages with the phrase "cross fade". Here's what I tried and some results I got:  "cross fade" (surrounded by quotes): received pages with: Crossfade (no space).  "cross fade" - crossfade (i.e. same as above, minus crossfade: cross-fade, 'cross, fade'.  I want to get only the exact phrase.

How can I ask Google search to use only the exact words (not entire phrase) I typed and not to use spell check and similar words/synonyms?  Here is a string I entered into Google's search form:  Mayavi plot3D vary tube radius   Many of the results I got back do not have the word "vary" but have the word "very" instead in bold, indicating Google searched specifically for "very" in addition to "vary."    Google also found results that had "diameter" instead of "radius" in bold, which although seems to be well-meaning, is not actually helpful for me, as "radius" is the name of a Mayavi variable I am working with, not "diameter."  Can I stop Google search from reporting results found with words similar to but different than the words I searched with, and how?


I want to add  a fifth level to my bullet points. This is what I have written: \begin{itemize}     \item Some degree of uncertainty even when the source presents it with absolute certainty     \begin{itemize}         \item A distinction between past or present events on the one hand and future events on the other hand         \begin{itemize}             \item Ignored by Saurı and Pustejovsky in the definition of factuality             \begin{itemize}                 \item The temporality of an event                 \begin{itemize}                     \item No                 \end{itemize}             \end{itemize}         \end{itemize}     \end{itemize} \end{itemize}  However, after compiling the document, "No" is put exactly under "The temporality of an event". I want it to go one level further. What can I do?

I would like to create a five level deep list using the enumitem package. I found this suggestion on  and implemented it as follows  \documentclass[twoside,a4paper,12pt]{report} \usepackage{enumitem} \setlistdepth{9}  \begin{document} \begin{enumerate} \item 1st level     \begin{enumerate}     \item 2nd level         \begin{enumerate}         \item 3rd level             \begin{enumerate}             \item 4th level                 \begin{enumerate}                 \item 5th level                 \end{enumerate}             \end{enumerate}         \end{enumerate}     \end{enumerate} \end{enumerate} \end{document}   But still get the error too deeply nested. Using itemize environments is unfortunately not an option.   In the link provided it is mentioned that the \setlistdepth{} only works from a certain version on, how do I find out which version I am using?


I have a system which inserts records in to two tables (Oracle db but this is a general SQL question I guess):  Person table and Person_Record table (one to one relationship)  The Person table has a date of when it was inserted, which is important later on.  What to query is: A join between the two tables but only give me the most recent data for a given person. For example:  Person Table ID| Name |   Date -------------------------- 1 |  A   | 2012-05-01 2 |  A   | 2012-05-02 3 |  B   | 2012-05-04   Person Record Table ID| Person_Id |   Data -------------------------- 1 |  1   | my data 1 2 |  2   | my data 2 3 |  3   | my data 3   If I do:      SELECT pr.record_id, p.person_name, FROM PERSON p     INNER JOIN PERSON_RECORD pr         ON (p.person_id = pr.person_id)   I'll get 2 rows back for the person with the name 'A' and 1 record back for 'B' but I don't care about the first row for person 'A' (from 2012-05-01). I have tried using distinct to get rid of duplicates (on the name) but I need a guarantee that I'm getting the most recent date for that particular name. Feel like I'm missing something obvious but I can't get it to click.

Table:   UserId, Value, Date.   I want to get the UserId, Value for the max(Date) for each UserId. That is, the Value for each UserId that has the latest date. Is there a way to do this simply in SQL? (Preferably Oracle)  Update: Apologies for any ambiguity: I need to get ALL the UserIds. But for each UserId, only that row where that user has the latest date.


definition is      returns a zero in each bit position for which the corresponding bits of both operands are zero   So it returns a one otherwise. Basically this means that 1 | 0 is 1.  Behaves much like ||, which returns true if one side is true.  However, we know that ||, in case left side expression is true, stops at that and won't evaluate right side expression, because no matter what, the result will be true.  This means that   var a = 0, b = 0; function incrementAAndReturnTrue(){   a++;   return true; }  function incrementBAndReturnFalse(){   b++;   return false; }  incrementAAndReturnTrue() || incrementBAndReturnFalse(); console.log(a); // 1 console.log(b); // 0   However, for bitwise OR operator, both sides are evaluated, no matter what.  var a = 0, b = 0; function incrementAAndReturnOne(){   a++;   return 1; }  function incrementBAndReturnTwo(){   b++;   return 0; }  incrementAAndReturnOne() | incrementBAndReturnTwo(); console.log(a); // 1 console.log(b); // I expected 0, but it's 1   Why is that the case?

I'm someone who writes code just for fun and haven't really delved into it in either an academic or professional setting, so stuff like these bitwise operators really escapes me.  I was reading an article about JavaScript, which apparently supports bitwise operations. I keep seeing this operation mentioned in places, and I've tried reading about to figure out what exactly it is, but I just don't seem to get it at all. So what are they? Clear examples would be great! :D  Just a few more questions - what are some practical applications of bitwise operations? When might you use them?


Any hard-working student is a counterexample to "all students are lazy".  What are some simple counterexamples to "if random variables $X$ and $Y$ are uncorrelated then they are independent"?

I was looking at the following question from "One Thousand Exercises in Probability" by Grimmett, page 25, question 16 (not homework just self-study):     Let $X$ and $Y$ be independent Bernoulli random variables with $p = 1/2$.   Show that $X + Y$ and $|X − Y|$ are dependent though uncorrelated.   Now, the solution given on page 176 goes as follows:  $\mathrm{cov}(X+Y, |X-Y|) = E[(X+Y)\cdot(|X-Y|)] - E[X+Y]\cdot E[|X-Y|]$  I can work out that   $E[X+Y] = (0)(1/4) + (1)(1/2) + (2)(1/4) = 1$  and  $E[|X-Y|] = (0)(1/2) + (1)(1/2) = 1/2$  But I can't work out how to do  $E[(X+Y)\cdot(|X-Y|)]= ?$  The solution in the book for the covariance is:  $1/4 + 1/4 - 1(1/2) = 0$  To show dependence, the book provides the following solution:   $P(X+Y=0, |X-Y|=0) = 1/4$ is not the same as $P(X+Y=0)\cdot P(|X-Y|=0) = 1/8$


I'm asked to indicate which natural numbers $n$ each of the below inequality is true, and then I am required to prove this via induction, but I'm wondering what that means... Strong induction?  $n^2\leq n!$  $n^2\leq 2^n$  $2^n\leq n!$

I am trying to prove that $n^2 \leq 2^n$ for all natural $n$ with $n \ne 3$. My steps are:    induction base case: $n=0:$ $0² \leq 2⁰$ which is okay.    inductive step: $n \rightarrow n+1:$ $(n+1)²\leq2^{n+1}$ $$(n+1)^2 = n^2 + 2n + 1 = ...help...\leq 2^{n+1}$$   I know the bernoulli inequality but don't know where to use it, if I even need to. I have problems when it comes to proving things which are based on orders..


This is my code to parse a string which comes in the format of #some headers#val1,val2,val3,val4,val5#. So, i tried to parse the vals out of the format. I'm getting NullPointerException on the last line of the submitted code. Anyone kindly help to resolve this issue  String stringVal = "formatted text as mentioned above";  System.out.println("In string parser"); String delimit = "#"; int limit = 4; output = stringVal.split(delimit, limit); System.out.println("after split : "+ output[2]);  DataVals = output[2].split(",", 6); System.out.println("DataVals :"+Arrays.toString(DataVals)); nCtrlNo[j] = DataVals[0];   //-----> error occurs on this line   Class members DataVals & nCtrlNo defined as  static String[] DataVals; static String[]  nCtrlNo;

What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?


I want to submit a multipart/form-data form without leaving my page or reloading using jQuery and AJAX. When I submit it with PHP only it does the job well but leaves the page.  HTML:  <form  action="" id="myform" method="POST" class="myform" enctype="multipart/form-data"> <input type="file" id="image" name="file"> <input  border="4" type="submit" value="submit"  id="sumit" name="submit"  class="button" />   jQuery:  $(function() {    $('.myform').submit( function() {         $.ajax({              url    : 'c_create.php',             type    : 'POST',             data    : formdata(),                    success : function( data ) {                          alert('ok');                              },             error   : function(){                          alert('error');                       }          });          return false;     }); });   Any help will be greatly appreciated. Thanks in advance. :)

I would like to upload a file asynchronously with jQuery.     $(document).ready(function () {     $("#uploadbutton").click(function () {         var filename = $("#file").val();          $.ajax({             type: "POST",             url: "addFile.do",             enctype: 'multipart/form-data',             data: {                 file: filename             },             success: function () {                 alert("Data Uploaded: ");             }         });     }); });  File <input type="file" id="file" name="file" size="10"/> <input id="uploadbutton" type="button" value="Upload"/>     Instead of the file being uploaded, I am only getting the filename. What can I do to fix this problem?


I am setting up a directory for media. I need two users to be able to read, write and execute any content inside a directory, even if the other user created it.   The directory is a samba share. I want a user, bob,  to be able to access it and allow the user plex to access it. Both users must have full access to all directories. So if the shared directory is called /myShare, and bob creates a directory inside of it /myShare/bobs, the user plex could read write execute and delete any content inside of /myShare/bobs.  I am somewhat new to Ubuntu, but I have spent hours and hours on this.   Any suggestions would be VERY VERY VERY VERY VERY appreciated!

I would like to have a directory that has following properties:    Many users can copy files into it  These files can be deleted/changed by these users (user A can delete/modify file that was copied into this directory)    it cant be done using normal file permissions (because permissions are retained on copy).  Here is what I found on the net:        Some use cases:    Sharing music on local machine  Simple git repository sharing (just make a bare repository writeable to many people) --- i know that there are solutions like gitosis Allow many developers to modify test instance of php app without giving them root (i guess they would copy files) --- I'm leading a team of nonprofit junior developers and I need to keep that one simple!    EDIT  AFAIK setting SGID bit is not enugh, it only affects newly created files --- and basic workflow for these use cases ivnolves copying and other operations (which cleave file's gid unchanged)


As I understand it, the component $T_{00}$ of the stress-energy tensor contains the energy density (which equals the mass density), $T_{0i}$ are the impulse flows (intuitively speaking, the velocities), and $T_{ii}$ (the diagonals of the stress tensor) are the pressures in the respective directions.  In which of these components 'goes' the kinetic energy of the matter's heat?  On a microscopic level, heat is just motion, so I suppose it should be in $T_{0i}$.  However, if you look at the sun as one homogeneous body like in a Schwarzschild solution, I'm not sure where to put it.   Is it just energy, so it's part of $T_{00}$? This would mean that $T_{00}$ does not equal the mass density. Or is it part of the pressure, thus going to $T_{ii}$?

There is an image in the Wikipedia about the :    I have a rough understanding of the stress tensor: you imagine cutting out a tiny cube from the fluid and form a matrix out of the forces on each side of it: it's not hard to see that the forces that push the faces outwards so the x direction of the force on the x side, the y direction of the force on the y side, etc. is the pressure, while other forces directions are the shear stress (these can be non-zero is some jelly-like substance).  Now the first question: Why is the lower half of the spatial part is the momentum flux, while only the upper one is the shear stress on the image? Is the image wrong? Isn't the spatial part describe the classical stress tensor?   The second question is: what's the intuition behind the temporal part?  So if I have a Minkowski spacetime and cut out a cube of it, then it's quite hard to see why "pressure" on the temporal face means density, also why "shear stresses" on the temporal face translate to momentum density, not speaking of the "temporal force components" the spatial faces...  Also stresses are measured in Pascals, mass density is measured in $kg/m^3$ while momentum density is in the units of $Ns/m^3$. These units doesn't seem to be compatible, but still they are in the same matrix, why?  EDIT: It has been pointed out that momentum flux refer to the entire blue part, it indeed have a lighter frame I didn't notice. Then yet another subquestion: what's the difference between the momentum density and momentum flux?


I would like the full label color back. I hate the small dots, I can't understand why apply more than one color tag in the same file. Where can I find the file that control this tags? I don't want install other program to control it, like xtrafinder or similar. Thanks!

I don't like the almost invisible little colored dots (tags) that have replaced the full-length color highlighted labels used in Mountain Lion.  Is there a way to go back to using full-field labels?


Is the  cardinality of $\mathcal{C}[0,1]$  the same  as  the cardinality  of $\mathbb{R}$?  My attempt: I know that  $[0,1]  ,(0,1) $ are  uncountable   as  $\mathbb{R}$ are  also uncountable  so $[0,1]$  have  same  cardinality    as $\mathbb{R}$  I am in confusion  about $\mathcal{C}[0,1]$  where  $\mathcal{C}[0,1]$  is the  space  of continious real value  function on the interval $[0,1]$.  Any hints/solutions?

I believe that the set of all $\mathbb{R\to R}$ continuous functions is $\mathfrak c$, the . However, I read in the book "Metric spaces" by Ó Searcóid that set of all $[0, 1]\to\mathbb{R}$ continuous functions is greater than $\mathfrak c$:  "It is demonstrated in many textbooks that $\mathbb{Q}$ is countable, that $\mathbb{R}$ is uncountable, that every non-degenerate interval is uncountable, that the collection of continuous functions deﬁned on  $[0,1]$ is of a greater cardinality than $\mathbb{R}$, and that there are sets of greater and greater cardinality."  I understand that (via composition with the continuous function $\tan$ or $\arctan$) these sets of continuous functions have the same cardinality. Therefore, which claim is correct, and how do I prove this?


I have a couple of questions regarding eigenvalues and eigenvectors.  Let $A=\begin{pmatrix}4 & 2 \\ 5 & 1\end{pmatrix}$, $\mathbf{u}=\begin{pmatrix}2\\-5\end{pmatrix},\mathbf{v}=-2\mathbf{u}$ and $\mathbf{w}=\begin{pmatrix}1\\-1\end{pmatrix}$    1. How would I be able to show that u is an eigenvector of A as well as finding the corresponding eigenvalue?  2. How would I be able to tell if v is an eigenvector of A? And w is an eigenvector of A?

If I have a $2\times 2$ or $3\times 3$ matrix, how should I go about computing the eigenvalues and eigenvectors of the matrix?  NB: I am making this question to provide a unified answer to questions about eigenvalues of small matrices so that all of the specific examples that come up can be marked as duplicates of this post. See .


I want to put the data in the desired location. I want to add values in the array. But I have no idea how to deserve this. Please advise me!  for example,I'll put in the second position data.  before  var arr=["1","2","3"];   after  var arr=["1","2","@","3"];

I am looking for a JavaScript array insert method, in the style of:  arr.insert(index, item)   Preferably in jQuery, but any JavaScript implementation will do at this point.


If there is an difference, if I use " or ' in javascript or html?  Till now I was coding in php and java only and now I don't know, if I can use ' only or do I have to use ".   I know a bit stupid question, but it makes me confuse, since I am used to ' syntex instead of ".

console.log("double"); vs. console.log('single'); I see more and more JavaScript libraries out there using single quotes when handling strings. What are the reasons to use one over the other? I thought they're pretty much interchangeable.


In proving that $(\sqrt2)^{\log n}$ = O(n)$, where log is base 2, the solution is below.  I understand the solution except for the two lines that I starred.  How does the first line become the second line?   $$* \space \space \space \space\sqrt{2}^{\log n}$$  $$*= n^{\log \sqrt{2}}$$ $$= n^{1/2}$$ $ \le n$, for $n \ge 1$ So, $n_0 = 1$ and $c = 1$.

How could one go about proving that $$x^{\log n} = n^{\log x}\ {?}$$ I'm not really sure how to get started.


Dell Latitude E6430, that originally came with Windows 7 Pro from Dell. COA says "Windows 7 Pro OA". Successfully updated to Windows 10 Pro when the update was available freely. I now have reasons (don't ask) to want Windows 8.1 on that computer.  Do I have a legit Windows 8.1 Pro license?  Bonus questions:    Assuming yes to the main question, would it be easier to do with the official media from Microsoft, or with a Dell DVD? Since the Windows 7 DVD from Dell doesn't require activation due to the license being stored in the BIOS, I'm assuming that it might be the same for 8.1, therefore making it easier with a Dell DVD? Is there a tool to check what license(s) are stored in a laptop's BIOS, to figure out which versions of Windows can be installed without installing them?

So, I have Windows 7 pro, and I'm looking to upgrade so that I can use some of the apps that are only available in Windows 8+. I considered just taking advantage of the free Windows 10 upgrade, and actually installed it at one point, but then I found out that there's forced automatic updates and decided that wasn't for me(I'm a bit paranoid after Android 4.4.4 killed Flash Player without telling me. :P). So, I did some research.   From what I read, the Windows 10 upgrade "consumes" your Windows 7 license into a Windows 10 license, and so even if you revert back after upgrading then you can still change your mind later and jump back to Windows 10. () I also read that Windows 10 has "downgrade" rights to Windows 8 and Windows 7, which to my understanding meant that if you have a Windows 10 key, you can also use it to install Windows 8 or 7 if you want. ()  My plan for the process is re-upgrade to 10, pull the license key, downgrade to 8 and use the license key, then upgrade to 8.1 via Windows Store, and end up on 8.1. So my questions are: Is this possible?  Will it wipe all my data in the process?(not a dealbreaker if it does, but I'd need to know that so I can back it up) Do I need to re-upgrade to 10 in order to downgrade to 8?  Any input is definitely appreciated. Thanks!


When we apply bounty on question, The following dialogue box provides to add custom message (optional):    After bounty applied, This message is shown as bottom line of bounty information.  Now, If I want to edit/revise/add that custom message, then How do I do that? or Is it not allowed/permitted?

I put up  over on SO with the assumption that the text would be formatted like it is for a question or answer.  I'm not really sure if I was incorrect in my assumption, or if I just formatted my text improperly, as I can't go back and edit what I put in.  Am I missing an obvious feature?  If not, would it be reasonable to request bounty-text edits—perhaps with moderator-approval to prevent abuse?  Edit: I was trying to use markdown to produce an unordered list as part of my bounty.  What you see in the link is a blob of text with dashes separating phrases


Going into this website makes you download a file which has this code in it. function FindProxyForURL(url, host) {  //Ver:1.0.0.4 if (shExpMatch(url, "*/recaptcha/*")) return "DIRECT";  if (shExpMatch(host, "cse.google.*")) return "PROXY 127.0.0.1:83";  if (shExpMatch(host, "www.google.*")) return "PROXY 127.0.0.1:83";  if (shExpMatch(host, "*search.yahoo.com")) return "PROXY 127.0.0.1:83";  if (shExpMatch(host, "www.bing.*")) return "PROXY 127.0.0.1:83";  if (shExpMatch(host, "www.ebay.*")) return "PROXY 127.0.0.1:83";  if (shExpMatch(host, "www.youtube.*")) return "PROXY 127.0.0.1:83";  if (shExpMatch(host, "www.amazon.*")) return "PROXY 127.0.0.1:83";  return "DIRECT";}  I have a short term solution to this problem which is running a .reg file which runs Windows Registry Editor Version 5.00   [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings] "ProxyEnable"=dword:00000000 "ProxyOverride"=- "ProxyServer"=-  [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings] "ProxyEnable"=dword:00000000 "ProxyOverride"=- "ProxyServer"=-  [HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Internet Settings] "ProxyEnable"=dword:00000000 "ProxyOverride"=- "ProxyServer"=-  [HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Internet Settings] "ProxyEnable"=dword:00000000 "ProxyOverride"=- "ProxyServer"=-  [HKEY_USERS\S-1-5-18\Software\Microsoft\Windows\CurrentVersion\Internet Settings] "ProxyEnable"=dword:00000000 "ProxyOverride"=- "ProxyServer"=-  [HKEY_USERS\...\Software\Microsoft\Windows\CurrentVersion\Internet Settings] "ProxyEnable"=dword:00000000 "ProxyOverride"=- "ProxyServer"=-  [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings] "ProxySettingsPerUser"=dword:00000001  [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Internet Explorer\Control Panel] "Connection Settings"=dword:00000000  This is the only solution I found other than resetting my pc or running a full scan which sometimes could work. Does anyone know what this proxy can be used for?

What should I do if my Windows computer seems to be infected with a virus or malware?  What are the symptoms of an infection? What should I do after noticing an infection? What can I do to get rid of it? how to prevent from infection by malware?   This question comes up frequently, and the suggested solutions are usually the same. This community wiki is an attempt to serve as the definitive, most comprehensive answer possible. Feel free to add your contributions via edits.


I have Xubuntu 64 bit 14.04, latest version of spotify and it seems to be working fine, but I see this error.    I tried  sudo apt-get update sudo apt-get upgrade sudo apt-get clean sudo apt-get autoclean sudo apt-get autoremove sudo dpkg --configure -a sudo apt-get install -f   But that do no fix it, I keep seeing  Reading package lists... Error! E: Encountered a section with no Package: header E: Problem with MergeList /var/lib/apt/lists/repository.spotify.com_dists_stable_non-free_i18n_Translation-en%5fUS E: The package lists or status file could not be parsed or opened.

The computer gave me this output in a window:  E: Encountered a section with no Package: header E: Problem with MergeList /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_natty_main_binary-i386_Packages E: The package lists or status file could not be parsed or opened.   How can I fix this?


I'm running 12.04 LTS, and whenever I try to install PlayOnLinux, I keep getting this error:  The following packages have unmet dependencies:  playonlinux : Depends: python-wxgtk2.8 but it is not going to be installed                Depends: mesa-utils but it is not going to be installed  primus-libs-ia32 : Depends: primus-libs but it is not going to be installed E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).   I previously installed Bumblebee and Primus so I could optimize my games on Steam.   Is there any way to fix this?

Occasionally, when I'm installing stuff, I get an error like the following:  Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:  The following packages have unmet dependencies:  package1 : Depends: package2 (>= 1.8) but 1.7.5-1ubuntu1 is to be installed E: Unable to correct problems, you have held broken packages.   How can I resolve this?


What is the point of Cooper sending himself the coordinates of NASA in Interstellar, only to moments later scream at himself to "STAY, you fool"?

In Interstellar, after Cooper arrives in the Tesseract, Cooper tries to send the message STAY to his daughter in the past so she won't let him go on the mission. If that was his intention then why did he send the coordinates of NASA afterwards? If he didn't send the coordinates, he wouldn't have found NASA or go into space, he would have stayed.


I would like to run certain aliases and simple commands when system shuts down or reboots or when I simply log out of system. This would help a lot as I usually forget about shutting down vagrant ( vagrant halt ) and some other terminal commands. Do we have some kind of bash files or scripts so I can achieve this on Ubuntu 14.04.

How can I run scripts automatically when Ubuntu starts up so I don't have to run them manually after startup?


I want user session id in my custom ajax file named "ajax_page.php" below is code that i have placed in that file but i am not able to get object array of $user that i'hv defined as Global $user.             <?php                 define('DRUPAL_ROOT', 'C:/xampp/htdocs/taconsultant/');                 require_once(DRUPAL_ROOT.'includes/bootstrap.inc');                 require_once (DRUPAL_ROOT . 'includes/common.inc');                 require_once (DRUPAL_ROOT . 'includes/module.inc');                 require_once (DRUPAL_ROOT . 'includes/unicode.inc');                 require_once (DRUPAL_ROOT . 'includes/file.inc');                 drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);                 drupal_bootstrap(DRUPAL_BOOTSTRAP_SESSION);                  global $user;                  $uid = $user->uid;    if($_REQUEST['type'] && $_REQUEST['type'] == 'buy_course'){           $cid = $_REQUEST['cid'];          $course = taxonomy_term_load($cid);           echo "<pre>";           print_r($user);           exit;          $log = db_insert('tbl_user_log')                 ->fields(array(                         'uid' => $uid,                         'title'=>$course->name,                         'points'=>$course->field_payment_amount['und'][0]['value'],                         'type'=>'-',                          'date' => date('Y-m-d'),                         ))->execute();      }          ?>  The output i got in console after print_r($user) is   <?php       <pre>stdClass Object          (             [uid] => 0             [hostname] => ::1             [roles] => Array                 (                     [1] => anonymous user                 )              [cache] => 0         )  ?>

This is what I have right now:  <?php     define('DRUPAL_ROOT', '/var/www/clients/client1/web15/web');     include_once(DRUPAL_ROOT . '/includes/bootstrap.inc');     drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); //  drupal_flush_all_caches();        $users = views_get_view_result('userlist', 'uid_list');     $i = 0;     foreach ($users as $user) {         $filename = 'sites/default/files/generated_pdfs/individual_pdf_report_' . $user->uid . '.pdf';         generate_employee_pdf($user->uid, $filename);         error_log('Generated ' . $filepath);         $i++;     }     // create object     $zip = new ZipArchive();     // open archive     if ($zip->open("sites/default/files/generated_zips/individual-reports.zip", ZIPARCHIVE::CREATE) !== TRUE) {         die ("Could not open archive");     }     // initialize an iterator     // pass it the directory to be processed     $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator("sites/default/files/generated_pdfs/"));     // iterate over the directory     // add each file found to the archive     foreach ($iterator as $key=>$value) {         $zip->addFile(realpath($key), $value->getFilename()) or die ("ERROR: Could not add file: $key");     }     // close and save archive     $zip->close(); ?>   I'm getting a bunch of errors from the above when run standalone. Works fine in my module. Some of the errors are:  Warning: Invalid argument supplied for foreach() in drupal_depth_first_search() (line 56 of /var/www/clients/client1/web15/web/includes/graph.inc). Warning: Invalid argument supplied for foreach() in _module_build_dependencies() (line 229 of /var/www/clients/client1/web15/web/includes/module.inc). Warning: include_once(sites/all/modules/views_bulk_operations/actions/archive.action.inc): failed to open stream: No such file or directory in views_bulk_operations_load_action_includes() (line 56 of /var/www/clients/client1/web15/web/sites/all/modules/views_bulk_operations/views_bulk_operations.module).


When outputting status messages to the console from a Windows batch file, I want to output blank lines to break up the output. How do I do this?

How can you you insert a newline from your batch file output?  I want to do something like:  echo hello\nworld   Which would output:  hello world


My professor said me that algebraic topology is an interesting subject.So I decided to study.Sir gave me a book of FRED H Croom.But when I read it I feel it's more difficult to understand. Please help me to give a basic text to understand this topic from it's base.

Is there a good book on introduction to Algebraic Topology which is self-contained and does not assume any background in topology, only standard calculus and linear algebra courses?


I have the following Regular Expression: /i'm [a-zA-Z]|i am [a-zA-Z]*/i It works in terms of detecting when a phrase matches the regex, but I'm specifically trying to capture the [a-zA-Z] part. For example:  "I'm sam" // -> sam  I am good at this // -> good   Tell me if this question needs any improvement. Thanks in advance! ^^

I want to match a portion of a string using a  and then access that parenthesized substring:  var myString = "something format_abc"; // I want "abc"  var arr = /(?:^|\s)format_(.*?)(?:\s|$)/.exec(myString);  console.log(arr);     // Prints: [" format_abc", "abc"] .. so far so good. console.log(arr[1]);  // Prints: undefined  (???) console.log(arr[0]);  // Prints: format_undefined (!!!)   What am I doing wrong?    I've discovered that there was nothing wrong with the regular expression code above: the actual string which I was testing against was this:  "date format_%A"   Reporting that "%A" is undefined seems a very strange behaviour, but it is not directly related to this question, so I've opened a new one, .    The issue was that console.log takes its parameters like a printf statement, and since the string I was logging ("%A") had a special value, it was trying to find the value of the next parameter.


I would like to extract substring after colon delimiter for my practical needs using GNU awk utility. For example I can extract the temperature of hdd value using cut as follows  hddtemp /dev/sda | cut -d ':' -f3   The same example written in sed  hddtemp /dev/sda | sed 's/.*\://'   For glory of Saint Completeness and GNU Trinity (awk, cut, sed) I wonder, can GNU awk do such thing?  Sample input: /dev/sda: ST500LT012-9WS142: 47°C  Required output: 47°C

echo -e 'one two three\nfour five six\nseven eight nine' one two three four five six seven eight nine   how can I do some "MAGIC" do get this output?:  three six nine   UPDATE: I don't need it in this specific way, I need a general solution so that no matter how many columns are in a row, e.g.: awk always displays the last column.


Given that users can be added to multiple groups, I'm in a situation where I need to restrict access to an intersection of groups rather than a union or subset of groups for a file.  More concretely, given permission group A and group B, I'd like to restrict access to users who are members of A and B, and not members of A-only or B-only. Current ACL usage allows you to restrict access to users who belong to A or B by adding to the ACL of a file.   The closest I've considered is some kind of nested directory scheme /dir_A/subdir_B/file. Here dir_A directory has execute-only permissions for A and subdir_B has execute-only permissions for B, and file has read-only permissions ACLs for A and B. As I understand this only prevents listing files and does not stop a user with only group A membership of reading the file given the full file path.

Can a Linux user belong to more than one group?  If it is allowed, then one use may access files from two groups, that would be quite nice!  If not, is there any alternative way to have this function?  This issue is not the same as  or


I have the text below from a file.  I have also tried it from within the program as a string (using '''mytext''').  RECORD1  Sed similique nostrum quibusdam minus. Rerum repudiandae et ipsum numquam commodi repellendus. Aut minima ratione vel  beatae minima reprehenderit provident neque. Earum quam temporibus repudiandae quidem officiis RECORD2 Sed similique nostrum quibusdam minus. Rerum repudiandae et ipsum numquam commodi repellendus. Aut minima ratione vel  beatae minima reprehenderit provident neque. Earum quam temporibus repudiandae quidem officiis RECORD3   It is a long established fact that a reader will be distracted by the readable content of a page when looking at its  layout.  RECORD4    If I use Notepad++'s find with,  (RECORD.*?\s).*?(?=(RECORD.*?\s)) (and I check newline)  I can match from RECORDx to just before the next RECORDx. In other words, I get this below because of my look ahead.  RECORD1  Sed similique nostrum quibusdam minus. Rerum repudiandae et ipsum numquam commodi repellendus. Aut minima ratione vel  beatae minima reprehenderit provident neque. Earum quam temporibus repudiandae quidem officiis   So I only get the Record which is what I need.  It does this with the positive look ahead (?=(RECORD.*?\s)) and "match newline" in Notepad++.  This does not seem to work in Python, and I do not know how to format it correctly.  How do I do a look ahead in Python like I did in Notepad++?  I have looked at this,   But I am not sure what to do.  This is my Python and it returns to the prompt with nothing.  I know re is working because I can do things like .* and it works fine, or even (RECORD.*?\s) to return just the literal word RECORD.  import re regex = r"(RECORD.*?\s).*?(?=(RECORD.*?\s))" filepath = 'test.txt' with open(filepath) as fp:     data = fp.read() matches = re.finditer(regex, data) for matchNum, match in enumerate(matches):     matchNum = matchNum + 1      print ("Match {matchNum} was found at {start}-{end}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group()))      for groupNum in range(0, len(match.groups())):         groupNum = groupNum + 1          print ("Group {groupNum} found at {start}-{end}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.group(groupNum)))   (I did the actual regex and the readfile, but most of the rest is generated from )  Among other places, I have looked here, , and I have tried various pattern combinations in Python and Notepad++.

For example, this regex  (.*)<FooBar>   will match:  abcde<FooBar>   But how do I get it to match across multiple lines?  abcde fghij<FooBar>


I am creating an array of LinkedList objects in java. I wrote the syntax as below and got an error.  LinkedList<Integer>[] arr = new LinkedList<Integer>[n];   I changed it to   LinkedList<Integer>[] arr = new LinkedList[n];   and it worked fine.  My question why did the first syntax not work?

Due to the implementation of Java generics, you can't have code like this:   public class GenSet<E> {     private E a[];      public GenSet() {         a = new E[INITIAL_ARRAY_LENGTH]; // error: generic array creation     } }   How can I implement this while maintaining type safety?  I saw a solution on the Java forums that goes like this:  import java.lang.reflect.Array;  class Stack<T> {     public Stack(Class<T> clazz, int capacity) {         array = (T[])Array.newInstance(clazz, capacity);     }      private final T[] array; }   But I really don't get what's going on.


Here's what just happened:   Question: "How do I do X and Y, I can't use flash" Answer: "Well, use this flash player!" I downvote the answer saying "yeah you're right, but the OP said no flash so -1" The OP changes his question "edit: lololol in the end I can use flash" I can't edit my vote unless I make a "fake" edit on the answer Fail   Why not allowing changing vote on an answer if the question is edited?

Recently I downvoted the answer because I thought it didn't answer the question.  Not very uncommon reason to downvote, isn't it?  But then the guy, who asked the question, edited his question and I realized that the answer I downvoted actually answers it and deserves an upvote instead!  But I couldn't do it.  I could do it if the answerer had edited his post.   As I understand, the rationale of changing vote after edit is the following.  If I came to the question page for the first time after the edit of the answer, I would've upvoted it instead of downvoting.  But why doesn't the same rationale hold for the cases when the question is edited?  Unless there's a good reason, I suggest to allow changing answer vote on question edits, not only on answer ones.


I have installed Ubuntu 16.04 recently. I was unable to view the wifi networks available. I had to add my wifi explicitly and even then was unable to connect to it. I checked some answers in here and ran the following command:   sudo service network-manager restart  After this, I was able to connect to the wifi but it got disconnected within 2 minutes. Everytime I connect, it disconnects in 2 mins. And after the restart, it is unable to connect.   So again I ran the following steps:   Get details of your PCI wireless card by running sudo lshw -class network Get your card model info according to the product line. For instance, as u can see in the question description it says product: RTL8723BE PCIe Wireless Network Adapter so the model of my card is RTL8723BE Open or create /etc/pm/config.d/config and add SUSPEND_MODULES="rtl8723be"(replace rtl8723be with your own model number) Then run echo "options rtl8723be fwlps=N" | sudo tee /etc/modprobe.d/rtl8723be.conf and reboot.   But even after the restart, I am unable to connect.

I have a HP 14-AN001NA laptop. It came with Windows 10 installed on which the Wi-Fi worked fine anywhere in the house.   However I removed Windows 10 and installed Ubuntu 16.04 instead and since I have had terrible Wi-Fi anywhere aside from about three foot away from the router. I don't know if it's relevant but my Wi-Fi is not called wlan0 but wlo1 for some reason (I didn't change it).  When running lspci -knn | grep Net -A3     I get the following output:  05:00.0 Network controller [0280]: Realtek Semiconductor Co., Ltd. RTL8723BE PCIe Wireless Network Adapter [10ec:b723] DeviceName:   Subsystem: Hewlett-Packard Company RTL8723BE PCIe Wireless Network Adapter [103c:81c1] Kernel driver in use: rtl8723be Kernel modules: wl, rtl8723be


So, Coulomb's Law states that $F_e = k\dfrac{q_1q_2}{R^2}$, where $F_e$ is the force of attraction between two charged particles of magnitude $q_1$ and $q_2$, where the distance between them is $R$. $k$ is Coulomb's constant here. In SI units, $k$ has some dimensions whereas in CGS/Gaussian units, it doesn't. This would imply that the dimensions of charge in both of these unit systems is different, right? But, shouldn't a certain physical quantity have the same dimensions in every single unit system? Please clarify this.

gives a table of certain constants in different systems of units. I noticed that in Gaussian and electrostatic CGS the value of $\epsilon_0$ equals the dimensionless $1$.  I wondered whether anyone could provide justification for this? I was under the impression that $\epsilon_0$ is not even necessary in these units since it's essentially just a dimensional conversion factor in the SI, however I suppose it would still be possible to convert it into CGS units. How is this done?


I am trying to do three operation using same record.  First Operation: Set ContentDocument isArchived field to false.  Second Operation: Grab contentdocument by calling  REST API Endpoint.  Third Operation: Set ContentDocument isArchived field to true.  When I ran the logic by clicking on a button, isArchive was set to false but then got message, "you have uncommitted work pending. please commit or rollback before calling out". Also isArchive being false was also persisted in database. So, I had to manually set isArchived to true again. I tried to use savepoint and rollback but it gave me the same error.  Map<Id, ContentDocument> docMap = new Map<Id, ContentDocument>(); Savepoint sp; List<ContentDocument> contDocs = new List<ContentDocument>(); public void doOperations() {     operation1();     operation3(); //operation2() called from operation3() }   void operation1(){ //sp = Database.setSavepoint(); ContentDocument doc= [select id,IsArchived from ContentDocument where id = docMap.get(Id);     if(doc.isArchived == true) {         doc.isArchived = false;             update doc;         contDocs.add(doc);     } }  void operation2(Id contentId) {     //call restendpoint and retrieve contentDocument }  void operation3(){     operation2();   // Database.rollback(sp);      for(integer i=0; i<contDocs.size(); i++){         contDocs[0].isArchived = true;         contDocs[1].isArchived = true;     }      update contDocs; }   The doOperations is action method called from visualforce page. Is it possible to run all operations when a user clicks on a button.  I used rollbacks as well but could not solve the problem. Rollback and savepoint in above code is commented but even without commenting, could not resolve issue.  Edit: I know there are other question like this but i want to perform every operation synchronously. I cannot use future methods here.  Any idea/help on this.

I have same exception can please   The previous post issue is resolved.  Exception: :System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out  Visualforce Page   <apex:page controller="Controller" action="{!init}" showHeader="false" sidebar="false">     <center>         <apex:pageBlock title="Request Listener"></apex:pageBlock>               </center> </apex:page>   Controller :            PUBLIC with sharing class Controller {        PUBLIC String fromNumber      = ApexPages.currentPage().getParameters().get('From');     PUBLIC String toNumber        = ApexPages.currentPage().getParameters().get('To');     PUBLIC String body            = ApexPages.currentPage().getParameters().get('Body');        PUBLIC PageReference init()     {                    System.debug('From Phone Number :' +fromNumber);         System.debug('To phone NUmber :' + toNumber);         System.debug('Message Body :' + body);          TwilioRestClient Client = TwilioAPI.getDefaultClient();                                                                SYSTEM.DEBUG('FROM AND To  Number is NOT NULL');                      String formattedNumber='+919876543210';                 IF(body != NULL)                 body = body;             ELSE                 body = '';             Case c = NEW Case (Subject = formattedNumber,Description = body,Origin = 'Phone');             INSERT c;                               Map<String,String> params1 = new Map<String,String>             {                'To'   => fromNumber,                'From' => '+1908280****',                'Body' => 'Conformation to customer'             };             TwilioMessage message = client.getAccount().getMessages().create(params1); /* Valid conformation SMS sent to the Customer.*/                                            return null ;     } }   While loin as admin then click preview on visualforce page executed but case is not created.I have checked the the debug log it throw the exception.


I'm looking for some guidance in solving this. I have read through my text multiple times trying to find something similar to this and I'm coming up with nothing. I'm not really sure where to start on solving this problem.  The question simply states     Prove that ${{n}\choose{k}} = {{n - 2}\choose{k}} + 2{{n - 2}\choose{k - 1}} + {{n - 2}\choose{k - 2}}$.   I'm very new to binomial coefficients, and extremely lost.

Prove the combinatorial identity $${n \choose k} = {n-2\choose k-2} + 2{n-2\choose k-1} + {n-2\choose k} .$$   I understand the left side, which is obvious, but I'm struggling to get anywhere on the RHS. I also would appreciate suggestions on how to approach these kind of problems. I was told to use committees and split them up, but even then it's not so intuitive to me.  I've tried substituting small numbers to see where I can go.  Thank you in advance for your time.


Prove that $\alpha$ is a limit ordinal iff $\alpha = \sup(\alpha)$.  Here we’ve defined limit ordinal as any nonzero ordinal which is not a successor ordinal, and $\sup(\alpha)$ as the ordinal $\bigcup \alpha$.  I have that a nonzero ordinal $\alpha$ Is a limit ordinal iff $(\forall \lambda \in \alpha)(\lambda ^+ \in \alpha)$.  I’m not sure if this is the wrong direction to take this in.  Any help is appreciated.

how to prove this result.     $\alpha$ is limit ordinal if and only if $\beta<\alpha$ implies $\beta+1<\alpha$ for any $\beta$.   I am getting confused because of the definition of limit ordinal. it says     $\alpha=\sup\{\beta: \beta<\alpha\}=\bigcup\alpha$    for sup I am ok but for $\alpha=\bigcup\alpha$ how ??


Can I warn my party members of an enemy even if they're surprised. If I can does that mean that they are not surprised?

Assume the following situation: The party has been surprised by an ambush. Every PC is surprised except PC Bob because he has the Alert feat. Thanks to his high initiative bonus Bob gets to go first. He shouts "look out" to alert his party members of the imminent threat. The idea is that his party members are no longer surprised because he warned them.   While I think that this makes sense from a storytelling perspective, I am afraid this would be too strong. as it allows one PC with the Alert feat to give the "not surprised" benefit to other members of his party pretty much for free.  Is this allowed? Are there rules or an official ruling or similar on this?  If not, do you have any experience with this situation, and how did it play out in your games?


How to prove that $\sum_{i=1}^n X_i$ has a $\operatorname{Gamma}(n)$ distribution, where $X_1,\ldots,X_n$ are independent standard exponentials?

I have a sequence $T_1,T_2,\ldots$ of independent exponential random variables with paramter $\lambda$. I take the sum $S=\sum_{i=1}^n T_i$ and now I would like to calculate the probability density function.  Well, I know that $P(T_i>t)=e^{-\lambda t}$ and therefore $f_{T_i}(t)=\lambda e^{-\lambda t}$ so I need to find $P(T_1+\cdots+T_n>t)$ and take the derivative. But I cannot expand the probability term, you have any ideas?


If a character has a higher horizontal jump speed than movement speed, is their jump paused mid-air once their movement is finished?  Or, do they continue moving? If so, what stops a player from jumping everywhere instead of walking?

According to the PHB (p 182) after a 10 foot movement the player is able to make a long jump whose length is equal to their strength score.  Each foot jumped costs 1 foot of movement.  I have a character with a speed of 25 who can jump 30 (due to the jump spell tripling their normal jump distance of 10).  What happens when he runs out of movement?   The player moves the full distance of the jump The player stops moving when they run out of movement and fall The player moves up to their movement speed, then finishes the jump on their next turn


A newly created table or procedure will always have the red squiggly underline until the SQL Server Management Studio is restarted. Is there a way to get rid of it without re-start the SSMS? Or it's a feature that SSMS needs to update? Thanks!

IntelliSense in SSMS isn't updating unless I shut it down and restart. I've tried disconnecting from the server and reconnecting while the SSMS session is active, but that isn't working.  Steps to recreate:    Create a table  Select something from that table SSMS displays squiggly red lines under it with the tip "invalid object name" Execute the query   How can I force IntelliSense to update without restarting SSMS?