I am trying to add figures and tables in Lyx. But, figures and tables overlap with other textual data. Below I have added images of the problem. Could someone help to solve this issue?

I have a two-column LyX document. I want to add a table that will be as wide as the entire page, so that it will not have to be squeezed into a single column. I found some suggestions:   , however, I have no idea how to implement them in LyX...


I would like to produce a document with two lists of references. One should have numbered items, another should have "E" prepended to the number. Here is my solution that does not work  \documentclass[11pt,a4paper]{article} \usepackage[sort&compress,numbers]{natbib} \bibliographystyle{apsrev4-1} \usepackage[]{times} \usepackage[varg]{txfonts}  \usepackage[resetlabels,labeled]{multibib} \newcites{E}{Other references}  \begin{document} \section{Example} This is one paper~\cite{hedin_new_1965} \section{Another example} This is another paper~\citeE{kohn_self-consistent_1965}. \bibliography{MyLibrary} \bibliographystyleE{apsrev4-1} \bibliographyE{MyLibrary} \end{document}   My bibliography is as follows:  @article{hedin_new_1965,  title =     {New Method for Calculating the One-Particle Green's Function with               Application to the Electron-Gas Problem},  volume =    139,  number =    {{3A}},  journal =   {Phys. Rev.},  author =    {Hedin, Lars},  year =  1965,  pages =     {A796--A823},  }  @article{kohn_self-consistent_1965,  title =     {Self-Consistent Equations Including Exchange and Correlation Effects},  volume =    140,  number =    {4A},  journal =   {Phys. Rev.},  author =    {Kohn, W. and Sham, L. J.},  year =  1965,  pages =     {A1133--A1138},  }   After running pdflatex example.tex + bibtex example + bibtex E + (x2) pdflatex example.tex I've obtained:   As you see, the "E" is missing. Am I doing something wrong?  Bonus question  Is it possible to make labels of the second list of references to be numerals in boldface?  Your help is greatly appreciated. Thank you in advance!

I am facing a problem when using natbib together with multibib and label prefixes. I want to define two bibliographies: One for literature of other people, with numbered references, and one for my own literature, also with numbered references, but with a prefix "O" before each reference (the multibib labeled option). Without natbib (only using multibib), it works fine. But together with natbib, the "O" prefix vanishes in the text. In the bibliography, it is still there. I need to use natbib because the sort&compress feature.  Working minimal example:  \documentclass{scrbook}  \usepackage{filecontents} \begin{filecontents}{main.bib} @ARTICLE{travis,   author = {Brehm, M. and Kirchner, B.},   title = {TRAVIS - A free Analyzer and Visualizer for Monte Carlo and Molecular     Dynamics Trajectories},   journal = {J. Chem. Inf. Model.},   year = {2011},   volume = {51 (8)},   pages = {2007-2023},   owner = {Brehministrator},   timestamp = {2011.11.27} }, @ARTICLE{welton2001,   author = {L. Cammarata and S. G. Kazarian and P. A. Salter and T. Welton},   title = {Molecular states of water in room temperature ionic liquids},   journal = {Phys. Chem. Chem. Phys.},   year = {2001},   volume = {3},   pages = {5192-5200},   owner = {Brehministrator},   timestamp = {2011.12.11} } } \end{filecontents}  \usepackage[square, sort&compress, super, comma]{natbib}  \usepackage[labeled,resetlabels]{multibib}  \newcites{O}{Own Publications}  \begin{document} \chapter{Introduction}  Citing my own literature\citeO{travis}. Citing other people's literature\cite{welton2001}.  \appendix \bibliographystyle{plain} \bibliographystyleO{plain} \bibliography{main} \bibliographyO{main}  \end{document}   To compile this, you need to run bibtex separately on "main" and on "O".


When I try to run sudo apt-get update, I get these errors: E: The repository 'http://ppa.launchpad.net/damien-moore/codeblocks-stable/ubuntu bionic Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details.  What could be the issue? How can I solve this?

When updating, I get the following error message:   W: The repository 'http://ppa.launchpad.net/mc3man/trusty-media/ubuntu xenial Release' does not have a Release file.   Here, I find another statement on this error:   This recommends removing certain PPAs; and, I'm not sure if I should do that since it might mean not getting the updates that I need.    Is this what I should do?


For example, I have a string, "     some string", and I want to put "some string" in another string variable. How do I do that?  My code:  function get_title() {     t1=$(get_type "$1")     t2="ACM Transactions"     t3="ELSEVIER"     t4="IEEE Transactions"     t5="MIT Press"     if [ "$t1"=="$t2" ];         then         title=$(less "$1" | head -1)     elif [ "$t1"=="$t5" ];     then         title=$(less "$1" | head -3)     fi     echo "$title" }   As you can see the $title can return unwanted whitespace in front of text in center aligned texts. I want to prevent that.

I have a shell script with this code:  var=`hg st -R "$path"` if [ -n "$var" ]; then     echo $var fi   But the conditional code always executes, because hg st always prints at least one newline character.   Is there a simple way to strip whitespace from $var (like trim() in )?   or   Is there a standard way of dealing with this issue?   I could use  or , but I'd like to think there is a more elegant solution to this problem.


I am wondering about punctuation in this sentence:     In this case the main focus was on intuitiveness and learnability.   Should I put a comma after "case"? If so, why?

I am no native speaker and always confused about the comma in introductory phrases, in particular in prepositional phrases. Is there any hard rule when a comma must be set? If I make a google search for certain phrases, I often find both variants. Typical examples where I am not sure whether a comma must be set are:        First[ly][,] I must phone mother   In this case[,] we must...   For simple problems[,] the algorithm...   From Lemma 1.2[,] we obtain...   For a typical user[,] the algorithm...   In our theory[,] we...   A dark line on the horizon[,] the mountain range we were headed for seemed somehow not as threatening as when we had started out on the trip.   Avidly reading her novel[,] Jane did not notice that her stop was approaching.   To be sure[,] it is not easy to see a solution.   When you get to Rome[,] give me a ring.


I am not a physicist, but I was wondering what observation led to the conclusion that a particle can be at two (or is it multiple) places at the same time?

So I've been reading a bit and watching some videos about the double slit experiment, and therefore the wave particle duality; I've also read this "implies" that a particle can be in two places at the same time. Can you clarify this, and how could that be possible?


I have a scene with animated objects. In 3d view and camera view i can see them perfectly with material and textures  but every time i render (F12) i get this result  just a transperent screen i tried to put the objects into another scene/project but they didn't appear also it once said there aren't any objects in there...

This is meant to solve this problem once and for all. What is every reason an object isn't showing up in a render or viewport in when using the cycles render engine?


I am trying to understand ANOVA.  When we look at the null hypothesis we are trying to make a statement about the means. But what we indeed calculate is the variances, and make statements about the null hypothesis based on the F-test.   My question is how does calculating variances help in understanding about the mean, or rather make a statement about the means? Kindly clarify.   Thanks, G Ravi Kiran.

I need to explain the intuition behind what ANOVA is doing to a non-technical person. Is there a visual that explains the idea? A visual that illustrates the key idea in the context of a one-way ANOVA with perhaps 3 factor levels might be helpful?  Let us suppose that the person has taken some statistical courses as a student in the distant past but has forgotten the details of even performing a z-test. However, he/she remembers that hypothesis testing is used to check if the observed effects are due to random chance or due to a real change in the parameter of interest.


If 2 magnets are kept close to each other they attract then shouldn't it be considered as work done by magnetic field?

I learned that the force from a magnetic field does no work. However I was wondering how magnets can be used to pick up pieces of metal like small paperclips and stuff. I also was wondering how magnets can stick to pieces of metal like a refrigerator?


I know that proper nouns are capitalized but why is it even necessary? are all capitalized words read in the same way as non capitalized ones?

Is it incorrect grammar to make the first letter of a proper noun small letters ?  I found that most of the online grammar checkers will mark it as an error if you don't  capitalize the first letter of a proper noun. What's the logic behind that.


I want to convert this string "Fri, 03 Jun 2016 08:01:26 GMT" to datetime in python.  Thanks in advance

I've got a huge list of date-times like this as strings:  Jun 1 2005  1:33PM Aug 28 1999 12:00AM   I'm going to be shoving these back into proper datetime fields in a database so I need to magic them into real datetime objects.   This is going through Django's ORM so I can't use SQL to do the conversion on insert.


$G=(GL_2(\mathbb R),.)$ be group of all invertible $2x2$ matrices with coefficients in $\mathbb R$ under multiplication.    Find the $Z(G)$  I am having trouble with finding it. We know that elements of $GL_2(\mathbb R)$ have non-zero determinant. Namely, $A\in GL_2(\mathbb R)$ such that $A=\begin{pmatrix} a &b\\ c & d \end{pmatrix}$ then $ad-bc\not=0$. And if $\begin{pmatrix} x & y\\ z & t \end{pmatrix}$ in the center of $G$  Then:  $\begin{pmatrix} x & y\\ z & t \end{pmatrix}\begin{pmatrix} a &b\\ c & d \end{pmatrix}=\begin{pmatrix} xa+yc & xb+yd\\ za+tc & zb+td \end{pmatrix}=\begin{pmatrix} ax+bz & ay+bt\\ cx+dz & cy+dt \end{pmatrix}=\begin{pmatrix} a &b\\ c & d \end{pmatrix}\begin{pmatrix} x & y\\ z & t \end{pmatrix}$  It follows that:   $bz=yc$ $xb+yd=ay+bt$ $cx+dz=za+tc$   As you can see it is very messy, is there any method avaible that help us to find  the center (method can be advanced or elementary.).   Edit:  I didnot know this question has duplicate (sorry about it). However, in given links these are prove-disprove question, I rather than wonder that why someone thinks that center of $GL_2(R)$ should be $Z\bigl(GL(2,\mathbb R)\bigr)= \left\{ \pmatrix{ a & 0 \\ 0 & a } \,\middle|\, a \in \mathbb R\setminus\{0\} \right\}$. Where did the thought come from? Is it too stupid to be curious about ? :)

The given question:  Let $k$ be a ﬁeld and $n \in \mathbb{N}$. Show that the centre of $\operatorname{GL}(n, k)$ is $\lbrace\lambda I\mid λ ∈ k^∗\rbrace$.  I have spent a while trying to prove this and have succeeded if $ k \subseteq \mathbb{R}$. So I imagine there is a nicer way to go about this. I have seen people saying take matrices where every element except one is zero in proving similar results but such matrices are not in $\operatorname{GL}(n,k)$ as they are not invertible.  What I have done.  I have said let $B \in$ Center then $B$ commutes with everything in $\operatorname{GL}(n,k)$. So take a permutation matrix, $P$ which swaps rows $i,j$ $P \neq I$. From this you can deduce that $B^T = B$ and that $B_{ii} = B_{jj}$. We can use the fact that $B$ is symmetric to find an orthogonal diagonalisation of $B$ by the spectral theorem.  This gives $QBQ^T = D \rightarrow B=D$. And as $B_{ii} = B_{jj}$ we can say $B = k * I$.   But the spectral theorem requires $B$ to be a real matrix.   How do I prove this for a general $k$?.


When I change device orientation, I am able to change layout properly but its also load data every time from  web service. There is no need to call  web service  each time.  So please suggest.

In my Android application, when I rotate the device (slide out the keyboard) then my Activity is restarted (onCreate is called). Now, this is probably how it's supposed to be, but I do a lot of initial setting up in the onCreate method, so I need either:   Put all the initial setting up in another function so it's not all lost on device rotation or Make it so onCreate is not called again and the layout just adjusts or Limit the app to just portrait so that onCreate is not called.


How to vertically center span with float:right in div?

TEST

       TEXT
       TEXT
       TEXT
       TEXT

  .card {   width: 200px;   }  .card-header h5 {   display: inline; }  .card-header span {   float: right; }   In this example fa icon in span is align to top.  How can I vertically align this span?  jsfiddle:

I have a div with two images and an h1. All of them need to be vertically aligned within the div, next to each other. One of the images needs to be absolute positioned within the div. What is the CSS needed for this to work on all common browsers?

testing...


What is $P(W_t>0,W_s>0)$?  Since increments are independent it may be helpful to split it into two processes as $W_t=W_{t-s}+W_s$.  Each of it has Gaussian probability density function and I think that pdf of sum of two independent processes may be evaluated as in case of independent random variables: $f_{W_s+W_{t-s}} (t) = \int\limits_{-\infty}^{+\infty} f_{W_s}(s) f_{W_{t-s}}(t-s) ds = \frac{1}{\sqrt{4\pi \sigma^2}}e^{\frac{-(-2\mu+t)^2}{4\sigma^2}} \sim N(2\mu,2\sigma)$.  What should I do next? If I integrate it over the area $0<t<+\infty$ than I will find probability that $W_s+W_{t-s}>0$, but I can't proceed forward.

Let $0<s<t$ and $(B_r)_r$ is Brownian motion. Does anybody know what $P(B_s>0,B_t>0)$ is? I think I remember it was some $arctan$-law but I don't know the exact form. So I do not need a proof, stating the result would be completely sufficient, but I could not find it using google.  Thank you for your help.


I've two step motors with 12V-0.4A each, A4988 as stepper motor driver and CNC shield on Arduino. As I know I should use at least 2x voltage for stepper motors and I would like to know, if I use 24V-4.5A power supply, can it lead to any problem with these devices?  Or should I use something equal to needed current? (2*0.4A + cnc shield etc. let's say 1A for example...)

Power supplies are available in a wide range of voltage and current ratings.  If I have a device that has specific voltage and current ratings, how do those relate to the power ratings I need to specify?  What if I don't know the device's specs, but am replacing a previous power supply with particular ratings?  Is it OK to go lower voltage, or should it always be higher?  What about current?  I don't want a 10 A supply to damage my 1 A device.


I need to get the element co-ordinates relative to browser window. How do you get that in javascript ?

I want to know how to get the X and Y position of HTML elements such as img and div in JavaScript relative to the browser window.


In field theory, symmetry governs the dynamics by restricting the form of the Lagrangian from which all relevant equations and interactions are derived. An example of symmetry transformations is multiplication of the fields by a complex number. When we make different transformations at different space-time points, we must introduce a new field in order to maintain the symmetry. This new field is called the gauge field and is responsible for the interactions among various particles.   Why is it that: "When we make different transformations at different space-time points, we must introduce a new field in order to maintain the symmetry."?  Can someone please explain this?

I've been watching  and in one lecture, he discusses a very simple gauge theory.  We have a complex scalar field $\phi(x)$ with Lagrangian  $$\mathscr{L} = \partial_\mu \phi^* \partial^\mu \phi - V(\phi^* \phi)$$  and we want to do the gauge transformation $\phi(x) \to e^{i\theta(x)} \phi(x)$.  But the derivative term in the Lagrangian is not invariant if $\theta$ varies from place to place, so we add a new vector field $A_\mu$, and define it to transform like $$A_\mu \to A_\mu + \partial_\mu \theta$$ under the gauge transformation.  Then we change the Lagrangian to use covariant derivatives $D_\mu = \partial_\mu + iA_\mu$ instead of ordinary ones; now when the gauge transform is done all the derivatives of $\theta$ cancel out, and the result is invariant.  My question is: was there any freedom in choosing to add a vector field, with that specific gauge transformation law?  Are there any other ways we could get gauge invariance here—by using a different transformation law, or with a different type of field (say, a scalar, tensor, or spinor) with some other transformation law?  More generally, how can we tell what type of field is needed and what its gauge transformation law should be, to get some particular Lagrangian to be invariant under some particular gauge transformation?


i am trying to read / understand the book: Introduction to the modern theory of dynamic systems, hassleblatt boris and katok anatole.  On page 28 there is an excercise which I am trying to solve but have no clue how it would work. I guess it is not very hard but I'm not getting any further.  I hope someone can help me.  1.3.1 Exercise: Prove that the decimal expansion of the number $2^n$ may begin with any finite combination of digits.

Prove that for any finite sequence of decimal digits, there exists an $n$ such that the decimal expansion of $2^n$ begins with these digits.


Problem:  Even with dev null and disown.. web browser is still reporting errors to the terminal it launched from of.    web_browser < /dev/null > /dev/null 1>&2 & disown

I don't quite understand how the computer reads this command.  cat file1 file2 1> file.txt 2>&1  If I understand, 2>&1 simply redirect Standard Error to Standard Output.  By that logic, the command reads to me as follows:    concatenate files file1 and file2.  send stdout from this operation to file.txt. send stderr to stdout. end?   I'm not sure what the computer's doing. By my logic, the command should be   cat file1 file2 2>&1 > file.txt   but this is not correct.


I would like to implement something like default in a switch statement, but for .is choice pgf key. I know that there is an error key handler /errors/unknown choice value but I don't know how to use it. Or may be there is a solution without implementing this handler ?  What I want is when I define for example test/.is choice, to be able to define something like test/.else style={...} that is executed for any test=<unknown choice> with #1 set to <unknown choice> (like if test was not a choice).  \documentclass[tikz,border=7pt]{standalone} \tikzset{   test/.is choice,   test/1/.style={red},   test/2/.style={blue},   % test/.else style={yellow} <-- how to implement this ? } \begin{document}   \begin{tikzpicture}     \fill[test=1] circle(3);     \fill[test=2] circle(2);     \fill[yellow] circle(1); % I would like [test=007]   \end{tikzpicture} \end{document}     Note: I asked myself this question when I was writing .  EDIT After  of @TeXnician I want to specify that I would like to be able to declare something like test/.else style={#1} and then use it like this test=yellow (the parameter is important for me).

Why is the parameter value not being passed to my code for the unknown key value here?  \documentclass{article} \usepackage{pgfkeys}  \makeatletter \def\ae@size{2cm} \pgfkeys{/ae/example/.cd,   size/.is choice,   size/small/.code=\def\ae@size{I am small},   size/medium/.code=\def\ae@size{I am medium},   size/large/.code=\def\ae@size{I am large},   size/.unknown/.code={\typeout{UNKNOWN  ----> #1}\def\ae@size{I am customized to#1}}, } \newcommand\problem[1]{%%   \pgfkeys{/ae/example/.cd,#1}%%   \ae@size     \par } \makeatother \begin{document}  \problem{size=small} \problem{size=medium} \problem{size=large} \problem{size=a different size}  \end{document}


With real examples and their use, can someone please help me understand:  When do we need a  delegate? When do we need an  delegate? When do we need a  delegate?

Can someone provide a good explanation (hopefully with examples) of these 3 most important delegates:   Predicate Action Func


I have a pair of longitude and latitude coordinates, and I want to plot a 500 meter buffer around it using leaflet or mapview. st_buffer, however, does not correctly buffer longitude/latitude data.   Initial code:  library(rgeos) library(rgdal) library(sf)  df <- data.frame(lon = -121.9552, lat = 37.35411) coordinates(df) <- c("lon", "lat") proj4string(df) <- CRS("+init=epsg:4326")  df_sf <- st_as_sf(df) #.... # Something goes here, but I don't know what? #... st_buffer(df_sf, 500)  Warning message: In st_buffer.sfc(st_geometry(x), dist, nQuadSegs) : st_buffer does not correctly buffer longitude/latitude data   What's the missing piece?

I would like to calculate a buffer of 5km around country polygons. However, I somehow always get a warning and an error. Here is a reproducible example code.   library(sp) library(sf) library(tmap)  library(rnaturalearth) countries_sp <- ne_countries(scale = 10)  countries_sp <- countries_sp[(countries_sp@data$geounit %in% "France"), ]  proj4string(countries_sp) <- CRS("+init=epsg:4326")   countries_for_buff <- st_as_sf(countries_sp, crs ="+proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs ")  countries_buff_5km <- st_buffer( countries_for_buff, 5000)   here the warning:  dist is assumed to be in decimal degrees (arc_degrees). Warning message: In st_buffer.sfc(st_geometry(x), dist, nQuadSegs, endCapStyle = endCapStyle,  : st_buffer does not correctly buffer longitude/latitude data   Then   tm_shape(countries_sp) +   tm_polygons() + tm_shape(countries_buff_5km) +   tm_polygons()   gives the error   Error in if (all(tiny) && show.messages) warning("all relative area sizes are below thres.poly",  :     missing value where TRUE/FALSE needed   What am I doing wrong? I guess there is something about the projection that does not quite work out the way it should.


We assume the regularity of $L$ for the sake of contradiction.     Pumping Lemma: $ \exists n \in \mathbb{N}$ for which $ \forall z \in L$ with $|z|  \geq n$, $\exists u,v,w$ with $|uv| \leq n$, $|v|  \geq 1$ such that $uv^iw \in L, \, \forall i \in \mathbb{N}$.   Let $n \in \mathbb{N}$ and $z = 0^p$ with $p \geq n \iff |z| \geq n$. Then, using the PL: $$ \exists u,v,w \quad \text{such that} \quad 0^p = uvw, \, |v| \geq 1 \rightarrow v = 0^m, \, 1 \leq m \leq n. $$  Since, $uv^iw \in L, \, \forall i \in \mathbb{N}$, this implies that each term of the sequence: $$ a_i = |uv^iw|=p + i \cdot m, \, i \in \mathbb{N} $$ is a prime. Is there a quick way to show that this is false (contradiction)?

I tried using pumping lemma or finding infinite equivalence classes, but I didn't succeed.  It's clear to me that there is no automata that accepts this language, but I just can't formally prove that this language isn't regular.  How can you prove it?


I was looking for a proof for it and all rely on the work-energy theorem. But the work energy theorem relies on the kinetic energy equation. Ergo circular logic. So where did it come from?

As  says:     [...] the kinetic energy of a non-rotating object of mass $m$ traveling at a speed $v$ is $\frac{1}{2}mv^2$.   Why does this not increase linearly with speed? Why does it take so much more energy to go from $1\ \mathrm{m/s}$ to $2\ \mathrm{m/s}$ than it does to go from $0\ \mathrm{m/s}$ to $1\ \mathrm{m/s}$?  My intuition is wrong here, please help it out!


I am moving a PHP application to another server, and I have some issues with the character decoding:  Old server (CentOS with Plesk Panel):  echo htmlentities('ú'), ENT_QUOTES, 'UTF-8'); // Result &uacute; echo html_entity_decode('&uacute', ENT_QUOTES, 'UTF-8'); // Result ú <= expected   New server (Debian dedicated server, fresh install):  echo htmlentities('ú'), ENT_QUOTES, 'UTF-8'); // Result &uacute;     echo html_entity_decode('&uacute', ENT_QUOTES, 'UTF-8'); // Result Ãº <= not expected echo html_entity_decode('&uacute', ENT_QUOTES, 'ISO-8859-1'); // Result ú <= expected   Why is happening this? Maybe a server configuration problem?

I'm setting up a new server and want to support UTF-8 fully in my web application. I have tried this in the past on existing servers and always seem to end up having to fall back to ISO-8859-1.  Where exactly do I need to set the encoding/charsets? I'm aware that I need to configure Apache, MySQL, and PHP to do this — is there some standard checklist I can follow, or perhaps troubleshoot where the mismatches occur?  This is for a new Linux server, running MySQL 5, PHP, 5 and Apache 2.


I am writing a JUnit test case for a method in which I am trying to catch an exception but for some reason my test is not hitting the exception. Method is long but I just need to catch exception which is in the if block.  Method under test:  public void createClient() throws EISClientException {     if( client == null ) {         ClientConfig c = new ClientConfig();          //Add Glocal JSON/Jackson Provider         c.register( JacksonFeature.class );          if ( isDisableSslValidation() ) {               try {                 client = ClientBuilder.newBuilder().sslContext( SslUtil.createGullibleSslContext() )                             .hostnameVerifier( SslUtil.gullibleVerifier ).withConfig( c ).build();             } catch( Exception e ) {                 throw new EISClientException( e );             }         } else {             client = ClientBuilder.newBuilder().withConfig( c ).build();         }          //Add Client Properties         if( clientProperties.size() > 0 ) {             for( String key : clientProperties.keySet() ) {                 client.property( key, clientProperties.get( key ) );             }         }          //Add Client Filters         if( clientFilters != null && clientFilters.size() > 0 ) {             for( IClientFilter cf : clientFilters ) {                 client.register( cf.getFilter() );             }         }      } }   JUnit test:  @Test public void testCreateClientException() throws Exception {     ClientConfiguration clientConfiguration = new ClientConfiguration();     Client client = mock(Client.class);      boolean caughtException = false;     try {         clientConfiguration.setDisableSslValidation(true);         client = ClientBuilder.newBuilder().build();         clientConfiguration.createClient();      } catch (EISClientException ex) {         caughtException = true;     }     assertTrue(caughtException); }   Looks like if the client is not built then throw exception but if I pass null as an argument in any of the methods surely I get NullPointerException.  Any help would be appreciated.  Thanks

How can I use JUnit4 idiomatically to test that some code throws an exception?  While I can certainly do something like this:  @Test public void testFooThrowsIndexOutOfBoundsException() {   boolean thrown = false;    try {     foo.doStuff();   } catch (IndexOutOfBoundsException e) {     thrown = true;   }    assertTrue(thrown); }   I recall that there is an annotation or an Assert.xyz or something that is far less kludgy and far more in-the-spirit of JUnit for these sorts of situations.


I'm new to java, and I've been trying to produce code reversing a string using recursion. I've spent about a day thinking of solutions as to why it's not working as expected, to no avail. At this point in my debugging, the code compiles, but when executing, it produces a "Exception in thread "main" java.lang.NullPointerException" error. Can you tell me what's causing this?  class RevStr {   String str,Final;    RevStr(String string) {     String str=string;     String Final="";   }    void Reverse() {     String str=str;     int count=1;      if(str.length()==1) {       Final+=str;     }     else {       String last=str.substring(str.length()-1);       Final+=last;       str=str.substring(0,(str.length()-1));       Reverse();     }   }    String RetRev() {     return Final;   } }  class ReverseString {   public static void main(String args[]) {     RevStr name=new RevStr("Cameron");     name.Reverse();     String rev=name.RetRev();     //System.out.println(rev);   } }

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?


There was some debate at work the other day as to the correct form in the following case:  1) I don't think you should do that.  or  2) I think you shouldn't do that.  A few of us set off on a Google spiral that threw up a few hits but with nothing - as far as I can tell - with a definitive answer. There were a few threads here, but none that were dealing specifically with this issue.  A few also came up at wordreference, but there was nothing definitive, and some contradictory answers seemed to surface. From the research we found the following:  1) Americans say either, but the British always prefer to put the negative first (as in: I don't think you should). 2) There is a slight variance in meaning (at least denotational if not literally grammatical) when one places the negative first.  There were many other things said, but no research was provided.  So I am asking here if anyone has a definitive answer, or is this simply a stylistic choice possibly conditioned by whatever side of the Atlantic you happened to grow up?  Apologies for the rambling post.  Much appreciated.

Consider the following two sentences:     I don't think you love your father.      I think you don't love your father.   Is the second sentence correct? I was taught that it is wrong.


I want to append some text to the span contentediable input. When appending the text to the span the text cursor will back to the first index of the text. What I want is to remain/set the text cursor at the end of the text after the append text. if you run the codesnippet below, you will see the text cursor is at the first index of the text.   let prevMsg = $('span#chatboxtextarea').text(); let tag_contact = "@Lim"; let inputMsg = prevMsg + tag_contact + " ";   $('span#chatboxtextarea').append(tag_contact).focus(); .chatboxtextarea {   margin-top:5px;   padding: 6px;   border: 1px solid #ABABAB; }  Text

What is the best way (and I presume simplest way) to place the cursor at the end of the text in a input text element via JavaScript - after focus has been set to the element?


I was looking at the JavaScript console in Chrome and noticed something strange, even though they appear the same, obj and JSON.parse(JSON.stringify(obj)) are not the same. Why is that?  var obj = {test:'this is a test', another: {omg:'ay dios mio', check:true}}; console.log(obj, JSON.parse(JSON.stringify(obj))); console.log(obj == JSON.parse(JSON.stringify(obj)));   They look identical but return false when you check equality. Why is that?

A strict equality operator will tell you if two object types are equal. However, is there a way to tell if two objects are equal, much like the hash code value in Java?  Stack Overflow question  is similar to this question, but requires a more academic answer. The scenario above demonstrates why it would be necessary to have one, and I'm wondering if there is any equivalent solution.


Let $G$ be a finitely generated group. Show that if Aut($G$) is the   trivial group, then so is $G$.   I know that if Aut($G$) is the trivial group then $G$ must be abelian but I'm not sure how to use that fact here. What's a good way to show that $G$ is the trivial group, given that Aut($G$) is also trivial?  Note: This question is different from  because there is no proof provided in that question that the opposite is also true, i.e. that $|G| \leq 2 \Rightarrow$ Aut($G$) is trivial.

Well, this is an exercise problem from Herstein which sounds difficult:   How does one prove that if $|G|>2$, then $G$ has non-trivial automorphism?   The only thing I know which connects a group with its automorphism is the theorem, $$G/Z(G) \cong \mathcal{I}(G)$$ where $\mathcal{I}(G)$ denotes the Inner- Automorphism group of $G$. So for a group with $Z(G)=(e)$, we can conclude that it has a non-trivial automorphism, but what about groups with center?


My attempt:  Since $(b_n)_{n \in \mathbb{N}}$ is bounded it follows that there exists a bounded sequence $$(c_n)_{n \in \mathbb{N}}: 0 \leq |b_n| \leq |c_n|, \forall n \in \mathbb{N}$$  Therefore it follows that: $$\sum_{n=1}^{\infty} a_nb_n \leq \sum_{n=1}^{\infty} a_nc_n$$  Since $\sum_{n=1}^{\infty}a_n$ converges absolutely $\Rightarrow$ $\sum_{n=1}^{\infty}a_n$ converges $\Rightarrow (a_n)_{n \in \mathbb{N}} $ is a null sequence $\Rightarrow \exists N \in \mathbb{N}: \forall n \geq N: |a_n| \lt \frac{\epsilon}{|c|p}$, where $c:= max\{c_1,\dots,c_n,\dots\}, p \in \mathbb{N}$  Then it follows that: $$\forall n \geq N: |a_nc_n|=|a_n||c_n| \lt |a_n||c| \lt \frac{\epsilon}{|c|p}|c|=\frac{\epsilon}{p}$$  $$\Rightarrow \forall n \geq N: |a_{n+1}c_{n+1}+\dots+a_{n+p}c_{n+p}|\leq  |a_{n+1}c_{n+1}|+ \dots +|a_{n+p}c_{n+p}| \lt p\frac{\epsilon}{p}=\epsilon$$  So after Cauchy's convergence test, it follows that $\sum_{n=1}^{\infty} a_nc_n$ is a convergent majorant of $\sum_{n=1}^{\infty} a_nb_n$ and therefore $\sum_{n=1}^{\infty} a_nb_n$ converges absolutely.  Was this proof correct?  And a second part of that question is: If $\sum_{n=1}^{\infty}$ converges, but not absolutely, does $\sum_{n=1}^{\infty} a_nb_n$ converge?  For my proof I didn't really needed $\sum_{n=1}^{\infty}$ to converge absolutely, I just used the fact that it converges when it converges absolutely and since I proved that $\sum_{n=1}^{\infty} a_nb_n$ converges absolutely, it converges as well. Is that right?

a) Prove that if $\sum a_n$ converges absolutely and $b_n$ is a bounded sequence, then also $\sum a_nb_n$ converges absolutely.  I wanted to use the comparison test to show it's true, but I think I got something mixed up. Here's what I have so far.  $b_n$ is bounded $\Rightarrow \exists c > 0: |b_k| < c, \forall k \in \mathbb N$  $\sum a_nb_n < \sum a_nc < c\sum a_n$. I'm very tempted to use the comparison test here and say, as $\sum a_n$ converges absolutetly, then so does $c\sum a_n$, but for that I needed the inverted relation, right? I would need $\sum a_n > c\sum a_n$, which is not true. However isn't it obvious that something absolutely convergent multiplied by a constant is also absolutetly convergent? Is there a mathematical way to write this? Thanks a lot in advance.  b) Refute with a counter example: if $\sum a_n$ converges and $b_n$ is a bounded sequence, then also $\sum a_nb_n$ converges.  Is this even possible? I mean, it has to be, but it doesn't make sense to me. If something converges, it means it's bounded, right? And I thought, well, since bounded + bounded = bounded, then bounded*bounded would also get me something bounded again.  Anyway, my idea would be to use for $a_n$ an alternating series that ist only convergent, for example $(-1)^n \frac 1 {n^2}$. But something tells me I'm trying to prove $a_n b_n$ is not absolutely convergent.  Thanks a lot in advance guys!


i have the following list of dictionaries:  my_list = [      {        "field1": value,        "field2": value,        "time": 2017-12-01 14:34:12,        "field3": value     },     {        "field1": value,        "field2": value,        "time": 2017-12-01 14:31:20,        "field3": value     },     {        "field1": value,        "field2": value,        "time": 2017-12-01 14:40:02,        "field3": value     } ]   How can i sort this list by the time value of the dictionaries? (so the dictionary with the highest time value will be in the first index of the list and so on..)  Thanks!

I have a list of dictionaries and want each item to be sorted by a specific value. Take into consideration the list: [{'name':'Homer', 'age':39}, {'name':'Bart', 'age':10}]  When sorted by name, it should become: [{'name':'Bart', 'age':10}, {'name':'Homer', 'age':39}]


How do we know that the idea of Entropy is True?   What I mean is,  Do we really know "Scientifically" that Entropy of Universe is Bound to increase?  Or We know it "Statistically" that Entropy of Universe "Increases"?   Do we know it "Inductively", from the past experiences and our understanding of the universe till now, that Entropy of the universe tends to increase?   Or   There is some "Deductive" proof that the Entropy of the Universe is bound to "Increase"?  In summary, the question is, the idea of Entropy is assumed to be true, Scientifically or Statistically?  I would be very happy if somebody can also provide me some resources which throw light on the history of the development of idea of Entropy.   PS: I do not say that "Statistics" is non-science, just considering the difference of ways of working in two disciplines - "Science" and "Statistics".

How do you prove the  from statistical mechanics? To prove entropy will only increase with time? How to prove? Please guide.


From Harvard's CS50 course  basically he has a function  where he says  do {     int n = get_int("Positive number") } while ;   He wants the program to repeat positive number until the user inputs a positive number. Why is the while loop on the bottom of his do function?

I've seen both the blocks of code in use several different times, personally I have always used the first but my question is: is there a functional difference, and if there is what is it?  while (condition is true ) {     // do something }  do {     // do something } while ( condition is true);   I will be applying this to PHP but I assume this is fairly language agnostic.


this is stored in my mysql database
it&acirc;&euro;&trade;s the best
   I am fetching this from database and displaying to webpage. But "it's the best" is displayed as "itâ€™s the best".  How can i show apostrophe on the webpage?  I want everyone who access my website see the apostrophe irrespective of browser and os.

I'm setting up a new server and want to support UTF-8 fully in my web application. I have tried this in the past on existing servers and always seem to end up having to fall back to ISO-8859-1.  Where exactly do I need to set the encoding/charsets? I'm aware that I need to configure Apache, MySQL, and PHP to do this — is there some standard checklist I can follow, or perhaps troubleshoot where the mismatches occur?  This is for a new Linux server, running MySQL 5, PHP, 5 and Apache 2.


I have the dictionary as shown below and I want to pick the key whose value is the maximum in dictionary dictionary = {'george': 16, 'amber': 19 ,'leper':23}  Expected_Output: leper

I have a dictionary: keys are strings, values are integers.  Example:   stats = {'a':1000, 'b':3000, 'c': 100}   I'd like to get 'b' as an answer, since it's the key with a higher value.  I did the following, using an intermediate list with reversed key-value tuples:  inverse = [(value, key) for key, value in stats.items()] print max(inverse)[1]   Is that one the better (or even more elegant) approach?


I'm trying to learn linux, so I installed ubuntu onto a 64 gigabyte USB and restarted my computer and booted from the usb. When it was loaded it asked me if I wanted to "try without installing"(which is kind of like a trial right?). The second option was to "install ubuntu". I clicked this option and it said "no operating systems detected", so I assumed it would install onto the USB since I don't have windows or any other operating system on the USB stick. When it was all done I rebooted my computer and tried booting windows but it had been completely overwritten. I unplugged the USB stick with ubuntu on it and ubuntu had been installed onto my main HDD from the USB stick.   Luckily, I have recovery USB sticks that lenovo sent me, so when I get back to college I'll be able to recover windows, but I want to know what I did wrong, and what I need to do next time, so that I can learn from my mistake.

Whenever I startup from the LinuxLive USB, and try to install Ubuntu 12.04, it only gives me two options instead of the usual 3 or 4. My options are "Replace Windows 7 with Ubuntu" and "Something Else". Whenever I go into "Something else", it looks extremely confusing. How do I install it side-by-side while using the "Something else" section? These are my partitions.   /dev/sda /dev/sda1 ntfs (104Mb, System Required Partition) /dev/sda2 ntfs (1000097Mb, Windows 7 Partition)   Or should I try reinstalling my installer on a CD rather than USB and maybe then it will have the "Install alongside" function?


Please provide an option to increase the font size in the Android app.

I'm using the alpha version of the android app on the first generation nexus 7 tablet.  The font size is a little bit small for my liking and I'm not able to pinch zoom to increase the font size.  Is this a feature that is planned in the release?


I'm using a form to send info to a PHP page (using 'GET').  I'd like to have two buttons underneath the form: one to preview the generated page, and one to download the generated page.  I found this solution for the preview part:  <script type="text/javascript">     $("form").submit(function() {         $("form").attr('target', '_blank');         return true;     }); </script>   Which works great.  To make the generated page available for download, I was generally using a normal submit button:  <input type="submit"        name="submit"        id="submit"        onClick="myFunction()"        value="Download Bonus Page" >   and on the generated PHP page, at the very top I added  <?php     $filename = 'bonuspage.html';     header('Content-disposition: attachment; filename=' . $filename);     header('Content-type: text/html');     // ... the rest of your file ?>   I'm wondering how I can combine both functions, because when I click either button, it's always the preview that opens - I can't get the download to work...

I have two submit buttons in a form. How do I determine which one was hit serverside?


I am planning on just traveling to many different places, I know that I'm allowed to stay in certain places for as long as 3 months, but would they allow me to stay in Seoul for 3 months, without a flight returning home?   The thing is that I'm not sure if I will be going straight back to Canada (most likely not) after my visit in Korea or continue onwards to other places.

I've been to South Korea a few times already and always enjoy it but I've always had an onward ticket before.  Now I need to fly home from a trip that's lasted over a year, but I still want to take my time and keep my options open.  There's a good choice of cheap flights from Istanbul to Seoul and from Seoul I can't decide yet whether to fly straight home or take a ferry to China, hitchhike to Guangzhou, and get a cheap flight home from there.  I can't really just buy the China-Australia flight now because I'm not sure yet whether I'll be able to get the Chinese visa easily enough or how long my remaining money will last.  I know Korea, like most countries, has rules saying you need an onward ticket, but in my experience many countries never try to verify that you have this ticket unless you fit some profile. So in this instance I would find first-hand knowlegde much more informative that pointers to a government website.  In practice does South Korea admit tourists with one-way tickets?


is there any command or way to access the other machine terminal into mine to execute commands for other machine that is on the same network.

How can I SSH with a remote server so I can browse files and edit them? I have a username and password to use.


In Star Wars: The Force Awakens we learn that Kylo Ren is >! a member of "Knight of Ren". We also learn that this is the team that       slaughtered Luke's Jedi students.   So we have a group of fighters, and one of them(Kylo Ren) is a Dark Side of the force user.   They take orders from Snoke, who seems to be a Force user.  So this team are Sith? Or is a new order , calling themselves "Knight of Ren", who continue the "legacy" of Sith and what the difference between them? Are they something like Inquisitorius? And what Ren could possibly mean?

Kylo Ren is obsessed with Darth Vader and vows to finish what he started.  He wields a red lightsaber.  He opposes the Jedi.  He fights for the Empire... err First Order  Does that mean he is a Sith?


I'm new to PHP and HTML working on a website both codes seem to be working. I'm trying to edit an existing contact us form and send the form to a default email but it is getting to the spam folder. Here is my HTML code part:

Contact Us

                                                                        <form name="enq" action="contact-form-handler.php" method="POST" onsubmit="return validation();">           <fieldset>             <input type="text" name="name" id="name" value=""  class="input-block-level" placeholder="Name" maxlength="80" />             <input type="text" name="email" id="email" value="" class="input-block-level" placeholder="Email" maxlength="80" />             <textarea rows="11" name="message" id="message" class="input-block-level" placeholder="Message" maxlength="1024"></textarea>
               <input type="submit" value="&nbsp;&nbsp;Send&nbsp;&nbsp;" name="submit" id="submitButton" class="btn btn-inverse pull-left" title="Click here to submit your message!" />
           </fieldset>         </form>
  and here is my PHP code: <?php $name=$_POSt['name']; $vistor_email=$_POST['email']; $message=$_POST['message'];  $email_from='ex2@gmail.com'; $email_subject="New request to A-Akawi"; //$email_body="User Name:$name.\n"."User Email:$vistor_email.\n"."User message:$message.\n";  $body = <<<EMAIL You have received a new request from $name with the following email address $vistor_email. The following request is: $message.   EMAIL;  $to ='ex1@gmail.com'; $headers .= "From: Johnson Smith <noreply@ksar.com> . \r\n" ; $headers .='Reply-To: '. $to . "\r\n" ; $headers .= "Organization: Sender Organization\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/plain; charset=iso-8859-1\r\n"; $headers .= "X-Priority: 3\r\n"; $headers .= "X-Mailer: PHP". phpversion() ."\r\n";  mail($to,$email_subject,$body,$headers); header("location: contact.html"); ?>  I'm getting it to the spam even after adding the headers how to fix it?

This is a tricky one and I've always relied on techniques, such as permission-based emails (i.e. only sending to people you have permission to send to) and not using blatantly spamish terminology.  Of late, some of the emails I send out programmatically have started being shuffled into people's spam folder automatically and I'm wondering what I can do about it.  This is despite the fact that these particular emails are not ones that humans would mark as spam, specifically, they are emails that contain license keys that people have paid good money for, so I don't think they're going to consider them spam  I figure this is a big topic in which I am essentially an ignorant simpleton.


I was reading a book and it said:"The coastline length of the United States proper is 22,860 km. What does "United States proper" mean here? Another phrase would be:"Her family lived outside the city proper". Is the word "proper" a noun here? What is its definition in this context?

I have an inkling that the following word usage is grammatically-correct; however, it is immensely difficult to search for confirmation, as all I receive for queries like "Proper as an adjective" are reams of results on "Proper adjectives". The word itself I am using as a postpositive adjective, similar in form to the phrase "time immemorial".  The shelter remains in name only; the shelter proper is in another town. Work in theory remained, although operations proper had mostly been outsourced.  Can anyone advise?


I'm trying to figure out if the statement is true or not and I need to prove it if so.  Let $p$ be a  prime and $a$ be an integer. If $p\mid a^n$ , is it true that $p^n\mid a^n$ ?  I'm not sure how i would approach this problem. I started as $a^n = p \cdot b$ for some $b \in \mathbb{Z}$.

Suppose $p$ is a prime and $a$ and $k$ are positive integers. Prove that, if $p \mid a^k$, then $p^k\mid a^k$ also.  I have already proven that if $a,b,n\in\mathbb{N}$ and if $a^n\mid b^n$, then $a\mid b$. I tried using induction:  $k=1 \Rightarrow p\mid a^1 \Rightarrow p^1\mid a^1$. Assume the statement holds for some $k$. Then if $p\mid a^{k+1}\Rightarrow p\mid a^ka$. Since $p$ is prime, $p\mid a$ or $p\mid a^k$. If $p\mid a$, we are done. If $p\mid a^k$ then by assumption, $p^k\mid a^k$ and so by the lemma, $p\mid a$ and so $p^{k+1}\mid a^{k+1}$.  Does this work?


Inspired by the recent question: ""  Answers there are basically debating whether improvised attacks with magic items count as magical attacks when perhaps there are options besides improvised attacks with magic items to accomplish that goal.  To hopefully get at something there, I'm asking this separately; I'm wondering whether an improvised attack made using a magic item (like a broom of flying or even throwing a ring of spell storing) actually counts as magical and thus overcomes resistances to non-magical attacks/damage.   Note that the other question asks about any way to accomplish having improvised attacks count as magical, and I'm asking whether this specific method works (instead of having it be disagreed upon in answers over there).

My Gnoll Paladin just got the Gauntlets of Ogre Strength from Phandelver the other day, and it got me wondering:    Would it be possible/make sense for punches using them to count as an improvised weapon? (Since I'm not punching with empty fists, I'm wearing magical gauntlets) If so, would punches from a person using them count as magical weapon damage?


I don't know how to title this question but anyway a="$(file . * | grep -i pgp)" || echo "no such files found! " && exit \         && b=$(echo "$a" | fzf --cycle --height=15) && [ -n "$b" ] \         && gpg --import "$b"  I'm confused about this. When variable a does not exist prints echo "no such files found! " and exits but when does exist doesn't print the message and exits as well. How can I do to exit only when no value is passed to variable a, in other words, when variable a does not exist.

I am trying to understand how the logical operator precedence works in bash. For example, I would have expected, that the following command does not echo anything.  true || echo aaa && echo bbb   However, contrary to my expectation, bbb gets printed.   Can somebody please explain, how can I make sense of compounded && and || operators in bash?


I am going on a trip to London, and then I will be going directly to Paris. I am an American citizen; therefore, I do not need a visa to go to London, but I am not sure about Paris.

I'm aware of the  as well as numerous questions that ask about the 90/180 day rule.  However, there is one case which isn't covered there: visa free entry.  I'm hoping that we can construct a canonical answer about visa free entry.  More specifically:   Which countries/passports are permitted to enter the Schengen zone without a visa?  Which authoritative sources can I check for possible policy change with regards to entry requirements for my given passport? Does the 90/180 rule apply to all non-EU/non-EEA/non-Swiss/non-Schengen microstate passports? What are the passport validity requirements for non-EU/non-EEA/non-Swiss/non-Schengen microstate passport holders wishing to enter visa free (apart from any airline requirements)? Are there any circumstances in which a passport holder from a visa free country would not be eligible to enter the Schengen zone?  (e.g. International transit while not having any days available under the 90/180 rule, previous criminal/arrest records, bans by a member state, etc.)


I find it difficult for medical reasons to generate the spit needed to do a genealogy DNA test. What are my options?

I have an Ancestry autosomal DNA kit that we are trying to get a 95 year old woman to take and having trouble.  I provided the  to my cousin that is trying to administer the test:     If providing adequate sample volume is a challenge for you or someone you are assisting, the following may help increase saliva production:         Gently rubbing the outside of your cheeks   Making chewing motions with your mouth   Adding a small amount of sugar to the tip of your tongue   Smelling or imagining sour foods such as lemons   Thinking about your own favorite food         Biting or scraping your cheeks is not recommended; keep in mind that the majority of the cells analyzed in your saliva sample will not be epithelial cells from your cheeks but white blood cells that are found naturally in your saliva.   However, they have now reported back:     I worked with my mom using your list of suggestions. I think she may have produced some saliva, but she wasn't able to spit it out. She seems to automatically swallow the saliva and has nothing to spit out. I am not sure what to do. I talked with her but she doesn't seem to understand. If you have any ideas I am willing to try again if she is.   Now we could switch to cheek swab using Family Tree DNA, but I would prefer to stick with Ancestry since I get DNA circles and can transfer to FTDNA in the future.  Perhaps getting her to look down so gravity is helping as someone rubs the checks?  What other suggestions do folks have in getting saliva for an Ancestry.com DNA sample?


I wondering why in c++ can't use parent class constructor for an specific signature, in case that derived class miss that?  For example in below sample, I can't initialize dd object with std::string.  #include <iostream>   class Base {     int num;     std::string s; public:     Base(int _num){ num = _num;}     Base(std::string _s){ s = _s;} };  class Derived : public Base { public:     Derived(int _num):Base(_num){} };  int main() {     Base b(50);     Derived d(50);     Base bb("hell");     Derived dd("hell"); // <<== Error     return 0; }   With Inheritance I expect to extend a class and not losing previous functionality but here I feel losing some.  In a more practical example, I create my version of std::string but It doesn't behave like a std::string in some cases :  #include <string> #include <iostream>   class MyString: public std::string { public:     void NewFeature(){/* new feature implementation*/} };  int main() {     MyString s("initialization");   // <<== Error: I expect to initialize with "..."     cout<<s;                        // <<== Error: I expect to print it like this.     return 0; }   Can somebody give some explanation ?

Why does this code:  class A {     public:          explicit A(int x) {} };  class B: public A { };  int main(void) {     B *b = new B(5);     delete b; }   Result in these errors:   main.cpp: In function ‘int main()’: main.cpp:13: error: no matching function for call to ‘B::B(int)’ main.cpp:8: note: candidates are: B::B() main.cpp:8: note:                 B::B(const B&)   Shouldn't B inherit A's constructor?  (this is using gcc)


I have a presentation that I would like to include some matlab code in. For that purpose I have included the , that basically configures the listings package.  My problem is that the environment mode does not work inside a frame.  When I run the code below as it is (or with article documentclass) everything is as expected.  \documentclass{beamer} \usepackage[framed,autolinebreaks,useliterate]{mcode} \begin{document} %\begin{frame} % code breaks if I include theese \begin{lstlisting} for i = 1:3     disp('cool'); % comment with some §\mcommentfont\LaTeX in it: $\mcommentfont\pi x^2$§ end  \end{lstlisting} %\end{frame} % code breaks if I include theese \end{document}   If I uncomment the begin/end frame lines I get the following error:  Runaway argument? ! File ended while scanning use of \lst@next ! Emergency stop !  ==> Fatal error occurred, no output PDF file produced!   The same happens if I use \frame{...} instead of \begin{frame}...\end{frame}.

I want to put some PHP code in my slide with the package listings but I have this error message:  Argument of \frame has an extra }.<inserted text>\par }   My latex code :   \documentclass{beamer}  \usepackage[utf8]{inputenc}  \usepackage[T1]{fontenc} \usepackage[frenchb]{babel} \usepackage{setspace} \usepackage{color} \usepackage{listings}  \usetheme{CambridgeUS}   \begin{frame} \begin{large}     Contexte : \newline \pause \end{large}  \begin{itemize}     \item Avertir Drupal \end{itemize} \begin{lstlisting}  // Gestion du contexte ete2013 // Utilisation d'un nouveau template if (%variables['ctpage'] == "ete2013") {     variables['template_files']=array('page-ete'); } \end{lstlisting} \end{frame}


Is there away to sort the tags on SO by the amount of followers they have? Currently the tags are sorted by the "liveliness" of the tag, and not by the amount of SOers interested in the tag. I think it is an good feature that will allow more important tags to come up for new users.

Right now, the "Tags" page supports listing the tags either in the most popular order or in alphabetical order. I think it will be interesting to see not only what tags are the most popular on questions but also what tags are the most popular for users, so it will be nice if we could get another tab that will sort the tags by the "most followed" order (the number of users who have that tag as an favorite tag).  I think that this order also gives a better sense of how many experts we have on topic X, as opposed to how many questions we have on topic X. That's something I would very much like to see.


I have the following AngularJS controller:  controllers.controller('QueuesCtrl', ['$scope', 'QueueRes',function($scope,QueueRes) {      $scope.queues = QueueRes.query();     this.queue={};      this.create = function() {         QueueRes.save(this.queue,function(){             this.queue={};         })      };    }]);   The object this.queue is a form, that I want to reset after I successfully POST the data.  The this.queue={}; inside of the callback function doesn't work (which makes sense since this is different in that context).  If I move this.queue={}; to outside of the callback, my code works, but resets the password regardless of the outcome of the POST operation, which is not what I desire.  How can I access the controller from inside the callback ?

I have a problem with an object I have created that looks something like this:  var myObject = {      AddChildRowEvents: function(row, p2) {         if(document.attachEvent) {             row.attachEvent('onclick', function(){this.DoSomething();});         } else {             row.addEventListener('click', function(){this.DoSomething();}, false);         }     },      DoSomething: function() {         this.SomethingElse(); //<-- Error here, object 'this' does not support this method.     } }   The problem is that when I am inside the 'DoSomething' function, 'this' does not refer to 'myObject' what am I doing wrong?


Am sorry if this is a silly question.  I have heard something like this from cosmologists:   "There is no intrinsic arrow of time. Today, we believe that the direction of this arrow is due to our specific initial condition. For reasons unknown, we had a low-entropy Big Bang."  The words that I have in bold assume the Big Bang is in the past, it seems to me. Obviously, the physicists who said it did not mean what they said. They must have meant something else, but thought that too much rigor was unnecessary. So, can somebody explain to me what they mean when they say initial conditions and Big Bang causing an arrow of time?  EDIT: Sorry for not making sense. I will try to make my reasoning clear. I think that time-reversible laws means no time and here's why:  Time reversible laws means you can find out past states just as you can predict future states. But then doesn't it mean that there is no intrinsic difference between past and future. Nothing about the laws and their deductions will change if you swap their meanings. But then we have past and future as distinct ideas in our heads and from our experiences. So, shouldn't there be some time assymetry that can explain this.  Please correct me if my reasoning is fallacious.

The question is sometimes referred to as the "psychological arrow of time" (Hawking, 1985). Here the past is understood as a moment or time when the entropy of the universe was lower, and contrarily for the future. So it is generally thought that PAOT is a consequence of the thermodynamic arrow of time of our universe. If so (maybe not?), how do the two relate?   Some explanations in the literature:   Practical memory systems work in a way that the formation of new memories entails an overall increase of total entropy of the system and the environment. For example, to create a memory, i.e. to cause our neurons to orient in a particular fashion, requires energy which results in our body heating up a little bit, increasing the total entropy (Hawking, 1985 and 1994); The initialization of memory to make it reusable is an irreversible process that increases total entropy (Landauer, 1961. Wolpert, 1992). More recently, People have argued that even reversible and non-dissipative memory systems are subject to PAOT (Mlodinow and Brun, 2014). The conclusion is arrived by imposing some constraints on what a memory system should be like. Specifically, they argue that a memory should be somehow robust to small microscopic changes in states of the system it records (what they call "generality" requirement). But the smallest changes in the future state destroy the thermodynamic arrow of time between now and the future. So any memory of the future of the system "could remember only one possible configuration of that system". This fine-tuning disqualifies it as a bona fide memory.   My problem with explanation (1) is that even if it's correct, it doesn't seem to be a complete answer in itself. Yes, increase of (new) memory happens only as total entropy of the universe increases. So what? It doesn't have anything to say on the nature of that memory. Why couldn't it occasionally be a memory of the future for that matter? Explanation (2) leaves no such ambiguity. But the generality requirement seems artificial: surely a memory that records the only future configuration of the system remembers the future in a deterministic world, there being no "what ifs" regarding that state?   Of course, my understanding of the problem is only preliminary. I'd like to know whether there is not some generally accepted explanation, or any other thoughts you have on it.


I am a newbie to logistic regression. So far, I know how to derive the coefficients of logistic regression, how it basically works.  What I don't know are the assumptions & inference stuff for logistic regression. Let's say binary logistic regression.  One thing that confuses me is that Logistic regression assumes the response is conditionally Bernoulli distributed given the values of the features. I saw it from this , but I don't know why. I also saw it on wikipedia. Is there any proof of this?   Another thing is about inference. I know that for linear regression, we must have some assumptions, e.g. normality, non-colinearity, constant variance of error...etc for the inference (e.g. confidence interval of the coefficients) What about binary logistic regression? Do we have to care about the error term when doing inference on coefficients?

Sorry if this is obvious but why does it seem that some papers/studies (usually in economics discipline) use utility theory as a basis for discrete choice models while others (often social science) do not? If what is being modelled is a binary choice, is a specification of the reasons why this choice is being made (as in, to maximise utility) and an accompanying utility model necessary? It just seems some use it and some don't, even when what is being modelled is essentially the same thing. Thanks


I'll start by saying our databases use full recovery mode and we run SQL Server 2014.  Over the last few days our backups appeared to spiral out of control to the point that our full/differential backups were failing and only extremely large transactional backups were getting created. This of course caused a disk space issue and required a fair bit of manual intervention to restore order.  I manually ran a full backup on each database and then tried to follow up by running a transaction backup. During this period, one database's log file was increasing in size to the point that it ran out of disk space. Usually the log file would be around 1 GB, it is now sitting at about 30 GB.  Running a transactional backup did not reduce the size of the log file and I was stuck in a position where the log file was full and there was no room left on the disk. As a last ditch effort, I ran the SHRINKFILE( dbname, 4096) which instantly reduced the size and all appeared to be normal.  After doing so, I noticed my backups were no longer working and I was receiving an error:  Data error (cyclic redundancy check) failed. I tried running CheckDB and was presented with the following message:     A severe error occurred on the current command. The results, if any, should be discarded.   Given I was unable to back the database up, I decided to try and restore from earlier in the day off a full backup and 1 single transactional backup I had created. Both these files were large. The reason I only had 1 transactional backup was because I had disabled the job from running to avoid things spiralling further out of control.  New DB is up and running and backups work fine, but the issue of the large log file still prevails. My transactional backups are very small now but I can't seem to shrink the DB.  Anyone have any ideas? Alternatively, if there's a way to resolve the redundancy issue on the original database that would be a preferable solution as I'd have no data loss then.  No open transactions. The log_reuse_wait_desc is "LOG_BACKUP" which my understanding means that it is waiting for a log backup to run. This is madness because I have done several ;) dbcc sqlperf(logspace) is claiming I'm using 92% space.  Log backups run every 15 minutes in normal circumstances, but like I mentioned, these had been failing over the weekend. I've turned them off for the time being to stop the drive filling up and have just been manually running transactional backups. The database is not live at the moment so no additional data is going in there, I've run maybe 4 transactional backups as a test in the last hour or so.  None of replication, mirroring, or AOAG is configured here.

I have a log file that is 302MB.  I have done a log backup which has left the log file mostly free (I can see this through the Disk Usage standard report)  If i try to run   DBCC SHRINKFILE (N'AdventureWorks2014_Log' , 0, TRUNCATEONLY)   or   DBCC SHRINKFILE (N'AdventureWorks2014_Log' , 0)   the file is still showing as 302MB.  I know I can change the database to simple recovery, then run one of the commands above and set back to full recovery (and then do a full backup to make sure the database is not in )  However, why can I not shrink the file in full recovery mode?  I know shrink isn't something you should do, but in my real world database, since no one had ever backed up the transaction log it had grown to 30GB and now regular log backups have been put in place to prevent growth of this level


For a program I am writing to connect to a scanner with three output trays (pockets) I need to make use of an SDK. After a call to the SDK I receive an int that represents the status of the pockets. To determine this "pocket" status the following is in the documentation.   Get status of the output pockets. To determine whether a pocket is full or empty, check the returned value using the bitwise AND (&) operator. Valid values are:   Csd.POCKET.P1_EMPTY Pocket 1 is empty.  Csd.POCKET.P2_EMPTY  Pocket 2 is empty. Csd.POCKET.P1_FULL   Pocket 1 is full.  Csd.POCKET.P2_FULL   Pocket 2 is full.  Csd.POCKET.P3_EMPTY Pocket 3 is empty. Csd.POCKET.P3_FULL   Pocket 3 is full.   I have never used bitwise operators so I am quite at a loss. The values of the above "Pocket" struct are as follows:   public struct POCKET {   public const int P1_EMPTY = 1;   public const int P1_FULL = 16;   public const int P2_EMPTY = 2;   public const int P2_FULL = 32;   public const int P3_EMPTY = 4;   public const int P3_FULL = 64; }   I have read up on bitwise operators and I know what they do, but I am at a loss implementing it for this specific case.  Thank you all in advance.

From time to time I see an enum like the following:  [Flags] public enum Options  {     None    = 0,     Option1 = 1,     Option2 = 2,     Option3 = 4,     Option4 = 8 }   I don't understand what exactly the [Flags] attribute does.  Anyone have a good explanation or example they could post?


I am running Ubuntu 15.04, but I have had the problem since 14.04. When i start the computer, the login screen shows up but i don't need to enter my password to login. I also cannot lock the computer, the screen goes black until i move the mouse and then I am logged in again.   I tried using sudo passwd [username] and set password that way, but to no avail. Also I have deactivated the automatic login. During my latest try I installed a new greeter (lightdm-gtk-greeter) I do not know much about these but this method also led nowhere.   For some reason on this computer I have a keyring program that I do not have on my Ubuntu laptop.

I used to have a password prompt but then I, from somewhere in User Accounts, unchecked "Require a password for login." Now, I want Ubuntu to prompt for a password again at login screen, mainly because I have to manually unlock the login keyring whenever I access Dash or other services, which is a pain at best.  I also searched another question, namely . It was of no help because the OP's question is "I have a password but Ubuntu doesn't ask for it."  Also, the two answers provided there don't solve my problem at all. They discuss completely other things.  Is there no simple mechanism? Because intuitively, if there's a checkbox option to bypass password requirement, there should be an equally hassle-free facility to again require the password.


Let $z$ be a complex number, and let $n$ be a positive integer such that $z^n = (z + 1)^n = 1$. Prove that $n$ is divisible by 6.    I feel like $|z|=1,$ but I don't know how to prove it.  Even if I found that, how would it help?  Solutions are greatly appreciated.  Thanks in advance!  *I believe there's multiple ways to solve this question.  And I would like to solve it using the one without much calculus.  I only know up to intermediate algebra.

we are given $z^n=(z+1)^n=1$, $z$ complex number. we want to prove that $n$ is divisible by $6$. I showed that $|z|=|z+1|=1$. Hence $z$ is on the intersection of two unit circles, one centered at $(0,0)$ and the other one centered at $(-1,0)$. Then $z$ can take two values $z=\operatorname{cis}(2 \pi /3)$ or $z=\operatorname{cis}(4 \pi/3)$. Then from $z^n=1=\operatorname{cis}(2 \pi k)$, $k$ integer I showed that $n$ should be divisible by $3$. I am left to show that $n$ should be divisible by $2$. I think if I figure out a way to show that $\operatorname{arg}(z+1)=\pi/3$ or $-\pi/3$ then I would be done, by using $(z+1)^n=\operatorname{cis}(2\pi k)$. but how can I do this? Any ideas are welcome! Thanks in advance!


I'm very new to blender, and I'm following a guide on how to make and color spheres, but I can not get to the materials button to get any farther. The farthest one in the properties tab I can get to is data, and I can not find a way to get any further right. How do I fix this issue so I can get to the materials? Also I have another question, I'm not sure what to call it, but the lower right portion of the screen with lots of options, when I drag from the right edge of the screen, it makes another portion with the same settings, so how can I get rid of these extra portions without having to restart? Thanks for any help

Ok so i am a bit of a noob in blender, so I need help with this.  I am trying to texture something, but there is no texture button where there should be, because the blender edge window cuts it off here's a picture


I’ve started boiling eggs again after a long time.  I’m simply adding the eggs, bringing to a hard boil then light boil for 10 minutes. I notice the outside of the egg yolk turns grey. The outside of the white part feels like there’s a film on it but and it’s not as soft as the inner white part.  Does this grey tint mean its overcooked and is it possible to boil eggs such that the egg yolk surface will always be yellow? Is it possible to get the surface of the white part as soft as the inner white part?  Thanks

I find I always have trouble scaling the amount of time the eggs should be boiled, cooled, etc. for different-sized batches of hard-boiled eggs.  I've heard a variety of "folk lore"-type rules for how it should be done, but what's really the right way?


I have a dataset where I'm training a neural network to discriminate between 4 classes. The class distribution on the dataset is as follows:   Class 0: 0.516  Class 1: 0.159  Class 2: 0.235  Class 3: 0.088   It's clear that class 0 is over-represented. Conversely, class 3 is almost non-existent in the dataset. These distributions are more or less preserved after a split into training, validation and test sets. In general, the network's performance is poor in terms of accuracy, even if it achieves relatively good performance on confusion matrix metrics (precision, recall and f1 score). I believe the network is overfitting class 0, as the training cost follows a downward trend, while validation and test errors are high. L2 regularization does not seem to help that much with the situation.   Do you have any suggestions on how to tackle this situation?

What is your opinion about oversampling in classification in general, and the SMOTE algorithm in particular? Why would we not just apply a cost/penalty to adjust for imbalance in class data and any unbalanced cost of errors? For my purposes, accuracy of prediction to a future set of experimental units is the ultimate measure.  For reference, the SMOTE paper:


So, in the next phrase:  «I miss you. That's the hardest thing I've got to deal with everyday»   According to that phrase, should it be every day or everyday?  Also, what's the difference between these two, could you please give me many examples?   Thank you! ❤

I constantly see "everyday" being used in cases where the writer really means "every day". For example, here's a sentence from Google's eBooks documentation: "New titles are being added to Google eBooks everyday."  There is even a supermarket chain that has a large sign saying, "Low prices, everyday!"  Could someone, for the record, state the rule on this?


I have some private method. for access the method and do the test I create a new instance as follows in a test class.   Class c = Class.forName("com.leopard.spring.StartGame");     StartGame testSG1 = (StartGame)c.newInstance();      Method m = testSG1.getClass().getDeclaredMethod("setUpForm");     m.setAccessible(true);     m.invoke(testSG1,null);   After doing that I couldn't call for the setUpForm() method to test that. What should I do?

How do I unit test (using xUnit) a class that has internal private methods, fields or nested classes? Or a function that is made private by having  (static in C/C++) or is in a private () namespace?  It seems bad to change the access modifier for a method or function just to be able to run a test.


How do I run an executable file (a .rpm file), in this case a printer driver?

Recently moved over onto Ubuntu. First time for anything like this for me as I'm coming from Windows but I'm here and ready to learn. The only problems Ive experienced so are saving in Libre office doc as a word doc file and then losing the formatting upon receival via email. However the more pressing issue is getting my old Brother DCP 135 c to work. Ive scanned a few help blogs and have found them frankly quite frightening.  Would it be possible for someone to write u a step by step guide (including explanations of terminology)  For those of us new to this magic world?


I was trying to move (ctrl + X) from Ubuntu Desktop to a memory card. Moved upto 8G files but unfortunately the card reader disturbed. Got error and when I re insert the card reader I got another error. Inserted card reader in windows machine and I could see only 500MB data. I do not find the data in Ubuntu desktop as well. How to find those image files. Please help me.

Are there any tools, methods, incantations to recover recently deleted files on Ubuntu?  If it makes any difference, I want to recover a  2.x database file. But would be better to have a method/tool that works on any kind of file.


Is there a group $G$, a subgroup $H$ and an element $x$, such that $xHx^{-1} \subset H$, but  $xHx^{-1} \neq H$?  Thanks in advance.

Let $G$ be a group, $H\subseteq G$ a subgroup and $a\in G$ an element of the group. Is it possible that $aHa^{-1} \subset H$, but $aHa^{-1} \neq H$?   If $H$ has finite index or finite order, this is not possible.


I have some increment of invoice numbers, where there is Prefix and Counter, Say Prefix is INV- and Counter is started with 001. Below is code used in Laravel to get the next Invoice number automatically,         $lastInv = explode('-', $record->invoice_number); //Gets record and split number          $nextInv = $settings->invoice_number_prefix.'-'. ($lastInv[1] + 1);  In this case, there are two records in DB with INV-001, INV-002, But with the above code, I am getting $nextInv as INV-3 How can I generate next invoice as INV-003 thank you,

I need to cast single figures (1 to 9) to (01 to 09). I can think of a way but its big and ugly and cumbersome. I'm sure there must be some concise way. Any Suggestions


I'm trying to determine if the series $\sum\limits_{k=1}^\infty\frac{(-1)^k\ln k }k$ is converging absolutely or conditionally. I've tried the ratio test and removed the alternating part i.e. $(-1)^k$ and then replaced every $k$ with $k+1$ and I got this: $$\frac{\dfrac{\ln(k+1)}{k+1}}{\dfrac{\ln k }k}.$$ I now don't know how to proceed with solving this or if this is the right way to solve it.

Stumped on yet another absolute convergence problem. (Converge conditionally, absolutely, or diverges)  $$\sum_{n=1}^\infty \frac{(-1)^n \ln(n)}{n} $$  First, I tested for absolute convergence, and the series reduced to $\frac{\ln(n)}{n}$   .....Using direct comparison, $\frac{\ln(n)}{n} > \frac{1}{n}$ I determined this diverges.  So, it does not converge absolutely.  Next, to use the alternating series test on the original series, you need to make sure the magnitude of the terms are decreasing.  Well, they are not:  $$\sum_{n=1}^\infty \frac{(-1)^n \ln(n)}{n} = -0 + .35 - .37 + .35.... $$  So, without using the alternating series test, how do I determine if the orig. series converges or diverges?  How can I use the divergence test (Nth term test)?  I'm not sure what the nth term tends to with that (-1) oscillation.  Just focus on $\frac{\ln(n)}{n}$  But we established that diverges, right?   But, I am told this series converges conditionally.  Do I use integral test?


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

"Prometheus" is meant to be a prequel to "Alien", happening 30 years before ().  If that's the case, how come one of the very earliest spaceships, Prometheus from 2089, has a spiffy new technology, while Nostromo has antique text based CRTs, mechanical IBM style keyboards, and all the associated technologies screaming "1980s called, and they want their IBM PC back!" ?  The great visuals of this can be seen in this Youtube Video  (ignore the russian voice-over - the guy is a movie critic who is complaining pretty much of the same discrepancy listed above).  Please note that I'm looking ONLY for in-universe answers (movies, scripts, explanations from creative team). I'm utterly un-interested in the obvious out of universe "well, for 1979 Alien film, 1980s technologies was the future, and 2012 movie is expected to look futuristic in 2012, duh" or speculations that make sense but aren't confirmed in canon.          And for those who don't believe me... to quote the immortal quip from Men in Black 2:   Old and busted:        New hotness:


I'm trying to pass a script on jupyter-hub with a specific kernel. With my last local installation it worked but now with my kernel I have this error:  TypeError                                 Traceback (most recent call last) <ipython-input-27-f1a418595338> in <module>()       4        5 mask = None ----> 6 with rasterio.drivers():       7     with rasterio.open(B2_reclass_path) as src:       8         image = src.read(1) # first band  TypeError: 'module' object is not callable   I don't really understand this error and I didn't find a solution anywhere

I have been trying to get rasterio working with my QGIS setup so that I can take advantage of the fast raster manipulations.  After a day of installing / uninstalling and then piece by piece searching and getting components installed one by one where needed (From upgrading GDAL, numpy, and a whole slew of other modules which were fighting each other) I manged to get to the point where I could import rasterio without any errors.  However now when I run, the first call in the example causes a Traceback:  with rasterio.drivers(CPL_DEBUG=True):     creates error =>  TypeError: 'module' object is not callable   I have noticed that other rasterio objects seem fine, but all functions that are in .pyc files have this same issue.  Any help?  - I will continue in the morning, but I was hoping some elves would appear and help solve this one tonight! :-)


i can't find a bijective, continuous map from $\mathbb{R}$ to the closed interval $[0,1]$. Give an example.  If not bijective then what is the difference between cardinal no of $(0,1)$ and $[0,1]$ ?

Does there exist a continuous bijection from $(0,1)$ to $[0,1]$? Of course the map should not be a proper map.


I want to know if the number of divisors of a number is odd or even, I think that will solve me a problem.   The problem, as I see it, asks me to prove that the number of divisors for a number that is a power of a natural number - is odd.   What I tried:  I think to prove it using induction. Not sure I'm doing it the right way.   For $n = 1:$ 1 has only one divisor – itself, and it's the power of itself so its a power of a natural number, so it holds.  For $n = n^2$, take $n^2$, it's surely a power of natural number ($n$). Aassume it holds.   Now prove for $n = (n+1)^2$ again, it's surely a power of a natural number – (n+1). Let's calculate:   $$ (n+1)^2 = n^2 + 2n + 1 $$  From the assumption we know that the number of divisors of $n^2$ is odd, from the base – the number of divisors of $1$ is odd and now we remain with $2n$... not sure what to say on him.   I would like a hint (more than a solution, as it will solve me homework)  Maybe something with prime factorization? But my proof should be general and not for a particular number.   Thank for any help.

I believe I have the solution to this problem but post it anyway to get feedback and alternate solutions/angles for it.  For all $n \in \mathrm {Z_+}$ prove $n$ is a perfect square if and only if $n$ has odd # of positive divisors. Thought to use induction but the perfect squares don't increase by 1.    $\Rightarrow$: If $n$ is a perfect square it must consist of 1+ prime factors each to an even power.  If $n$ consists of 1+ prime factors each to an even power it must have an odd # of positive divisors.  $\Leftarrow$: If $n$ has an odd number of positive divisors it must consist of 1+ prime factors each to an even power.  If $n$ consists of 1+ prime factors each to an even power it must be a perfect square.  Thanks.


I usually observe other than close votes all review queue has small numbers but today reopen post also have 3 figure number. Is queue was blocked due to some bug?

I've noticed in the last couple of days that there have been a few occasions when there's been a sudden surge of questions in the SO "Reopen" review queue.  Normally there's either no questions at all to reopen or at most three or four, and that's still the case, except that for the last couple of days I've gone to the review page and seen about fifty-odd questions in the queue, where just moments before there had been none.  I've gone through the reviews and the questions themselves seem reasonably legitimate (including the occasional audit), so I'm not questioning that... it just seems odd that there would be so many more than usual all of a sudden, and that they'd all appear at once.  Anyone got any insights, or should I just chalk this down as "one of those things"?


I get an annoying amount of spam traffic from the Ukrane, Russia, Korea etc. I have setup rules in my .htaccess file to block all of these countries and it's working great. The problem i have now is my error logs are insanely large. Last weeks log was 2gb. The entire log is just full of      client denied by server configuration:...   I dont need to read these. They are making it impossible for me to monitor genuine errors and the disk space they take up is also annoying. Is there a better way to do this or a way to stop apache from writing these messages to the log?  Its important that i still have errors written to this log. If i block everything that is an error or lower i will loose out on everything that i currently use the error log for. I want errors to still get written to the log. It helps me track any errors in the code.

I want to block access to my web server by default as a precaution but I keep getting the following errors showing up in my error log.      [Wed Jun 27 23:30:54 2012] [error] [client 86.77.20.107] client denied by server configuration: /home/www/default/Edu.jar      [Wed Jun 27 23:32:40 2012] [error] [client 86.77.20.107] client denied by server configuration: /home/www/default/REST.jar      [Wed Jun 27 23:35:39 2012] [error] [client 86.77.20.107] client denied by server configuration: /home/www/default/Set.jar      [Thu Jun 28 01:01:17 2012] [error] [client 58.218.199.227] client denied by server configuration: /home/www/default/proxyheader.php      [Thu Jun 28 02:34:57 2012] [error] [client 58.218.199.227] client denied by server configuration: /home/www/default/proxy.php      [Thu Jun 28 05:41:33 2012] [error] [client 58.218.199.227] client denied by server configuration: /home/www/default/proxyheader.php      [Thu Jun 28 06:55:10 2012] [error] [client 180.76.6.20] client denied by server configuration: /home/www/default/      [Thu Jun 28 07:31:26 2012] [error] [client 86.77.20.107] client denied by server configuration: /home/www/default/Edu.jar      [Thu Jun 28 07:32:25 2012] [error] [client 86.77.20.107] client denied by server configuration: /home/www/default/REST.jar      [Thu Jun 28 07:36:10 2012] [error] [client 86.77.20.107] client denied by server configuration: /home/www/default/Set.jar   I don't really want these errors to show up but whatever I do, I can't get rid of them. Does anyone know how I can achieve this?  Here is a copy of my configuration.  <VirtualHost *:80>     DocumentRoot /home/www/default      <Directory />            AllowOverride None            Order Deny,Allow            Deny from all     </Directory>      #ErrorLog /var/log/apache2/error.log     #LogLevel warn     CustomLog /var/log/apache2/access.log combined </VirtualHost>


To avoid adding problem with which value should I init the value of rule_prio ? ...1) rule_prio.add(int x , Rule r) doesn't work too; 2)initializing it with an existing EList doesn't work too 3) is temp.remove(int) is really deleting the value or modify only the pointer ????       private static EList<Rule> priorite(EList<Rule> R) {          Rule r;         int min ;         int p=-1;         int last_p = -1;         EList<Rule> rule_prio = null;          EList<Rule> temp = R;          while(temp.isEmpty()==false)         {             min=temp.get(0).getPriority();             for (int i=1; i<temp.size(); i++)             {                 r = temp.get(i);                 if (r.getPriority() < min)                 {                     min = r.getPriority();                     p = i;                 }              }     if (p!= -1 && p!= last_p)     {           rule_prio.add(temp.get(p));         temp.remove(p);         last_p = p;     }  }     return rule_prio;   }   Or it could be rule model the problem ?

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 have a set of points which I can fit a Gaussian model on them using Maximum likelihood estimation. but this estimation is weak and I want to improve it.  I want to fit a mixture of Gaussian on these points so I get better results but I don't know how ! I searched the internet for several days and I only found out that if I have multiple Gaussian distribution, adding them together with some weights will result in mixture of Gaussian. But in my example I only have a single distribution and I don't have any other Gaussian to get the mixture model.  How can I fit a mixture of Gaussians on my observed data ?  my data are in 2D space but for simplicity you can solve it for 1D.

I want to implement the EM algorithm manually and then compare it to the results of the normalmixEM of mixtools package. Of course, I would be happy if they both lead to the same results. The main reference is Geoffrey McLachlan (2000), .  I have a mixture density of two Gaussians, in general form, the log-likelihood is given by (McLachlan page 48):      $$ \log L_c(\Psi) = \sum_{i=1}^g \sum_{j=1}^n z_{ij}\{\log \pi_i + \log f_i(y_i;\theta_i)\}. $$ The $z_{ij}$ are $1$, if the observation was from the $i$th component density, otherwise $0$. The $f_i$ is the density of the normal distribution. The $\pi$ is the mixture proportion, so $\pi_1$ is the probability, that an observation is from the first Gaussian distribution and $\pi_2$ is the probability, that an observation is from the second Gaussian distribution.   The E step is now, calculation of the conditional expectation:      $$ Q(\Psi;\Psi^{(0)}) = E_{\Psi(0)}\{\log L_c(|\Psi)|y\}. $$ which leads, after a few derivations to the result (page 49):      \begin{align} \tau_i(y_j;\Psi^{(k)}) &= \frac{\pi_i^{(k)}f_i(y_j;\theta_i^{(k)}}{f(y_j;\Psi^{(k)}}  \\[8pt]                        &= \frac{\pi_i^{(k)}f_i(y_j;\theta_i^{(k)}}{\sum_{h=1}^g \pi_h^{(k)}f_h(y_j;\theta_h^{(k)})} \end{align} in the case of two Gaussians (page 82):      $$ \tau_i(y_j;\Psi) = \frac{\pi_i \phi(y_j;\mu_i,\Sigma_i)}{\sum_{h=1}^g \pi_h\phi(y_j; \mu_h,\Sigma_h)} $$ The M step is now the maximization of Q (page 49):      $$ Q(\Psi;\Psi^{(k)}) = \sum_{i=1}^g\sum_{j=1}^n\tau_i(y_j;\Psi^{(k)})\{\log \pi_i + \log f_i(y_j;\theta_i)\}. $$ This leads to (in the case of two Gaussians) (page 82):      \begin{align} \mu_i^{(k+1)} &= \frac{\sum_{j=1}^n \tau_{ij}^{(k)}y_j}{\sum_{j=1}^n \tau_{ij}^{(k)}}  \\[8pt] \Sigma_i^{(k+1)} &= \frac{\sum_{j=1}^n \tau_{ij}^{(k)}(y_j - \mu_i^{(k+1)})(y_j - \mu_i^{(k+1)})^T}{\sum_{j=1}^n \tau_{ij}^{(k)}} \end{align} and we know that (p. 50)      $$ \pi_i^{(k+1)} = \frac{\sum_{j=1}^n \tau_i(y_j;\Psi^{(k)})}{n}\qquad (i = 1, \ldots, g). $$ We repeat the E, M steps until $L(\Psi^{(k+1)})-L(\Psi^{(k)})$ is small.        I tried to write a R code (data can be found ).    # EM algorithm manually # dat is the data  # initial values pi1       <-  0.5 pi2       <-  0.5 mu1       <- -0.01 mu2       <-  0.01 sigma1    <-  0.01 sigma2    <-  0.02 loglik[1] <-  0 loglik[2] <- sum(pi1*(log(pi1) + log(dnorm(dat,mu1,sigma1)))) +               sum(pi2*(log(pi2) + log(dnorm(dat,mu2,sigma2))))  tau1 <- 0 tau2 <- 0 k    <- 1  # loop while(abs(loglik[k+1]-loglik[k]) >= 0.00001) {    # E step   tau1 <- pi1*dnorm(dat,mean=mu1,sd=sigma1)/(pi1*dnorm(x,mean=mu1,sd=sigma1) +            pi2*dnorm(dat,mean=mu2,sd=sigma2))   tau2 <- pi2*dnorm(dat,mean=mu2,sd=sigma2)/(pi1*dnorm(x,mean=mu1,sd=sigma1) +            pi2*dnorm(dat,mean=mu2,sd=sigma2))    # M step   pi1 <- sum(tau1)/length(dat)   pi2 <- sum(tau2)/length(dat)    mu1 <- sum(tau1*x)/sum(tau1)   mu2 <- sum(tau2*x)/sum(tau2)    sigma1 <- sum(tau1*(x-mu1)^2)/sum(tau1)   sigma2 <- sum(tau2*(x-mu2)^2)/sum(tau2)    loglik[k] <- sum(tau1*(log(pi1) + log(dnorm(x,mu1,sigma1)))) +                 sum(tau2*(log(pi2) + log(dnorm(x,mu2,sigma2))))   k         <- k+1 }   # compare library(mixtools) gm <- normalmixEM(x, k=2, lambda=c(0.5,0.5), mu=c(-0.01,0.01), sigma=c(0.01,0.02)) gm$lambda gm$mu gm$sigma  gm$loglik   The algorithm is not working, since some observations have the likelihood of zero and the log of this is -Inf. Where is my mistake?


What characters can I use in an identifier for an HTML element?    For example:  <SPAN id="section[5]" ...>  (Or rather, should I stick to certain characters to make sure the id works across all major browsers/JavaScript engine).

When creating the id attributes for HTML elements, what rules are there for the value?


I have just installed the Stack Exchange Android app, and have been creating accounts on different sites on Stack Exchange.  I noticed that from the main sites, I can reach a "meta site". What is this meta site?  Note: this question is about per-site meta, not Meta Stack Exchange which is covered aleady in .

Meta Stack Exchange seems to have different rules and user behavior than the "regular" Stack Exchange sites.  How is it different?    Individual questions answered below:                Related


I am running a loop in Jython and have a loop of 100K elements which fills up dictionary slowly and eventually crash the app with error:  java.lang.OutOfMemoryError: GC overhead limit exceeded   I can track how many elements were processed with a print out to terminal of a current index every 10K elements.  How to print current memory when running app in Jython ?   Want to create output similar to this:  10k - 50MB used so far.   20k - 100MB used so far.  30k - 150MB used so far.  ...   Thanks.

I'm currently building a Java app that could end up being run on many different platforms, but primarily variants of Solaris, Linux and Windows.  Has anyone been able to successfully extract information such as the current disk space used, CPU utilisation and memory used in the underlying OS? What about just what the Java app itself is consuming?  Preferrably I'd like to get this information without using JNI.


I'm reading in  (page 68) that "Each neutron is made up of one up quark and two down quarks.  In a free neutron one of the down quarks will transform into an up quark, turning the neutron into a proton and creating an electron in the process."  Where does that electron come from?

Quark doesn't constitutes more fundamental particle and proton and neutron consist of quarks. Now come to beta decay.      $n \rightarrow p + e^{-} + \bar{\nu}_e $    How can  an electron  emit from an neutron whereas electron is a fundamental particle? Is the electron created from gluon?


When i try to measure the performance execution speed time of my method below:    public static int FFMulFast(int firstPol, int secondPol){   int temp = 0;    if (firstPol == 0 ||secondPol == 0)    return 0;   /*The multiplication is done by using lookup tables. We have used both logarithmic and exponential table for mul  the idea is firstly look to Logarithmic table then add their powers and find the corresponding of this to exponential table */     temp = (Log[(firstPol & 0xff)] & 0xff) + (Log[(secondPol & 0xff)] & 0xff);      if (temp > 255) temp = temp - 255;      return Exp[(temp & 0xff)];   }    Now when i measure the performance speed of this method as below   public void runABunch() {      long start = System.nanoTime();     int a=0x59;    int b=0xb4;      for (int i = 0; i < 5000000; i++)         FFMulFast(a,b);     long end = System.nanoTime();     System.out.println("Time in nanoseconda: " + (end-start));   }   The result of this one is approximately 0.1 seconds .   But when i run the same method runABunch but omitted for then i get totally different results and i do not understand why these results are totally different and which one is more reputable the one with for or the one without for  public void runABunch() {  long start = System.nanoTime(); int a=0x59;   int b=0xb4;      FFMulFast(a,b); long end = System.nanoTime(); System.out.println("Time in nanoseconda: " + (end-start)); }   Also when i put some println statements the time of execution increased a lot.Anyone know why?  I tried to use profiler like java visualvm but the problem is that i can not see anything there since it disappeared to me as soon as my application finished to run.

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