This is a programming problem I come across very often and was wondering whether there is a data structure, either in the C++ STL or one I can implement myself which provides both random and sequential access.  An example of why I might need this:   Say there are n types of items, (n = 1000000, for example), and there's a fixed number of each type of item (for example, 0 or 10) I store these items into an array, where the array index represents the type of the item, and the value represents how many items of that given type are there Now, I have an algorithm which iterates over all EXISTING items. To obtain these items, it is very wasteful to iterate over the entire array when all the entries are 0, except for i.e. Array[99999] and Array[999999].   Normally, I solve this by using a linked list which saves the indices of all the nonzero array entries. I implement the standard operations in this way:  Insert(int t):   1) If Array[t] == 0, LinkedList.push_back(t);  2) Array[t]++;  Delete(int t):  1) If Array[t] == 1, find and remove t from LinkedList;  2) Array[t]--;  If I want O(1) complexity for the deletion operation, I make the array store containers instead of integers. Each container contains an integer and a pointer to the respective element of the LinkedList, so I don't have to search through the list.  I would love to know whether there is a data structure which formalizes/improves this approach, or whether there's a better way to do this altogether.

I've been reading up on STL containers in my book on C++, specifically the section on the STL and its containers. Now I do understand each and every one of them have their own specific properties, and I'm close to memorizing all of them... But what I do not yet grasp is in which scenario each of them is used.  What is the explanation? Example code is much prefered.


Glass is a very fragile object. So why does not the optical fiber break? Everytime I take them, I am worried about this problem.

Why can one bend glass fibers without breaking it, whereas glasses one comes across in real life is usually solid?  Is there also a good high-school level explanation of this?


I hope the title in itself is clear, if not allow me to give an example.  In Class my Professor did the following:     Given a sequence $(X_n)_{n \in \mathbb{N}}$ of non-negative i.i.d. RV $X_n \sim X$ with $E(X)< \infty$ then $\frac{X_n}{n} \to 0 $ almost surely   To prove this, it is easy to show that $\sum P (X_n/n > \epsilon) < \infty$ and thus conclude by Borel-Cantelli Lemma that $$P ( \limsup \lbrace X_n/n > \epsilon \rbrace ) =0 \iff P ( \lim \inf \lbrace X_n /n \leq \epsilon \rbrace )=1 $$ But one indeed looks for the answer that $\exists \Lambda \subset \Omega$ with $P( \Lambda)=1$ and for all realizations $\omega \in \Lambda$ we have that $X_n(\omega)/n \to 0$.  In the question  Daniel Fischer gives an answer on how to get an inclusion of the form $\liminf \lbrace ... \rbrace \subset \lbrace \limsup ... \rbrace$.   I do believe that he makes use of the (complementary) statement which says that for $\epsilon >0$ $$ \lbrace \lim \sup | X_n - X| > \epsilon \rbrace \subset \lim \sup \lbrace | X_n -X | \geq \epsilon \rbrace \subset \lbrace \lim \sup |X_n - X | \geq \epsilon \rbrace \tag{*} $$ which gives $$ \lbrace \lim \sup |X_n -X | < \epsilon \rbrace \subset \lim \inf \lbrace | X_n - X | < \epsilon \rbrace \subset \lbrace \lim \sup |X_n -X | \leq \epsilon \rbrace $$    My question(s): 1) Are there more chains of inclusions as in (*) that I should know in order to give statements about the $\limsup$ or $\liminf$ of sequence of Random Variables rather than the $\limsup,  \liminf$ of the sequence of Events?  2) In the above chain of inclusions, does the $\epsilon >0$  on $k$? The Definition gives $$\limsup \lbrace X_n/n > \epsilon \rbrace = \bigcap_{n=0}^\infty \bigcup_{k=n} A_k \text{ where } A_k:= \lbrace X_k/k > \epsilon \rbrace $$ so intuitively I would say that $\epsilon=\epsilon(k)$ varies as $k$ increases.   3) Are there any general techniques you'd recommend to make a statement about the limit of a sequence of random variables using Borel-Cantelli Lemmas?

I care to understand the concept behind the Borel-Cantelli Lemma better, hence I would appreciate it if someone could take the time to check if my arguments below are clear and rigorous.     Statement: Let $(X_n)_{n \geq 1}$ be a sequence of non-negative random variables that are identically distributed $X_n \sim X \geq 0 $ with $E(X)< \infty$, show that $ X_n/n \to 0$ almost surely     Proof: Since $X_n \sim X$ for some non negative random variables we can easily compute that for $\epsilon >0$ we have $$ \infty>E(X/\epsilon) = \int_0^\infty P(X/ \epsilon > t) dt = \sum_{n=1}^\infty \int_{n-1}^n P(X/ \epsilon > t ) dt \geq \sum_{n=1}^{\infty} P(X/ \epsilon >n) $$ Thanks to the Borel-Cantelli Lemma we obtain that $$ P ( \limsup_{n \to \infty} \lbrace X_n/n > \epsilon \rbrace ) = 0 \iff P ( \liminf_{n \to \infty} \lbrace X_n/n \leq \epsilon \rbrace) = 1 $$     Question: Does the $\epsilon$ in the above depend on $k$?   I think it does and I would argue as follows $$P( \liminf_{n \to \infty} \lbrace X_n/n \leq \epsilon \rbrace )= P  \left( \bigcup_{n=0}^\infty \bigcap_{k=n}  \lbrace X_k/k \leq \epsilon (k) \rbrace \right) $$ Now using the chain of inclusions that state that we have for $\epsilon >0$  $$ \lbrace \limsup |X_n-X| < \epsilon \rbrace \subset \liminf \lbrace |X_n-X| < \epsilon \rbrace \subset \lbrace \limsup |X_n-X| \leq \epsilon \rbrace $$ We conclude that $$ P ( \lbrace \limsup_{n \to \infty } X_n/ n \leq \epsilon(k) \rbrace)=1 $$ Where I choose the same $k \in \mathbb{N}$ as above, and then choose $k^*$ large enough such that $\epsilon(k) \leq \frac{1}{k^*}$, define the set $$ \Lambda_{k^*}:= \lbrace \limsup_{n \to \infty} X_n/n \leq 1/k^* \rbrace \implies P(\Lambda_{k^*})=1$$ and also we obtain that $\Lambda:=\bigcap_{j \geq k^*} \Lambda_{k^*}$ is still an almost sure event, i.e. $P(\Lambda)=1$ but for all realizations $\omega \in \Lambda$ we have $\limsup_{n \to \infty} X_n( \omega)/n \leq 0  \implies X_n( \omega)/n \to 0$ for all $\omega \in \Lambda$ that is$X_n/n \to 0$ almost surely $\Box$  Are my arguments given above correct and more importantly complete? Are there steps where you'd use different arguments?


I have a JTable that I add rows to by hit of a button after the user fills out the text fields. What I want to do is make sure that they will not have two rows with the same ID. I attempted to do this by using a while statement to compare there entered value to all values in that column of the JTable. The problem is that even if the String is the same value the program says they are not. I will post my code below. If you have any questions feel free to ask and thanks for the help.  addRow.addActionListener(new ActionListener()      {         @Override         public void actionPerformed(ActionEvent e)          {             DefaultTableModel model = (DefaultTableModel) database.getModel();              boolean error = false;             String test = "";             int row = 0;              while(row < rowCount && rowCount > 0)             {                 test = model.getValueAt(row, 2).toString();                 if(test != IDTF.getText().toString())                 {                     row++;                 }                 else                 {                     error = true;                     break;                 }             }              if(priceITF.CheckErrorCode() == false && error == false)             {                 model.addRow(new Object[]{customerTF.getText().toString(),partNumTF.getText().toString(),                         IDTF.getText().toString(),priceITF.getText().toString(),delete});                 System.out.println(model.getValueAt(row, 2).toString());                 rowCount++;             }             else             {                 System.out.println("Error");             }         }     });

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?


I've used QGIS's Polygonize to convert the following raster into outlines. The polygonize tool does produce a vector output, but it isn't in plain polygon form but some thousands of single pixel polygons.     I understand that this is the expected behavior of the Polygonize tool and one can now simplify these weird squares for it to just be two polygons - one for brown and one for purple. I tried setting a really low threshold of 0.000001 for v.generalize (in the Processing toolbox) for these shapes to be converted into a line and yet there seems to be no improvement. The documentation of v.generalize did not seem too useful.   How does one go about making this into two plain polygons?

I have a pdf with the area of a county that I want to separate into multiple shapefiles (polygons) based on color.   As shown in the first picture there are 4 colors so I would need to separate based on color between those four. But first, I need to convert it into a vector (unless there is an easier way).   Doing so, I get the second image as an output by using the polygonize tool which when zoomed in very close, has a lot of tiny squares where color should be different. I was wondering if there is a way to break a raster up by color even though the image isn't smart.


I've tried holding the back button, turning off body armor and all that, and there's no option in my house to take it off. I have no physical body armor for protection and it is really hard to see my crew emblem this way.

It's kind of hard to shop for clothes with a big bullet proof vest on.  Is there a way to take off the armor after missions, or at least hide it?


I have a model of a building with a sidewalk around it.  Both show up when I switch to rendering mode in both Blender Render and Cycles Render mode.  But:  when I hit F12 for a final proper render, the building shows up -- but the sidewalk doesn't.    I've checked the normals and I thought the normals seemed pointed in the right direction.  I've set the Clipping on the Camera to a high number.  I removed all the materials from the sidewalk and added a new material-- the problem persists.  I've exported the blend as an FBX file and the Sidewalk shows up fine in Unity.  Just in final renders, it doesn't show up.    Here is a blend file: .  I tried to destroy everything unrelated to the issue and label things in a clear way.    Thanks.

I have a model which you can see here (camera perspective).    In the second image, you can see how the render turned out.    I'm at my wit's end trying to figure our why it's not showing up in the render. If anyone needs more information, just ask and I'll get it to you. I've already checked the normals and they're not the cause.


As a part of my school lab I did following:     Starting off with win 7 installed Installed 10.04 in remaining space > worked Installed 12.04 in amother partition I created finished installation took out the disk.   After the 12.04 the system booted into Grub rescue mode. I didnt know what to do as I never used ubuntu so I just moved on to install 14.04 as part of lab hoping the previous grub loader problem will be solved then, by replacing Grub from CD.     After the 14.04 installation I still get the Grub resuce prompt.

After an installation of Ubuntu 12.04, erasing an old partition with Ubuntu 10.10, I can't get grub to load. I can't access my Windows 7 partition either  I get the message:  > error: no such device: 58ABF29C...   grub rescue>   I suppose my master boot record got erased/corrupted. How can I check and fix this?


I have an ArrayList<Slot>, this Slot class has a public property of type Upload which has different statuses. I want to filter through these statuses, so only retrieve the slots from the list where slots.upload.currentStatus equals something.  Trying something like this  Collection<Slot> filtered = Collections2.filter(this.slots, ?????? ));   Could you help?

I want to filter a java.util.Collection based on a predicate.


Problem  Let $D$ be the set of all the functions $f\colon\mathbb N\to \mathbb N$ , where $\mathbb N$ is the set of natural numbers.   Let $E$ be the set of all functions $f\colon \mathbb N\to\{\,0,1\,\}$.  Prove both the sets have equal cardinality.   Attempt (failed)  $E$ is the set of all infinite binary sequences. By Cantor's second diagonal argument $E$ is uncountable. Since $E\subset D$, $D$ is also uncountable.  If i prove there exists injections from $D$ to $E$ and also from $E$ to $D$, then Schroeder-Bernstein theorem can be used.   Attempt 2  Consider two functions  $\alpha\colon D \to E$ and $\beta\colon E \to D $  Consider a function $f \in E$ is a function from $\mathbb N$ to $\{\,0,1\,\}$. $\beta(f) $ is a function that assigns to $n$ the $f(n)+1$ . This is a injective function .   I have difficulty finding $\alpha$.  Any hint or help will be appreciated.


In the paper "Deep Residual Learning for Image Recognition" the authors make use of, so called, shortcut connections. How do they work and where could I find more information about them?

I am interested in regression with neural networks.  Neural networks with zero hidden nodes + skip-layer connections are linear models.  What about the same neural nets but with hidden nodes ? I am wondering what would be the role of the skip-layer connections ?  Intuitively, i would say that if you include the skip-layer connections, then the final model will a sum of a linear model + some non-linear parts.  Is there any advantage or disadvantage in adding skip-layer connections to neural nets ?


I am trying to use the conditional (ternary) operator to assign the proper lambda expression to a variable, depending on a condition, but I get the compiler error: Type of conditional expression cannot be determined because there is no implicit conversion between 'lambda expression' and 'lambda expression'. I can use the regular if-else to solve this problem, but the conditional operator makes more sense to me (in this context), would make the code more concise add, at least, I would like to know the reasons why it doesn't work.   // this code compiles, but is ugly! :) Action<int> hh; if (1 == 2) hh = (int n) => Console.WriteLine("nope {0}", n); else hh = (int n) => Console.WriteLine("nun {0}", n);  // this does not compile Action<int> ff = (1 == 2)   ? (int n) => Console.WriteLine("nope {0}", n)   : (int n) => Console.WriteLine("nun {0}", n);

Generally, when using the conditional operator, here's the syntax:  int x = 6; int y = x == 6 ? 5 : 9;   Nothing fancy, pretty straight forward.  Now, let's try to use this when assigning a Lambda to a Func type. Let me explain:  Func<Order, bool> predicate = id == null     ? p => p.EmployeeID == null     : p => p.EmployeeID == id;   That's the same syntax, and should work? Right? For some reason that doesn't. The compiler gives this nice cryptic message:     Error  1   Type of conditional expression cannot be determined because there is no implicit conversion between 'lambda expression' and 'lambda expression'   I then went ahead and changed the syntax and this way it did work:  Func<Order, bool> predicate = id == null     ? predicate = p => p.EmployeeID == null     : predicate = p => p.EmployeeID == id;   I'm just curious as to why it doesn't work the first way?  (Side note: I ended up not needing this code, as I found out that when comparing an int value against null, you just use object.Equals)


I have been struggling/failing for the last day to try find a way that I can add a flag/marker to the Drupal menu links that I can examine within the menu TWIG template to modify the link such that it becomes plain text instead of a menu link.  I am not using any menu modules, standard Drupal Menu with CSS to provide the drop down functionality and styling.  What I need is to be able to output a menu item as shown in the screen shot, specifically the 'Sell your property' & 'Essential Services' items which are unlinked headers.    Initially I attempted to use the contributed module menu item extras   () which works fine from a menu management plugin point of view but then they change the markup way too much and it actually breaks the drop down functionality, so I cannot use it.  I then tried a second module which seemed simpler, i.e. Menu link content fields ().  This module has some strange behaviour in that it makes the menu links fieldable. I can add a new field but after adding a field, it does not appear under the Manage Fields tab, and in the twig template the new field is un-available in the menu item object (Examined through xDebug)  Also, trying to remove this invisible field at a later stage seems difficult.  Question: How can I easily add some sort of marker to a menu item link  to allow me to modify the template output for said link. Or is the re a module that will allow then insertion of HTML markup/plain text instead of a link (Megamenu doesnt seem to allow this)  Also, I cannot seem to find the hook which deals specifically with a sites menu, i.e. the hook that is executed for each menu link. Does one even exist?  I'd like to avoid a hack whereby I put in a unique string into the text of the link and then examine this in the menu twig templates to see if that string exists to know if I need to modify it.

In a Drupal 8 site, I want to add menu items with "no link", I was thinking that nolink is allowed but when I entered this, I got error      Manually entered paths should start with /, ? or #.   Is there a way for adding menu items not clickable without adding "#" because "#" add attribute [data-drupal-link-system-path=""] and [class="is-active"]


I downloaded text editors (komodo, eclipse, sublime text, and medit). I opened the dash home but, they are in tar.gz format and are opening in archive managers as folders. How do I open them?  Thank you.

I have downloaded tar.gz files. But I don't know how to install it. How do I install this kind of file?


What would be the correct way to respond the statement "I usually start at 8.00 a.m. in the morning"  should i answer with so am I or so do i?

What would be the correct way to reply to a statement such as:  "I belong to this group"  Would it be "So do I" or "So am I"?


I have a Winform application that can be started normally by double-clicking on it and using as a foreground windows application, also it can be started from the command line with arguments  What I need is to allow the application Console.WriteLine function logs to be printed to the command line.  Currently, when I start the application from the command line, it just executes and the cursor goes to a new line as if it is ready to take new command. Any suggestions?  EDIT  I tried checking the answers under the following  (which neither of them worked for me)

Is there a way to show the console in a Windows application?  I want to do something like this:  static class Program {     [STAThread]     static void Main(string[] args) {         bool consoleMode = Boolean.Parse(args[0]);          if (consoleMode) {             Console.WriteLine("consolemode started");             // ...         } else {             Application.EnableVisualStyles();             Application.SetCompatibleTextRenderingDefault(false);             Application.Run(new Form1());         }     } }


Tables, graphs and images don't show up at the same position it was inserted in the TeX file. I tried to suppress floating by using:  \usepackage{float} ... \begin{figure}[H] {15cm} \caption{}% \label{} \fbox{\includegraphics[width=\hsize]{image.jpeg}} \end{figure}   also  \begin{figure}[!htbp] {15 cm} ...  \usepackage{placeins} \FloatBarrier \begin{figure}[H] {15cm} ...   but these commands keep insisting on moving figures, tables and graphs to unexpected locations. I'm using repUERJ template available   Does anyone know why it happens?

I'm working on a project that repUerj template needs to be used and tables, figures and graphs environments are necessarily followed by their width in parentheses as a characteristic of this template.  Ex:  \begin{table}{15cm}  ...  end{table}   The issue with this pattern is that I can't force figures, tables and graphs placement in text. I tried that using \float and \placeins but the commands from these packages simply don't work.  When I delete the width in parentheses, LaTeX returns an error messagem:     Missing number treated, as zero \end{table}   The packages used in repUerj are listed below:  \usepackage[utf8]{inputenc} \usepackage{makeidx}  \usepackage{hyperref \usepackage{indentfirst} \usepackage{graphicx} \usepackage{subfig} \usepackage{multirow} \usepackage{amsmath,amssymb} \usepackage[font=default,frame=no]{repUERJformat} \usepackage[dots=yes]{repUERJpseudocode} \usepackage[maxfloats=25]{morefloats} \usepackage{array} \setlength\extrarowheight{2pt}   concrete example:    RepUerj is available here:   Does anyone know any other alternative to use in this case?


If I start with a java.io.InputStream, what's the easiest way to read the entire stream out into a String (assuming utf-8)?  This should be pretty easy but I'm mostly a C# person and google is failing me on this. Thanks.

If you have a java.io.InputStream object, how should you process that object and produce a String?    Suppose I have an InputStream that contains text data, and I want to convert it to a String, so for example I can write that to a log file.  What is the easiest way to take the InputStream and convert it to a String?  public String convertStreamToString(InputStream is) {     // ??? }


This question is primarily terminology based. In that $\sqrt{}$ denotes the principal square root.  Here are two reasoning   $\sqrt{(-1)^2}=1$  since $\sqrt{(-1)^2}=\sqrt{1}$ which we know has a principal square root of $1$. Or  $\sqrt{(-1)^2}=-1$ since $\sqrt{(e^{\pi i})^2}=\sqrt{e^{2\pi i}}=e^{\pi i}=-1$   Which reasoning is correct and why? Also if possible can you leave a source.

I know there must be something unmathematical in the following but I don't know where it is: \begin{align} \sqrt{-1} &= i \\\\\ \frac1{\sqrt{-1}} &= \frac1i \\\\  \frac{\sqrt1}{\sqrt{-1}} &= \frac1i \\\\  \sqrt{\frac1{-1}} &= \frac1i \\\\  \sqrt{\frac{-1}1} &= \frac1i \\\\  \sqrt{-1} &= \frac1i \\\\  i &= \frac1i \\\\  i^2 &= 1 \\\\  -1 &= 1 \quad !!? \end{align}


W: Failed to fetch http://ug.archive.ubuntu.com/ubuntu/dists/trusty/restricted/source/Sources  403  Forbidden

I've start a new job today and I am trying to set up my machine to run through their Windows server.  I've managed to get a internet connection through the server now but now I can't run apt-get update as I get a "403 Forbidden" error.  This is for every repo under my source list, apart from translations(?).  I do have a proxy in apt.conf, if I don't have it I get a 407 Permission Denied error.  Here's my apt.conf file (I have omitted my username and password)  Acquire::http::proxy "http://username:password@192.168.0.2:8080/";   Here's my sources.list  #deb cdrom:[Ubuntu 12.04.2 LTS _Precise Pangolin_ - Release amd64 (20130213)]/ dists/precise/main/binary-i386/  #deb cdrom:[Ubuntu 12.04.2 LTS _Precise Pangolin_ - Release amd64 (20130213)]/ dists/precise/restricted/binary-i386/ #deb cdrom:[Ubuntu 12.04.2 LTS _Precise Pangolin_ - Release amd64 (20130213)]/ precise main restricted  # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://gb.archive.ubuntu.com/ubuntu/ precise main restricted deb-src http://gb.archive.ubuntu.com/ubuntu/ precise main restricted  ## Major bug fix updates produced after the final release of the ## distribution. deb http://gb.archive.ubuntu.com/ubuntu/ precise-updates main restricted deb-src http://gb.archive.ubuntu.com/ubuntu/ precise-updates main restricted  ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team. Also, please note that software in universe WILL NOT receive any ## review or updates from the Ubuntu security team. deb http://gb.archive.ubuntu.com/ubuntu/ precise universe deb-src http://gb.archive.ubuntu.com/ubuntu/ precise universe deb http://gb.archive.ubuntu.com/ubuntu/ precise-updates universe deb-src http://gb.archive.ubuntu.com/ubuntu/ precise-updates universe  ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu  ## team, and may not be under a free licence. Please satisfy yourself as to  ## your rights to use the software. Also, please note that software in  ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team. deb http://gb.archive.ubuntu.com/ubuntu/ precise multiverse deb-src http://gb.archive.ubuntu.com/ubuntu/ precise multiverse deb http://gb.archive.ubuntu.com/ubuntu/ precise-updates multiverse deb-src http://gb.archive.ubuntu.com/ubuntu/ precise-updates multiverse  ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. deb http://gb.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse deb-src http://gb.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse  deb http://security.ubuntu.com/ubuntu precise-security main restricted deb-src http://security.ubuntu.com/ubuntu precise-security main restricted deb http://security.ubuntu.com/ubuntu precise-security universe deb-src http://security.ubuntu.com/ubuntu precise-security universe deb http://security.ubuntu.com/ubuntu precise-security multiverse deb-src http://security.ubuntu.com/ubuntu precise-security multiverse  ## Uncomment the following two lines to add software from Canonical's ## 'partner' repository. ## This software is not part of Ubuntu, but is offered by Canonical and the ## respective vendors as a service to Ubuntu users. # deb http://archive.canonical.com/ubuntu precise partner # deb-src http://archive.canonical.com/ubuntu precise partner  ## This software is not part of Ubuntu, but is offered by third-party ## developers who want to ship their latest software. deb http://extras.ubuntu.com/ubuntu precise main deb-src http://extras.ubuntu.com/ubuntu precise main   I can sort-of fix this by changing all the http in sources.list to ftp but I still have issues with ppas


Every time I encrypt the data, I generate a different IV. Suppose the attacker has access to all files ever encrypted. They don't know the key, but they do know the IV. The problems is: if I save the same data with the same key several times, I generate different encrypted data. Theoretically, this could give the attacker some information about the key or the data, assuming they know that neither have changed. Should I worry about this?  This is mostly a theoretical question. In practice I could simply check if the data or the key have changed. If not, then I don't change the encrypted data.

I'm looking for different approaches to proofs for the security of CBC mode encryption. What are the best sources of information about this subject?


Recently I saw programmer put literal in front of if condition  if ( -99 == $poll_id )   Why they did that? What is the difference with normal if e.g.:  if ( $poll_id == -99 )

In c#, is there any difference in the excecution speed for the order in which you state the condition?  if (null != variable) ... if (variable != null) ...   Since recently, I saw the first one quite often, and it caught my attention since I was used to the second one.  If there is no difference, what is the advantage of the first one?


I have a symmetric matrix $B$ (actually a covariance matrix of a set of variables) and I want to write it in the form of $AA^{T}$. How can I get $A$? Thanks.

Given a symmetric matrix $B \in \mathbb{C}^{n\times n}$.  How many coefficients of  $A \in \mathbb{C}^{n\times n}$ can you obtain from the following equation? $$A^\top A=B$$  I think this problem is under determined? Isn't it? Sure $B$ must be symmetric. Thus  only $\frac{n(n+1)}{2}$ complex equations remain for $n\times n$ coefficients.


In my Master thesis, I used this:  \begin{itemize}[label=\ding{167}] \item Access Windows XM from Ubuntu Server \item List the directories contents of Windows XP \end{itemize}   The output is:  My question: must I avoid the use of  such beautiful things when writing my thesis or is it a normal thing to do ?

I quite enjoy paying attention to how I design my documents and presentations. I usually spend hours thinking over and designing my slides for a workshop or presentation, so that they are aesthetically pleasing and as intuitive as possible. Likewise I recently started revising my CV I figured and I wanted to make it stand out a bit more. (Just to make it clear I don't mean making a clown of a document but just better use of colors, contrast and design elements.)  I have long wondered whether or not this is something that can backfire, since most documents in academic context are extremely plain, at least in my experience. It's very common to see the default Powerpoint slides (white bg, black arial text) or .   My question is as follows: is putting time and effort into design of academic documents something that can backfire? Will I risk being prejudged with first impressions such as "well he put much effort in the presentation his documents, perhaps because the content is sub-par"?     I realize that the question might be somewhat subjective from person to person but I encourage everyone to consider it in terms of this SE blog entry: .


Easily to explain hard to do.  I wonder if its possible for me to take photo of my street in the day and make it look like night because night photography is beautiful but night requires high shutter speeds which doesn't fit for tree leaves. I can add distant lights etc later through a night shot.  This idea came from my idea of filming night scenes in day with low ISO high quality and then edit them to make them look like night. Too bad I dont have RAW camera. So how well it would look like with h264?  And as the second question. How much quality/realism is it possible to do the same in night through 10 sec 20 sec and 30 sec image stacking and then make it look like it was taken in the day assuming there are no passing cars etc?

I recently came upon the image below, and more like them on Stephen Wilke's , and was wondering how the image was made.     It really seems that there would be some form of post processing, but by the seemless flow of the image, it looks like the edits may have been very complex. Is there a simple way to recreate this style?


The usual answer to the question "why electrostatic discharge happens more often on dry days" is that water - due to its polarity - has the tendency to remove the excess charge.  But I do not understand how exactly does it happen since water is an insulator, not a conductor. Are electrons from charged objects shuffled from one water molecule to another, until they reach the ground? If they could do so, then pure water would conduct electricity - but it does not. Perhaps individual water molecule collect excess electrons and move away from the object, staying in H2O- state? Or is it because ion-containing water (i.e. minerals, salts and other impurities) condenses on the charged, non-conductive objects and creates a thin layer of conductivity? But the answers usually refer to the conductivity of the air, not the objects in question. Maybe the ions present in the air conduct the electricity? If so, then why question (and answers) refer mostly to the polarity of water?

What are the ways electrostatic charged objects leak charge in humid conditions?  Can airborne particles pick up charge by contact, then be repelled hence removing charge? If so would it be a significant factor?


I am new bee for SQL Server dba. I need some suggestion to shrink the database log file.  I have tried and found some solution to shrink the file. But i think this is not opted solution for this.  Solution 1:  ALTER DATABASE nologtest2 SET RECOVERY SIMPLE; GO -- Shrink the truncated log file to 1 MB. DBCC SHRINKFILE (nologtest2_log, 1); GO -- Reset the database recovery model. ALTER DATABASE nologtest2 SET RECOVERY FULL;   I am not sure I can do this in production.  Solution 2:    Backup log nologtest2 to disk='C:\MAS\nologtest32_log.trn'   DBCC SHRINKFILE (nologtest2_log, 1);   We can took some transaction log backup and then we can shrink the database. But i believe  it will break the lsn chain. Then we may face some issue in logshipping environment.  I need some very opted solution for reduce the database log file issues.  Note:   I am not very familiar with being a SQL Server dba. If i am ask anything wrong or understandingly please correct me.

This one seems to be a common question in most forums and all over the web, it is asked here in many formats that typically sound like this:  In SQL Server -  What are some reasons the transaction log grows so large? Why is my log file so big? What are some ways to prevent this problem from occurring? What do I do when I get myself on track with the underlying cause and want to put my transaction log file to a healthy size?


I have upgraded from Ubuntu 19.10 to 20.04, and now I have a problem with my graphics rendering (strange squares on background and font problems). I use the i915 driver. Graphics card: Skylake GT2 HD Graphics 520. I tried to reinstall GNOME shell and Xorg server. Nothing helped. Also Chrome browser breaks on most of pages.

I have recently upgraded Ubuntu 19.10 to latest LTS Ubuntu 20.04. After updating, I get serious artifacts on my screen. Every time I reboot (or log-in), my screen is fuzzy or scrambled (picture attached):     This is temporary. The fuzzy screen goes away when I change the background. But it reappears the moment I reboot or log back in.   I have Intel HD Graphics 520 (Skylake GT2).  The output of lspci -nn |grep -E 'VGA|Display' is:  00:02.0 VGA compatible controller [0300]: Intel Corporation Skylake GT2 [HD Graphics 520] [8086:1916] (rev 07)   Update:   On enabling Wayland in Ubuntu 20.04 and logging in to, these artifacts are however cured.   This is okay for now, but I am not sure about Wayland as I have not yet used it before.   Is there a way to correct the graphic issue with normal Ubuntu startup?


I know that I have to integrate both sides, but how would I integrate the right side? For context purposes, this came from the derivation of a curve, so I know this must end in a curve. $s$ is a constant and can be treated as such. $f(x)$ is not solely the function of $x$, but actually a constant as well. How would I integrate this?  $$f'(x)=\frac{s\sqrt{3}}{2\sqrt{s^2-2f(x)s\sqrt{7}+f(x)^2}}$$

How do you go about integrating this? For context purposes, $s$ is a constant and $n$ is just the variable we need to integrate for. If needed, a number can be substituted for $s$, but I would like it without preferably.   $$\int\frac{s\sqrt{3}\sqrt{s^2-2ns\sqrt{7}+4n^2}}{2s^2-4ns\sqrt{7}+8n^2}dn$$


In c# I can simply clear the console with Console.Clear();. Is there a way to simply clear the console in python like there is in c#?

Like most Python developers, I typically keep a console window open with the Python interpreter running to test commands, dir() stuff, help() stuff, etc.  Like any console, after a while the visible backlog of past commands and prints gets to be cluttered, and sometimes confusing when re-running the same command several times.  I'm wondering if, and how, to clear the Python interpreter console.  I've heard about doing a system call and either calling cls on Windows or clear on Linux, but I was hoping there was something I could command the interpreter itself to do.  Note: I'm running on Windows, so Ctrl+L doesn't work.


A lot of the [scams] questions involve a reversible deposit followed by a non-reversible withdrawal. A common method is a bouncing check that can take over a month to bounce. As the recipient of a deposit that might be invalid, is there a way to request that you back confirm or certify the deposit? Alternatively, can you ask them to ringfence the funds until they are confirmed? This is a hypothetical situation for me, but it seems there are others who might benefit from knowing whether this is possible.

Someone has sent me a check for $250 in payment for property damage they caused in a car accident.  It would have been better if I had gotten a cashier's check or official check, but I'll have to make do with what I've got.  Since I've spoken directly with the person, and since I have their address and phone number, I'm fairly sure this is a good check.  But I really can't be 100% sure.  So once I deposit it, when can I consider the check to be "cleared"?  That is, at what point can I be sure that the $250 is irrevocably mine?  There are other questions that have dealt with something similar (like the advance-fee fraud that probably underpins ) but since the focus of the question was different, there wasn't a clear answer on the time for clearing a check.  Thanks to anyone who knows.


I am new to Ubuntu and I just started learning bash. How can I open bash files through terminal?

Whenever I open a .sh file, it opens it in gedit instead of the terminal. I can't find any option similar to Right Click → Open With → Other Application... → Terminal.  How do I open this file in the terminal?


If I am writing a tour description, what is the correct way to write up days and nights? For example in this short description:  'Summit Java's highest peak for sunrise, trek through lava fields and camp in stunning spots. 4 days, 3 nights.  Your adventure includes:   4-day guided hiking 3 nights camping Return transfer from....'   etc  Would it be different if it was 1 day, or 2 days? (or 1-day or 2-days?)  We are trying to stick to AP style, but it is not clear on this subject. If someone can clear this up we'd be very grateful!

As in, "for each 30-day span, a late fee will be charged." I think the hyphenated version looks best, but is there some sort of authoritative word on that in a style guide?


Could you give me some guidance on proving the following trig identity?  $$\cos(A + B)\cos(A - B) = -(\sin A + \cos B)(\sin A - \cos B).$$

$$\cos (A + B)\cos (A - B) = {\cos ^2}A - {\sin ^2}B$$  I have attempted this question by expanding the left side using the cosine sum and difference formulas and then multiplying, and then simplifying till I replicated the identity on the right. I am not stuck. What's bothering me is that the way I went about this question seemed like a rather "clunky" method. I'm just curious if I've missed some underlying pattern that could have made it easier to reproduce the identity on the right.  The way I did it:  $$\begin{array}{l} \cos (A + B)\cos (A - B)\\ \equiv (\cos A\cos B - \sin A\sin B)(\cos A\cos B + \sin A\sin B)\\ \equiv {\cos ^2}A{\cos ^2}B - {\sin ^2}A{\sin ^2}B\\ \equiv {\cos ^2}A(1 - {\sin ^2}B) - (1 - {\cos ^2}A){\sin ^2}B\\ \equiv {\cos ^2}A - {\cos ^2}A{\sin ^2}B - {\sin ^2}B + {\cos ^2}A{\sin ^2}B\\ \equiv {\cos ^2}A - {\sin ^2}B\end{array}$$


I am trying to use Holt-Winters method in order to do time-series prediction on some datasets. The problem that I'm dealing with is the fact that each dataset has different seasonality value (or frequency basically). As an example, in one dataset the trend occurs every 300 timesteps while for another one this might be a different number. Assuming that I do not have the option of visualizing data each time to find out about the seasonality of my data, what would be the best way for finding the optimal value of frequency to get the best performance from Holt-Winters? Note that I receive about 500 out of 4000 samples to train my model.  My approach: Split train data to train and validation subsets. Use different seasonality values on train and evaluate performance on validation. For now, I think I'll use random search to find the best value such that it minimizes the prediction error on validation set. I was wondering if there are any other practical methods or approaches that any of you might be aware of?  UPDATE: I have to mention that I have to implement this only in python and not R, so the findfrequency() function from forecast package is applicable here.

This post is the continuation of another post related to a . Basically, at this point I'm interested in a robust way to discover the periodicity/seasonality of a generic time series affected by a lot of noise. From a developer point of view, I would like a simple interface such as:  unsigned int discover_period(vector<double> v);  Where v is the array containing the samples, and the return value is the period of the signal. The main point is that, again, I can't make any assumption regarding the analyzed signal. I already tried an approach based on the signal autocorrelation (detecting the peaks of a correlogram), but it's not robust as I would like.


I was trying to upgrade to ubuntu 15.04 to fix random system crashes on my previous installation but the system crashed during the upgrade, as a result I had to fix it from terminal mode, now I have a 15.04 installation but apparently the dpkg manager has some issues and its preventing other dependent upgrades. Here is the error message:

I am using 15.04.   So I'm working with git and I installed the standard version. I set up the ssh keys and was able to clone one of my repositories to the correct folder. Everything was working great and then I decided it was a good idea to install more packages. I ran sudo apt-get install git-all. I'm looking at error codes now having to deal with upstart.  start: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused No apport report written because the error message indicates its a followup error from a previous failure. dpkg: error processing package runit (--configure):  subprocess installed post-installation script returned error exit status 1 dpkg: dependency problems prevent configuration of git-daemon-run:  git-daemon-run depends on runit; however:   Package runit is not configured yet.  dpkg: error processing package git-daemon-run (--configure):  dependency problems - leaving unconfigured Errors were encountered while processing:  runit  git-daemon-run E: Sub-process /usr/bin/dpkg returned an error code (1)   This is what happens when I even update/upgrade my system. At this point all I'm looking to do is be able to install software and update my current software. Is there any way I can potentially reverse this issue or at least correct it?   Edit: Thankfully this issue was solved only a day or two after it happened. The accepted answer worked perfectly and took care of my issue


All i am trying to do is click on button to go to another activity through intent. But when i click on button it shows following error in my logcat.     11-23 22:14:21.761    7140-7140/com.example.admin.mysqlitest E/AndroidRuntime﹕ FATAL EXCEPTION: main       java.lang.RuntimeException: Unable to resume activity {com.example.admin.mysqlitest/com.example.admin.mysqlitest.InsertActivity}: java.lang.NullPointerException               at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2124)               at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2139)   My code for both MainActivity and InsertActivty are here.  Main Activity  public class MainActivity  extends ListActivity  {      private StudentOperation studentDBoperation;      @Override     public void onCreate(Bundle savedInstanceState) {         Button   btListe;          super.onCreate(savedInstanceState);         setContentView(R.layout.activity_main);          studentDBoperation = new StudentOperation(this);         studentDBoperation.open();          List values = studentDBoperation.getAllStudents();          // Use the SimpleCursorAdapter to show the         // elements in a ListView         ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, values);         setListAdapter(adapter);       btListe = (Button)findViewById(R.id.newBtn);         btListe.setOnClickListener(new OnClickListener()         {    public void onClick(View v)             {             // Intent intent = new Intent(main.this, ListViewImage.class);                 Intent intent = new Intent(MainActivity.this,InsertActivity.class);                 startActivity(intent);                 finish();             }         });     }  @Override     protected void onResume() {         studentDBoperation.open();         super.onResume();     }      @Override     protected void onPause() {         studentDBoperation.close();         super.onPause();     }  }   Insert Activity  public class InsertActivity extends ListActivity {      private StudentOperation studentDBoperation;    protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);          setContentView(R.layout.insert_activity);     }     public void addUser(View view) {          ArrayAdapter adapter = (ArrayAdapter) getListAdapter();          EditText text = (EditText) findViewById(R.id.editText1);         Students stud = studentDBoperation.addStudent(text.getText().toString());          adapter.add(stud);         if(true)         {             Toast.makeText(getApplicationContext(), (String)stud.getName()+"is added successfully!!", Toast.LENGTH_LONG).show();             Intent intent = new Intent(InsertActivity.this,MainActivity.class);             startActivity(intent);             finish();         }      }      public void deleteFirstUser(View view) {          ArrayAdapter adapter = (ArrayAdapter) getListAdapter();         Students stud = null;          if (getListAdapter().getCount() > 0) {             stud = (Students) getListAdapter().getItem(0);             studentDBoperation.deleteStudent(stud);             adapter.remove(stud);         }      }      @Override     protected void onResume() {         studentDBoperation.open();         super.onResume();     }      @Override     protected void onPause() {         studentDBoperation.close();         super.onPause();     } }   Any suggestions please. I am new to Android.

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've tried solving it by parts but ended with a loop. And I can´t remember another method.  Thanks.

I made up some integrals to do for fun, and I had a real problem with this one. I've since found out that there's no solution in terms of elementary functions, but when I attempt to integrate it, I end up with infinite values. Could somebody point out where I go wrong?  So, I'm trying to determine: $$ \int{\frac{e^x}{x}} \, dx $$  Integrate by parts, where $u = 1/x$, and $v \, ' = e^x$. Then $u \, ' = - 1/x^2$, and $v=e^x$. So,  $$\int{\frac{e^x}{x}} \, dx = \frac{e^x}{x} + \int{\frac{e^x}{x^2}} \, dx$$  Integrate by parts again, $u = 1/x^2$, $v \, ' = e^x$, so that $u \, ' = -2/x^3$ and $v=e^x$. So,  $$\int{\frac{e^x}{x}} \, dx = \frac{e^x}{x} + \frac{e^x}{x^2} + 2\int{\frac{e^x}{x^3}} \, dx$$  Repeat this process ad infinitum to get,  $$\int{\frac{e^x}{x}} \, dx = \frac{e^x}{x} + \frac{e^x}{x^2} + 2 \left( \frac{e^x}{x^3} + 3 \left( \frac{e^x}{x^4} + 4 \left( \frac{e^x}{x^5} + \, \cdots \right) \right) \right) $$  Expanding this gives,  $$\int{\frac{e^x}{x}} \, dx = \frac{e^x}{x} + \frac{e^x}{x^2} + \frac{2e^x}{x^3} + \frac{6 e^x}{x^4} + \frac{24 e^x}{x^5} + \cdots $$  And factoring that gives,  $$\int{\frac{e^x}{x}} \, dx = \frac{e^x}{x} \left(  1 + \frac{1}{x} + \frac{2}{x^2} + \frac{6}{x^3} + \frac{24}{x^4} + \cdots \right) $$  Now, considering the series itself, the ratio between the $n^{th}$ term and the $(n-1)^{th}$ term = $\Large \frac{n}{x}$. Eventually, $n$ will be larger than $x$, so the ratio between successive terms will be positive, so (assuming $x$ is positive), the series diverges, meaning (and I'm sure everybody will cringe upon seeing notation used like this), that:  $$\int{\frac{e^x}{x}} \, dx = \frac{e^x}{x} \left( \infty \right) = \infty $$


I did my CS undergraduate at an international university (being top 5 in my class), and I am applying for this round of Comuter Science PhD admissions. I'm mostly applying to top 10 schools (MIT, Stanford, CMU, Berkeley, UIUC, ...). My profile is relatively competitive with a few independent publications (written solely by me) and joint publications published in top CS conferences. My LORs are also supposedly strong (Professors' words, not mine as I have not seen the letters). I came across  website where students post about admission updates and interview invitations. I've noticed that most, if not all, the programs I applied to had already sent interview requests. However, unfortunately I have not heard back from the programs for any interview invite (whether formal or informal). My question is, how common is it for international applicants to be accepted to these top programs without an interview (formal/informal)? I feel it is unlikely, because if a professor is planning to fund an applicant for a few years, I'd expect they would at-least be interested in having a short conversation with the applicant. I am aware of  answer, however this was three years ago. I am interested if this expectation has changed over time.

I'm an (international) electrical engineering applicant applied to some top-10 graduate programs in US (say, MIT, Caltech, UCB, etc.). As I check the entries of "thegradcafe.com" every day associated with the programs I've applied to, there are many entries which declare interviews with some POIs. So far, I have received no interview requests from any target school. Thus, I'm a little bit both curious about the importance of interview and anxious about the interpretation of such a lack of interviews in my case. To be specific, are all admitted students to top-tier engineering programs invited to interview before getting admitted? In other words, should I expect to be rejected if no one invites me to any sort of interview?  PS. If it helps to clear the situation, I'm currently an M.A.Sc student at a well-known Canadian university. So, both my university and my supervisor are pretty famous to the research community of my field.


Here is the definition my professor gave to us: A commutative ring $R$ is local if it has a unique maximal ideal $\mathfrak{m}.$In this case, we say $(R, \mathfrak{m})$ is a local ring. For example, if $R$ is a field, then $(R,(0))$ is a local ring, since the only proper ideal of a field is $(0).$ My question is: Why the only proper ideal of a field is $(0),$ could anyone explain this to me please?

Let $R$ be a commutative ring with identity. Show that $R$ is a field if and only if the only ideals of $R$ are $R$ itself and the zero ideal $(0)$.  I can't figure out where to start other that I need to prove some biconditional statement. Any help?


When you start the game, you are asked to choose between two difficulty levels, one said to be for veteran farmers, and one for beginners. I went with the one for beginners, but I haven't really noticed anything all that different from what my friends are experiencing on a higher difficulty level.   What changes between the two difficulty levels?

When starting a new game, I am given the option to select a difficulty. "Original" and "seedling". What are the differences in these difficulties?


I have this exercise where we let $Y$ be a Hausdorff space, and $X\subseteq Y$ an open subspace. We have to assume that X is locally compact. We let $X^+$ denote the one-point compactification of X, and let $\infty$ denote the unique point in $X^+\backslash X$. Define $f: Y\to X^+$ by: $$f(y)= \begin{cases} y & \text{if}\ y\in X\\ \infty & \text{else}  \end{cases}$$ Show that f is continuous. I am thinking that I have to show that for all open subsets $U\subseteq X^+$ the inverse image $f^{-1}(U)$ is an open subset of Y. The way I am thinking I can show that $f^{-1}(U)$ is an open subset of Y is by showing that $Y\backslash f^{-1}(U)$ is closed. But I am confused about how to do so.

I am struggling with an exercise in Topology. The exercise goes:  Let $Y$ be Hausdorff, and $X\subseteq Y$ an open subspace which is locally compact. Let $X^{+}$ denote the one-point compactification of $X$, and let $\infty$ denote the unique point in $X^{+} \backslash X .$ Define $f: Y \longrightarrow X^{+}$ by $$ f(y)=\left\{\begin{array}{ll} y & \text { if } y \in X \\ \infty & \text { else } \end{array}\right. $$ Show that $f$ is continuous.  I have a lot of definitions and lemmas about continuity, but none of them seems to fit with this problem. I am looking for a hint on how to get started with the proof. Thanks in advance.


I have a basic question about electronic ground. For example, if electrons travel from the DC battery's negative terminal through the conductive wire to the positive terminal of a DC battery with a LED as a load, how would adding ground symbol in a schematic circuit between the conductive wire of the negative terminal connecting to the LED change anything in the current flow?

I'm a bit confused about the concept of ground, and perhaps voltage as well, particularly when trying to analyze a circuit. When I learned about Ohm's law in grade school, I learned how to apply the law to calculate current, voltage, and resistance of simple circuits.   For instance, if we were given the following circuit:    We would be could be asked to calculate the current passing through the circuit. At the time, I'd simply compute (based on the rules given) 1.5V/1Ohms=1.5A.  Later on, however, I learned that the reason the voltage of the resistor would be 1.5V is because voltage is really the difference in potential between two points, and that the difference of the voltage across the battery would be the same as that of the resistor (correct me if I'm mistaken), or 1.5V. I got confused, however, after the introduction of the concept of ground.   The first time I tried to do the current calculation for a circuit similar to the previous circuit on a simulator, the program complained about not having a ground and "floating voltage sources". After a bit of searching, I learned that circuits need ground as a reference point or for safety reasons. It was mentioned in one explanation that one can pick any node for ground, although it's customary to design circuits so there is a "easy place" to pick ground.   Thus for this circuit    I picked ground at the bottom, but would it be okay to pick ground between the 7 ohm and 2 ohm resistor - or any other place? And what would be the difference when analyzing the circuit?  I've read that there are 3 typical ground symbols with different meanings - chassis ground, earth ground, and signal ground. A lot of circuits I've seen used in exercises either use earth ground or signal ground. What purpose is there in using earth ground? What is the signal ground connected to?  Another question: since the ground is at unknown potential, wouldn't there be current flowing to or from ground to the circuit? From what I've read we treat the ground as 0V, but wouldn't there be some sort of effect because of a difference in potential of the circuit and ground? Would the effect be different depending on what ground was used?  Finally: In nodal analysis, one customarily picks a ground at the negative terminal of the battery. However, when there are multiple voltage sources, some of them are "floating". What meaning does the voltage of a floating voltage source have?


I just came across this term “forward search attack” while reading about Interchange key and Session key. The book mentioned that using session key helps to prevent attacks such as forward search attack.

I am looking at the different attacks on RSA. I came across known-plaintext attack where the public key can be used to encrypt all possible messages until it finds a match on the sent encrypted message. However, on the book I found in the library it seems this form of attack is also called "Forward search attack".      If the message space is small or predictable, an adversary can decrypt a ciphertext c by simply encrypting all possible plaintext messages until c is obtained. Salting the message as described above is one simple method of preventing such an attack. -Handbook of Applied Cryptography   So are these attacks the same with different names or have I misunderstood it?


What kind of time descriptor can be regarded as an "unspecified time"? (So it can be used along with the perfect tense)  For example, it's correct to say:      I have seen that movie six times in the last month.   Can I say "I have seen that movie six times in May" instead?  There's a quiz on the English exam paper:      In 1492, Columbus _ on one of the Bahama Islands, but he mistook it for an island off India.      A. lands   B. landed   C. has landed   D. had landed   I felt that it's little weird to choose C, so I chose B. But I wonder if C is also grammatically right.

I was told that if an action is completed once in the past, the simple past is used. Ex:  I saw that movie.  If the action is completed more than once, the present perfect tense must be used. Ex:  I have seen that movie twelve times.    So, "I have seen that movie twelve times on Tuesday." is correct and "I saw that movie twelve times on Tuesday." is incorrect?


OS: Ubuntu 16.04 LTS, Platform: 64bit, Root partition(/) size: 153.6 GB,  Free space in root partition(/): 140.2 GB, Swap partition size: 6 gb, Any free/Unallocated space in disk: No, Dual Boot/Other OS: Yes, Windows 10, Main objective: To be able to hibernate ubuntu   I tried to hibernate my system but it failed. I read in some articles that I must allocate swap space equal to the size of RAM installed on my system to perform hibernate. I have no space left in my hard disk other than Ubuntu root partition so how can I shrink it and add 2 GB to swap to make it 8 GB.  Will it hibernate then? Is there any other way?

Previously, I have installed Windows 7 on my 320 GB laptop with three partitions 173, 84 and 63 GB each. The 63 GB partition was where the Windows was installed. The rest were for file containers.  Now I changed my OS to Ubuntu 12.04 LTS. I installed Ubuntu by replacing the entire Windows 7 on the 63 GB partition. The rest of the partitions remain as an NTFS Windows partition and I can still access them both (the 173 and 84 GB partitions).  Now I want to change the two partitions of Windows into an Ubuntu format partitions plus most importantly, I want to extend the 63 GB partition to more than a 100 GB because at the moment I am running out of disk space. Whenever I try to install any application, especially using wine, it always complains for a shortage of disk space.  How do I do the extending activity before I entirely format my laptop again and lose all the important files on my partitions?


My external HD isn't mounted and can't be repaired by Disk Utility. However, I'm also unable erase the disk:  $ diskutil list disk2 /dev/disk2    #:                       TYPE NAME                    SIZE       IDENTIFIER    0:      GUID_partition_scheme                        *4.0 TB     disk2    1:                        EFI EFI                     314.6 MB   disk2s1    2:                  Apple_HFS Everest                 4.0 TB     disk2s2  $ diskutil repairVolume /dev/disk2s2 Started file system repair on disk2s2 Everest Updating boot support partitions for the volume as required Error: -69673: Unable to unmount volume for repair  $ diskutil eraseDisk JHFS+ Everest /dev/disk2 Started erase on disk2 Unmounting disk Error: -69888: Couldn't unmount disk

I have two internal drives in my 27" iMac (10.8.5). An SSD system disk and a 1TB SATA drive.  The HDD has been acting up recently, very slow performance, bad behavior etc. Tech Tool Pro and Disk Utility don't seem to be able to fix the drive, so I decided to wipe the data by a reformat and writing zeros to the entire drive.  Everytime I try and format, it tells me that the drive cannot be unmounted. I have rebooted a few times, and spent days running everything from TechTool Pro on it and it won't go.  $ diskutil list disk2 /dev/disk2    #:                       TYPE NAME                    SIZE       IDENTIFIER    0:      GUID_partition_scheme                        *4.0 TB     disk2    1:                        EFI EFI                     314.6 MB   disk2s1    2:                  Apple_HFS Everest                 4.0 TB     disk2s2  $ diskutil repairVolume /dev/disk2s2 Started file system repair on disk2s2 Everest Updating boot support partitions for the volume as required Error: -69673: Unable to unmount volume for repair  $ diskutil eraseDisk JHFS+ Everest /dev/disk2 Started erase on disk2 Unmounting disk Error: -69888: Couldn't unmount disk   Any thoughts on how to get it to unmount and reformatted? Is there a way in Terminal to do this instead?


I'm tried to .append() a new radio type, then if I clicked in new radios, start a new function, but I can't do this. this is my code:  HTML:  Where take the photo?         <input type="radio" id="MX0" name="wherePhoto" value="MX0"> México         <input type="radio" id="EX0" name="wherePhoto" value="EX0"> Foreign

       Add photo
   JS:  var id = 1; function addPhoto() {   var $newPhoto='
Where take the photo?<input type="radio" id="MX' +id+ '"name="wherePhoto' + id + '" value="MX"> México<input type="radio" id="EX' +id+ '" name="wherePhoto' +id+ '" value="EX"> Foreign
';    $('#newPhoto').append($newPhoto);     id++; }  $('[id^=MX]').click(function() {   alert("hello MX");         });  $('[id^=EX]').click(function() {   alert("hello EX");     });   So I try to send a alert when click on the new Radio (MX1)  Thanks to any help

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.


I'm trying to repair grub after a Win10 install. Here's the content of my disk:  Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0xc4476e04  Device     Boot     Start       End   Sectors   Size Id Type /dev/sda1            2048    206847    204800   100M  7 HPFS/NTFS/exFAT /dev/sda2  *       206848 566209347 566002500 269.9G  7 HPFS/NTFS/exFAT /dev/sda3       566210560 567169023    958464   468M 27 Hidden NTFS WinRE /dev/sda4       567171072 976773167 409602096 195.3G  5 Extended /dev/sda5       567173120 976773119 409600000 195.3G 83 Linux   sda2 contain wind10 and sda5 a btrfs volume (no encryption, no compression)  I had no luck with boot-repair, so I followed the instructions here:   Boot with a Linux LiveCD sudo mount -t btrfs -o subvol=@ /dev/sda5 /mnt sudo mount --bind /dev /mnt/dev sudo mount --bind /dev/pts /mnt/dev/pts sudo mount --bind /proc /mnt/proc sudo mount --bind /sys /mnt/sys sudo chroot /mnt grub-install /dev/sda   Here I get the following eror:  Installing for i386-pc platform. grub-install: error: cannot open `/boot/grub/i386-pc/hello.mod': No space left on device.   sda5 has 56GB of free space. What is going on and how can I fix my system? Thanks  Edit : more informations  df Filesystem     1K-blocks      Used Available Use% Mounted on /dev/sda5      204800000 149884472         0 100% / udev            12307620         0  12307620   0% /dev  df -i Filesystem      Inodes IUsed   IFree IUse% Mounted on /dev/sda5            0     0       0     - / udev           3076905   777 3076128    1% /dev

After a win10 upgrade gone wrong, my boot sequence is broken and now I can't write on my BTRFS partition.  Here's the content of my ssd  Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0xc4476e04  Device     Boot     Start       End   Sectors   Size Id Type /dev/sda1            2048    206847    204800   100M  7 HPFS/NTFS/exFAT /dev/sda2  *       206848 566209347 566002500 269.9G  7 HPFS/NTFS/exFAT /dev/sda3       566210560 567169023    958464   468M 27 Hidden NTFS WinRE /dev/sda4       567171072 976773167 409602096 195.3G  5 Extended /dev/sda5       567173120 976773119 409600000 195.3G 83 Linux   sda5 is my BTRFS partition, it contains  @  @apt-snapshot-release-upgrade-wily-2015-11-20_20:54:08  @home  boot   DF is telling there is no space left on device  df Filesystem     1K-blocks      Used Available Use% Mounted on /dev/sda5      204800000 149884472         0 100% / udev            12307620         0  12307620   0% /dev  df -i Filesystem      Inodes IUsed   IFree IUse% Mounted on /dev/sda5            0     0       0     - / udev           3076905   777 3076128    1% /dev   However, 204800000 1K-blocks minus 149884472 used equal 54915528 KB free, Gparted and Palimpsest are also reporting more than 50GB free.  As , I tried to rebalance the FS  sudo btrfs fi show Label: none  uuid: b6a97e55-1a85-4175-9fd8-3f3a623d527b Total devices 1 FS bytes used 142.48GiB devid    1 size 195.31GiB used 195.31GiB path /dev/sda5  sudo btrfs fi df /media/ubuntu/b6a97e55-1a85-4175-9fd8-3f3a623d527b/ Data, single: total=193.56GiB, used=141.15GiB System, single: total=4.00MiB, used=48.00KiB Metadata, single: total=1.75GiB, used=1.29GiB GlobalReserve, single: total=512.00MiB, used=39.28MiB  sudo btrfs fi balance start -dusage=5 /media/ubuntu /b6a97e55-1a85-4175-9fd8-3f3a623d527b/ ERROR: error during balancing '/media/ubuntu/b6a97e55-1a85-4175-9fd8-3f3a623d527b/': No space left on device There may be more info in syslog - try dmesg | tail  dmesg | tail [ 3059.160230] BTRFS info (device sda5): disk space caching is enabled [ 3059.203601] BTRFS info (device sda5): detected SSD devices, enabling SSD mode [ 3059.204291] BTRFS info (device sda5): checking UUID tree [ 3059.206664] BTRFS warning (device sda5): btrfs_uuid_scan_kthread failed -28 [ 3201.876349] BTRFS info (device sda5): 4 enospc errors during balance   Ubuntu on this partition was totally fine before the windows upgrade.  What can I try to repair the BTRFS partition?  Thanks  Edit : Finally found the solution   Turns out the metadata was full and I had to add an empty device in order to rebalance the FS. No idea why this happened.


I have Huawei P20 (EML-L09) without the account information, password or PIN. ADB is disabled. Is there a way to bypass the logging in with the original account? I would like to add a new one. Alternatively, what can I do to make the phone useable? (Is there an OTG way? Or can you recommend a program or a service?)

I won a Samsung Galaxy S6 Edge, signed into it with my Google account, played around with it, wiped it, and sold it.  Now the person can't get past setup because it's saying he must login with an account previously synced to the phone.   Is there anything I can do from my side to remove this lock?


I was reading Richard Feynman biography when I read that one time he was able to calculate the  cube root of large number in his brain by just using simple facts of everyday life. So my question is there a way to calculate square root or cube root by using just a pen a paper, I mean a systematic way not by trial and error.

Suppose that we don't know logarithm, then how we would able to calculate $\sqrt x$, where $x$ is a real number? More generally, is there any algorithm to calculate $\sqrt [ n ]{ x } $ without using logarithm? More simple techniques would be nice.  Here is a simple technique used to approximate square roots by :  For example: $\sqrt {78}\approx 8\frac { 14 }{ 17 } $ , where $8$ is the nearest integer root of $78$, $14 = 78 - 8^2$, $17 = 2 \times 8 + 1$.  if $n=2^k$ we can use the method above.   For example, for $k=2$ Lets calculate $\sqrt [ 4 ]{ 136 } $: $$\sqrt [ 4 ]{ 136 } =\sqrt { \sqrt { 136 }  } \approx \sqrt { 11\frac { 136-{ 11 }^{ 2 } }{ 11\times 2+1 }  } =\sqrt { 11\frac { 15 }{ 23 }  } \\ \sqrt { 11\frac { 15 }{ 23 }  } \approx 3\frac { 11\frac { 15 }{ 23 } -{ 3 }^{ 2 } }{ 3\times 2+1 } =\frac { 544 }{ 161 } =3.38\\$$ The exact result is$$ \sqrt [ 4 ]{ 136 } =3.4149\cdots$$ The method approximates well, but it is working for only $n=2^k$ as I know.


let $K/k$ be a field extension and $a\in K$ algebraic over k. Prove that the subalgebra $k[a]$ is a field and that $k[a] = k(a)$ where $k(a)$ is the monogenic extension, i.e. the smallest subfield of $K$ containing $k$ and $a$.  I know that $a$ is algebraic on $k[a]$ since $k\subset k[a]$. I don't see how to go from there. Thank you.

If $\alpha$ is an algebraic element and $L \subset K$ are both field, does the polynomial ring $L[\alpha]$ is also a field?  I am trying to prove that the ring of fraction $L(\alpha)$ is equal to $L[\alpha]$. To do this, I use an exercise done in class : Let $K$ a field, $\alpha \in K$ and $L$ a subfield of $K$. Then $L(\alpha)$ is the smallest subfield of $K$ containing $L$ and $\alpha$.  Is anyone could help me?


I know that there's a bunch of posts about vertical and horizontal centering in tables. I have a related issue which I can't figure out how to solve.  I'm trying to center the fourth column, but putting a fourth ">{\centering}" breaks the whole table. Unsure what's going on. Using sharelatex, mostly sure I'm loading the correct package (just 'array' right?).  Ideally, I wish that the pictures in the first column would also be vertically centered, which they aren't, also defeating the purpose of using column type 'm' in the first column.  Also ideally, I'd like to be able to have columns 2, 3, and 4 exist within a single aligned block, so that I could use & to align them to the greater than/less than signs.  Given:  \begin{table}[h] \centering \begin{tabular}{| >{\centering}m{75pt} | >{\centering $} m{65pt} <{$} |  >{\centering} m{20pt} |  m{65pt} |} \hline     \begin{tikzpicture}          \draw [gray] (0,0) circle (15pt);         \filldraw [gray] (0,0) circle (1pt);         \draw [gray] (37.5pt,0) circle (15pt);         \filldraw [gray] (37.5pt,0) circle (1pt);     \end{tikzpicture} & \underline{2r_c \text{sin} \left( ^{\pi} \!/ _{n_k} \right)} & $\geq$ & $2r_f + R_1 r_f$ \\  \hline     \begin{tikzpicture}          \draw [gray] (0,0) circle (15pt);         \filldraw [gray] (0,0) circle (1pt);         \draw [gray] (30pt,0) circle (15pt);         \filldraw [gray] (30pt,0) circle (1pt);     \end{tikzpicture} & 2r_c \text{sin} \left( ^{\pi} \!/ _{n_k} \right) & $\leq$  & $2r_f+\underline{R_1 r_f}$ \\  \hline     \begin{tikzpicture}          \draw [gray] (0,0) circle (15pt);         \filldraw [gray] (0,0) circle (1pt);         \draw [gray] (22.5pt,0) circle (15pt);         \filldraw [gray] (22.5pt,0) circle (1pt);     \end{tikzpicture} & 2r_c \text{sin} \left( ^{\pi} \!/ _{n_k} \right) & $<$  & $\underline{2r_f}+R_1 r_f$ \\ \hline     \begin{tikzpicture}          \draw [gray] (0,0) circle (15pt);         \filldraw [gray] (0,0) circle (1pt);         \draw [gray] (11.25pt,0) circle (15pt);         \filldraw [gray] (11.25pt,0) circle (1pt);     \end{tikzpicture} & 2r_c \text{sin} \left( ^{\pi} \!/ _{n_k} \right) & $<$  & $\underline{2r_f}+R_1 r_f$ \\ \hline \end{tabular} \end{table}

I would like to create a table with some columns' width specified, while the text in those columns should be centered both horizontally and vertically. I found out that  \usepackage{array} \begin{tabular}{| c | c | m{5cm} |}   vertically centers the text in the last column, but justifies it horizontally (like text in normal paragraphs).  Update: With Jake's method, it seems both \\ and \hline cause an error. How to fix it?


It seems like the location of the origin depends on the dimensions of the pictures I am drawing. Is it possible to fix the location of the origin yourself, or otherwise to manipulate the location of the whole tikz box in some way?  Minimal Example  For example:  \documentclass{book} \usepackage{tikz} \usepackage{amsmath}  \begin{document} \begin{tikzpicture} \draw (0, 0) -- (-2, 0); \end{tikzpicture}  \end{document}   The origin in this picture seems not too far from the left of the page. However, changing the line above to   \draw (0, 0) -- (-10, 0);   shifts the origin to the right.

I am trying to position node(2) in a page in coordinates related to the page (origin at upper left corner of the body of the page). My code is:  \documentclass[border=10pt,a4paper]{memoir} \usepackage[total={16.51cm,21.59cm}, top=1.2in, left=0.9in, includefoot]{geometry} \usepackage{tikz} \usepackage{fancyhdr} \usepackage{comment} \pagestyle{fancy} \fancyhf{} \renewcommand{\headrulewidth}{2pt} \renewcommand{\footrulewidth}{1pt} \begin{document} \begin{tikzpicture} \node[](1) at (0cm,0cm) {1}; \node[](2) at (0.5\textwidth,-0.5\textheight) {2}; \end{tikzpicture} \vspace{1cm} \noindent \end{document}   For node(2) to be positioned in the centre of the page at (0.5\textwidth,-0.5\textheight) I have to create another node (1) in the origin, otherwise node(2) will be put at (0,0). I would like that someone could explain this strange behaviour.


I've got a stripped-down Linux container. I want to find out its IP address. I don't have ifconfig or ip installed (and I don't want to install them, since they'd just get deleted when I next rebuild the container).  Can I get the IP address from somewhere in /proc?

Is there a clean, simple way to get an IP address for a network interface from /proc, similar to the way I can get the MAC address for a network interface? Ideally I would just type cat /proc/<foo>/{interface_name} and get the IPv4 address.  I'd rather not run anything other than cat.


I am working on a website and I have a php editor that automatically adds \ to certain things. I was aware of the stripslashes() function and I know it can be used in a way such as: stripslashes($test) but I am including something and I do not know how to strip the slashes from the Page I am including. Here is my include code that I am using:  <?php include $_SERVER['DOCUMENT_ROOT']."/newseditor/BlogTitle.php"; ?>   So how would I stripslashes from this? Thanks for reading and I appreciate all help I recieve.

According to the , in order to make code more portable, they recommend using something like the following for escaping data:  if (!get_magic_quotes_gpc()) {     $lastname = addslashes($_POST['lastname']); } else {     $lastname = $_POST['lastname']; }   I have other validation checks that I will be performing, but how secure is the above strictly in terms of escaping data? I also saw that magic quotes will be deprecated in PHP 6. How will that affect the above code? I would prefer not to have to rely on a database-specific escaping function like mysql_real_escape_string().


I would like to launch a new notepad instance and write content to it from my desktop app (WPF). After that it is user's discretion to save the file or not. (I know I can launch new notepad instance using     System.Diagnostics.Process.Start("notepad.exe"))  Just like the process if some one manually wants to create a .txt file. He first opens notepad from start menu. Then write something and then save in desired folder.  Is it possible?

I'm trying to use SendMessage to Notepad, so that I can insert written text without making Notepad the active window.  I have done something like this in the past using SendText, but that required giving Notepad focus.  Now, first I'm retrieving the Windows handle:  Process[] processes = Process.GetProcessesByName("notepad"); Console.WriteLine(processes[0].MainWindowHandle.ToString());   I've confirmed it's the right handle for Notepad, the same shown within Windows Task Manager.  [DllImport("User32.dll", EntryPoint = "SendMessage")] public static extern int SendMessage(int hWnd, int Msg, int wParam, int lParam);   From here, I haven't been able to get SendMessage to work in all my experimentation.  Am I going in the wrong direction?


Just reading up on the new sangan errata which is;     If this card is sent from the field to the Graveyard: Add 1 monster with 1500 or less ATK from your Deck to your hand, but you cannot activate cards, or the effects of cards, with that name for the rest of this turn. You can only use this effect of "Sangan" once per turn.   So this new Errata states that you cant use the effect of the monster you added until the turn after you use this effect.   To my understanding this means that if you have sangan in an exodia deck and you have both legs and both arms in your hand then if you use the sangan effect to add the head then you wont win until your next turn. Or would the effect of exodia overrule this effect?  And also if you have the head already and three of the other pieces in your hand when you use sangan to add the last one it doesnt have an effect because only the head has the effect and because you havent added the head to your hand then the win condition can still be activated. Or would you still have to wait a turn because the pieces are listed in the effect of the head?

is on the field.  It says     Cannot be Special Summoned. Monster effects cannot be activated.   If all  cards are collected, does Exodia's player win even though Majesty's Fiend prevents Monster effects from happening?


I have a very slow school computer and the school year is wrapping up soon. I'm using the video editing part of blender, putting in my own music and videotaping for an English project. I rendered it with the default settings (because I don't know how to change them, started yesterday) and there's no sound. I went to go see what was wrong and opened my project back up, but the ability to edit the video or audio was completely blank. I just want my complete video rendered in .MP4 so my teacher can see it;; I'd like to save it so he can hear the audio as well, but when  I render it it saves as a .png and doesn't have sound.

Yesterday I was working on a simple animation, an animated logo.   Here is an image of the progress:    I already have the animation working and everything is okay with the project, but I can't figure out how I can render the animation and turn it into an AVI format video.  How do I render an animation in Blender?


I have an understanding of what $\limsup$ and $\liminf$ are as set theoretic limits.  I've also found a lot of explanations of how to think about them. I'm having trouble reproducing the arguments quickly though. Besides memorizing, do you have a quick way of remebering which order the intersection and union should be in?

What is an intuitive interpretation of the 'events' $$\limsup A_n:=\bigcap_{n=0}^{\infty}\bigcup_{k=n}^{\infty}A_k$$ and $$\liminf A_n:=\bigcup_{n=0}^{\infty}\bigcap_{k=n}^{\infty}A_k$$ when $A_n$ are subsets of a measured space $(\Omega, F,\mu)$. Of the first it should be that 'an infinite number of those events is verified', but I don't see how to explain (or interpret this). Thanks for any help!


I have a (Winforms) DataGridView and I want the vertical scroll bar to be viewable even when it is not yet required. Currently, if the number of rows in the DGV do not exceed the height of the DGV there is no vertical scroll bar:    When more rows are then added the scrollbar makes an appearance but seems to cover part of the last column:    I haven't been able to find anything on this specific circumstance online but am hoping someone out thee knows what is going on and advise if I am able to have the scroll bar show (albeit disabled??) even when it is not yet needed.

I have a winform in vs2008 that contains a DataGridView. The datagrid contains a list with several columns. These are fixed width, exept one that I have set up to take whatever space is left and fill the width of the view. The winform is resizeable in all directions.  The issue I am trying to solve is that when I increase the vertical size of the window the scrollbar disappears and the columns snap to the right to fill the extra space. What I would like to happen is that the vertical scrollBar never disappears. Setting ScrollBars to vertical in the properties of the DataGridView does not do this.  Is this at all possible to achieve? And, if so, how do I get the vertical scrollbar to always be visible?


Some people have suggested that the Dark Lord has invented the three Unforgivable curses.  I don't think this is true, but there are certainly some good arguments to suggest it.   None of the curses were mentioned in the prequel film Fantastic Beasts and Where to Find Them, which plays before the Dark Lord's time. The Dark Lord and his followers have used all three in the war significantly.  The killing curse even counts as the signature spell of the Dark Lord. People have pointed out that singling out these three spells as “Unforgivable” seems arbitrary and possibly politically motivated.  What better argument is there to ban certain spells can there be than to just choose the ones the most evil wizard ever have invented? The Dark Lord was powerful, talented, and smart, which are useful for inventing new spells. He has “travelled far and wide” after he graduated from Hogwarts (according to Chamber of Secrets chapter 18), and he has killed lots of  people.  I take this as meaning that he has gained a large amount of experience, which he could then possibly spend on researching spells.   Do we have proof that the Dark Lord has invented none of the three Unforgivable spells?

What is the history of the Unforgivable curses?     ‘Now ... those three curses – Avada Kedavra, Imperius and Cruciatus – are known as the Unforgivable Curses. The use of any one of them on a fellow human being is enough to earn a   life sentence in Azkaban. That’s what you’re up against. That’s what I’ve got to teach you to fight. You need preparing. You need arming. But most of all, you need to practise constant,   never-ceasing vigilance. Get out your quills ... copy this down ...’ [Mad-Eye Moody]   They spent the rest of the lesson taking notes on each of the Unforgivable Curses.   Goblet of Fire - page 192 - Bloomsbury - chapter 14, The Unforgivable Curses   ★ I'm looking for a canon-based answer (the Harry Potter novels, the three supplemental books, interviews with JKR, or Pottermore) and do not prefer an answer from either the HP Wikia or the Wikipedia.


When I found missing '=' in codes, I cannot edit coz of Edits have limitation, at least 6 character must change.

I just attempted to fix a typo on a question on cooking.stackexchange.com and saw this     Oops! Your edit couldn't be submitted because:         Your edit summary must be at least 10 characters   This edit is less than 6 characters; surely more can be improved with your edit?      So, misspelled words have to just be left misspelled?  That could prevent the post from being found in a search.


My software Updater is no longer working. the computer tells me i need to check from updates, it shows a red triangle symbol that if you click it give me an option to show updates but when i do the software updater either doesn't open or takes an extrodinary long time to do so. When i finally do get it open it either says that the software is update or checks for updates and fails to download repositories. I'm not very knowledgeable about linux or ubuntu yet so if i could get some help that would be great.   these are the last few lines of what the terminal outputed:  W: Failed to fetch http://ppa.launchpad.net/deluge-team/ppa/ubuntu/dists/raring/main/binary-amd64/Packages  404  Not Found  W: Failed to fetch http://ppa.launchpad.net/deluge-team/ppa/ubuntu/dists/raring/main/binary-i386/Packages  404  Not Found  E: Some index files failed to download. They have been ignored, or old ones used instead.

PPA seems to be constantly offline. Whenever I use sudo apt-get update, this error is shown:  W: Failed to fetch http://ppa.launchpad.net/ 404  Not Found   How do I fix these errors?


What is the portable and canonical way to test if variable is empty/undefined in a shell script? It should work in all sh-like shells. What I do now is something like:  if [ -z "$var" ] ; then     ...   and for reverse, doing something when variable is not empty/undefined:  if [ -n "$var" ] ; then     ...   And while these work for the scripts I write now, I'd like to know a way, that will work in any reasonably compatible sh-like shell, even on some more obscure environment than a Linux PC with GNU userland and bash or dash.  I'm looking for an "expert answer" from someone who is experienced in different shell environments and knows the pitfalls of different ways of doing things, not an opinion like "that should work".

I see this often in the build scripts of projects that use autotools (autoconf, automake).  When somebody wants to check the value of a shell variable, they frequently use this idiom:  if test "x$SHELL_VAR" = "xyes"; then ...   What is the advantage to this over simply checking the value like this:  if test $SHELL_VAR = "yes"; then ...   I figure there must be some reason that I see this so often, but I can't figure out what it is.


I just stumbled across a simple one-sentence computer security question on Stack Overflow that is copied directly from the textbook. No further explanation, nothing done to show any understanding or effort on the part of the asker.  What is typically done in this situation? I was tempted to immediately call him/her out in a comment, but I don't actually know if there is a policy against this or not. Is there? What should my response be?

Previously someone suggested , resulting in the description of "Not a real question" being broadened.  I believe the two are far from identical, and shouldn't be grouped under the same category, unless you can act upon them in the same way.  To demonstrate, consider the following examples:     How can I calculate the square root of a number in C#?   This is a real question which doesn't fit the "Not a real question" description, but does indicate no effort.     I'm producing an API for soem common applicaitons. How can I make sure that they applications that were built under 3.5 can run the new 4.0 api?   With some effort, a real question can be recognized. "How can an application which targets .NET 3.5 use an API which targets .NET 4.0?"  This discussion is meant to be two-folded:   Isn't there a difference between the current "Not a real question" and "No effort questions"? In case there is, how to best handle a "No effort question"? Closing it as "Not a real question" seems not appropriate, clear and constructive.   P.S.: To be clear, this is not a proposal to add "No effort question" as a closing reason. I merely want to point out we should either be looking for ways in which to distinguish them better, or handle better.


We have a number of custom computer systems that need to be networked and temporarily installed around a football stadium - each computer has it's own network switch.  These computers all need to be networked to a central computer.  Up to this point, we've been daisy chaining the switches so as not to exceed cable length limits and putting the server in the middle of the chain with 5 computers/switches going off on one chain, and 5 going off in another chain and everything has worked great.  I checked network utilization on the server when looking at the network traffic from one computer, the utilization was about 0.13% of the gigabit connection, and all of the switches at each computer located throughout the stadium are gig switches.  We're running into some situations where we need to increase the number of computers/switches and possibly move the server to the end of the chain, meaning the server could be at the end a chain of 20 switches.  Home-runs are not an option due to exceeding gig network cable lengths (300ft) and fiber would be much too costly.  So, I know that it's not recommended to daisy chain network switches, but I haven't read anywhere hard and fast that says you can't do it.  Further, there is no other traffic on this network other then those computers which send small amounts of data over the network to the server.  Besides not being recommended for a standard office network (which this is not), will we run into any major issues?  When daisy chaining multiple switches, is it just a matter of excessive traffic on the uplinks closest to the server, or are there other switch routing/timing/processor issues that we would run into?  Thanks! Mike

I would like to know how many switch can be stacked with fiber channel to get a best transfer rate between computers.  I have 200 computers connected to 12 3Com switches. All switches have two fiber ports.  Is the best way to have fiber backbone switch and connect fiber channel from every switch to the backbone? Or connect switch 1 to switch 2 to switch 3 to ... switch 12 to switch 1 again?  Thanks!


When I was navigating to a question and entering comments, I incorrectly pressed some key near the Enter key and the question I was commenting in gets highlighted. When I inspect element the highlighted element block, I noticed the keyboard-selected class added to the question class div element. What is the use of the option and using which key I can make the div highlight like this,

So when you use the comment shortcut C, you get the comment box appearing. However, you will get a weird black box.  Here's a picture of before:           And afterwards:           And after reloading, it disappears! This seems weird.  And after looking at the HTML, this seems to be the problem:  <div data-questionid="260187" id="question" class="question keyboard-selected">   After removing the class attribute, the box goes away.


I am confused about shell fulfillment after argon.   Argon is 2, 8, 8  1s2  2s2  2p6 3s2 3p6  why is their not elements hear that are starting to filling the 3d shells  Potassium 2, 8, 8, 1 1s2  2s2  2p6 3s2 3p6  (why is 3d shell missing?)  4s1(how can this shell fill with nothing underneath it)  calcium 2, 8, 8, 2 1s2  2s2  2p6 3s2 3p6 (again 3d shell missing?)  4s2  scandium 2, 8, 9, 2?  1s2  2s2  2p6 3s2 3p6 3d1 4s2(why is their not a element between calcium and scandium that has   1s2  2s2  2p6 3s2 3p6 3d1 4s1)   titanium 2, 8, 10, 2? 1s2  2s2  2p6 3s2 3p6 3d2 4s2(why is their not a element between scandium and titanium that has   1s2  2s2  2p6 3s2 3p6 3d2 4s1)  vanadium 2, 8, 11, 2? 1s2  2s2  2p6 3s2 3p6 3d3 4s2(why is their not a element that has   1s2  2s2  2p6 3s2 3p6 3d3 4s1)   chromium 2, 8, 13?, 1? 1s2  2s2  2p6 3s2 3p6 3d5(why is their not two elements 3d4 4s1 and 3d4 4s1) 4s1(the fact that 4s has only 1 electron in it makes me think it that we are missing elements.)  manganese 2, 8, 13, 2 1s2  2s2  2p6 3s2 3p6 3d5 4s2  what is the pattern that it follows? there are many more in the higher elements that follow this pattern of not filling some shells.  don't shells have to fill up bottom up if not why not? Why do the subatomic partials make it do this?

Why do electrons not fully fill up all the orbitals sequentially? By this I mean: why don't the electrons fully take up the previous orbit first and then move onto the next orbit? Take calcium for example, it's electron config is 2, 8, 8, 2. Why isn't it 2, 8, 10? Why does another orbit need to be created when there are still many spots to fill up?  (I know that this is a chemistry question in a physics forum, but I really could not find a chemistry or even a broader science type forum here )


I want to change the value of the dictionary in another file   file1.py   a = {"a":"cat"}    file2.py  a["a"] = "dog"

The __debug__ variable is handy in part because it affects every module. If I want to create another variable that works the same way, how would I do it?  The variable (let's be original and call it 'foo') doesn't have to be truly global, in the sense that if I change foo in one module, it is updated in others. I'd be fine if I could set foo before importing other modules and then they would see the same value for it.


How can you detect if text has overflown? For example, the following text is longer than it's div container allows. How can I detect this in javascript?  <div style="max-width: 100px; white-space:nowrap; overflow: hidden;">     Lorem ipsum dolor sit amet, consectetur adipisicing elit </div>

Can I use JavaScript to check (irrespective of scrollbars) if an HTML element has overflowed its content? For example, a long div with small, fixed size, the overflow property set to visible, and no scrollbars on the element.


I cannot solve this infinite series by any means using polynomial ascending power expansions...  $$1+\sum_{i=1}^\infty(1/2)^i \prod_{k=1}^i\frac{3k-1}{3k}$$ Could somebody help me?

Evaluate : $$1+\frac{2}{6}+\frac{2\cdot 5}{6\cdot 12}+\frac{2\cdot 5\cdot 8}{6\cdot12\cdot 18}+\ldots$$  thought: I have tried to manipulate the series so that the sum upto n terms , can be simplified. But I can't figure out any profitable result.


I am wondering why do I get NPE in the following code:   @Override public void updateItem(String item, boolean empty) {     if(empty){         super.updateItem(item, empty);         return;     }     MyTableRow currentRow = (MyTableRow) getTableRow().getItem();     currentRow.stringProperty(); // here I get NPE }   The code snippet is from a custom TableCell, where the updateItem is overridden. At the commented line I get NPE, while the item is not null, and also empty is false. For me that means there is a row, so the getTableRow().getItem() should not be null. That is true and is a solution(or an unnecessary workaround?) to make a nullcheck after I get the item's reference, but I think that is unnecessary. Did I missed or this is an expected outcome?

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 trying to install a xubuntu version greater than 10.04, but it doesn't work. I run the program via a usb stick. I can access to the menu just after I choose my keyboard. I choose "Install" or "Try Xubuntu without installing", then I get an error set power failed status. So I shutdown the PC and I re run the install program with blacklist=firewire_ohci in paramaters. I don't get the error anymore with this line. Xubuntu is loading and after a couple of seconds, the loader stops and doesn't continue.   I tried differents versions (12.04,13.04,15.10,16.04) but none of them work. I have an Acer Travelmate.

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 have Ubuntu 14 installed and it dual boots with Windows 10. I want to extend the size of the Ubuntu partition.   I followed this article:   But when I swapoff my linux-swap, it says "Please unmount any logical partitions having a number higher than 5"  How do I resize now?   Here is the image:     I have 15GB and 4.5GB unallocated. How do I extend my current Ubuntu partition?

How can I expand/resize my extended partition (sda3) with unallocated free space to the left of it? I want this to be able to expand my / partition (sda5).


Let $n_1 < n_2 < n_3 < n_4 < n_5$ be positive integers such that   $n_1 + n_2 + n_3 + n_4 + n_5 = 20$.  Then the number of such distinct arrangements $(n_1, n_2, n_3, n_4, n_5)$ is   My attempt First thing is that one would not be able to use stars and bars technique as the numbers cannot be equal. Hence I tried to count all the cases up to 20 which gave the answer as $7$ possibilities.    $$n_1 + n_2 + n_3 + n_4 + n_5 = k$$  Or   $$n_1 + n_2 + n_3 + n_4 + n_5 + n_6 + n_7 + \ldots + n_j = k$$  However , generalising it for an integer $k$ , counting each time would be tedious if $k$ is large.  I was hoping someone could suggest an alternate way to solve such problems ?

Let $n_1 < n_2 < n_3 < n_4 < n_5$ be positive integers such that $n_1 + n_2 + n_3 + n_4 + n_5 = 20$. Then the number of such distinct arrangements $(n_1, n_2, n_3, n_4, n_5)$ is...... I have no idea how to proceed. Manually, I have done it $$1+2+3+4+10$$ $$1+2+3+5+9$$ $$1+2+3+6+8$$ $$1+2+4+5+8$$ $$1+2+4+6+7$$ $$1+3+4+5+7$$ $$2+3+4+5+6$$ But is there any way I can do it by Permutation and Combination method?


I have an issue with the text editor on Ubuntu 20.04. With dark mode enabled, the highlighted text is not readable.   Is there any way to fix this?

I am unable to see what I type in the Gedit editor using dark theme.  This is due to the default setting of highlighting the current line.


I was trying to solve an exercise about derived random variables, but I am stuck on deriving the boundaries to calculate expectation and variance.     The random variable $X$ is exponentially distributed with parameter $\lambda= 1/2$. Furthermore, define $Y= 1−2X$. Calculate $E(Y)$ and $\operatorname{Var}(Y)$.   .  It would be much appreciated if someone could help.

The random variable $X$ is exponentially distributed with parameter $\lambda = \dfrac{1}{2}$. Also, define $Y = -2X + 1$. Calculate $E(Y)$ and $Var(Y)$.  So we have   $$f_X(x) = \dfrac{1}{2} e^{-\dfrac{1}{2}x} $$  if $x\ge0$ and $0$ otherwise.  But how to calculate $E(Y)$ and $Var(Y)$ ?


Question: In a triangle, a median is the line segment that connects a vertex with the midpoint of the opposite side. Prove that in a triangle with side lengths a, b, and c, the length Mc of the median, drawn to the side with the length c, is equal to Mc = 1/2 * √(2*a^2+2*b^2-c^2)  I have been hinted that I can begin by finding the cosine of the angle opposite to side b. I thought about beginning by trying to find the area of the triangle, but I am not sure if that would work and how I should proceed.

In the below image    $AD$ is the median of $\triangle ABC$  We know that $m_A = \frac 1 2 \sqrt{2b^2 + 2c^2 - a^2} $    But can someone tell me how it's derived !! I am just unable to think of it !!   But I assume it muste be linked with the Appolonius Theorem !!