I'm writing a bash script (below) and executing it using   sudo bash ./script.bash    result error:  line 22: syntax error near unexpected token `fi'   the script:  getent passwd myuser > /dev/null if [ $? -eq 0 ]; then     echo "info: user myuser already exists" else     sudo useradd -M myuser > /dev/null || { echo "ERROR: could not create user myuser."; exit 1 }     echo "info: user myuser created successfully" fi   if I remove the line:  || { echo "ERROR: could not create user fiminion"; exit 1 }   everything seems to work.. I don't understand what am I missing.. :/

The Bash Manual says   { list; }        Placing a list of commands between curly braces causes the list to be executed in the current shell context. No subshell is   created. The semicolon (or newline) following list is required.      The braces are reserved words, so they must be separated from the list   by blanks or other shell metacharacters.       The parentheses are operators, and are recognized as separate tokens   by the shell even if they are not separated from the list by   whitespace.   If I remove the semicolon, like this:  $ { date } >    Why does it expect stdin input? A metacharacter is a character that separates words.  The semicolon and whitespace are both "shell metacharacters". Why can't whitespace separate words date and }? Why do we need a semicolon instead of a whitespace for separating the words?


I realise it's probably an outdated form, but this exchange (from Master and Commander) makes me wonder:     Captain: Killick! Killick there! What do you have for us tonight?      Cook: Which it's soused hog's face.      Captain: Eh?      Cook: Which it is soused hog's face!      Captain: My favourite. My favourite.   I really don't understand, from a grammar point of view, how those words go together as a (correct) sentence. Can someone please elucidate?

In the movie  - we see  between Jack Aubrey and his servant Killick: Dialogue 1:  JACK: Killick? Killick there. KILLICK appears. JACK (CONT'D): What do you have for us tonight? KILLICK: Which it's, Soused Hoggs-Face. JACK: Aah! My favorite.  Dialogue 2:  KILLICK: That's the last of the cheese and like as not they'll leave it seizing to their plates with their tweedly tweedly tweedly. JACK (O.S.) Killick? KILLICK THERE! KILLICK (projecting) Which it will be ready when it's ready!  This tendency to start a sentence with Which is echoed in the books. My question is: What is the name of the grammar where 18th and 19th Century sentences started with 'which'?


We have a backup strategy where every day 6 db dumps are taken. We want to delete backups which are older than 7 days, but we also want to retain single backup of every day. The backup files are in the format 2015_08_09_01_00_01.sql.gz   Any help would be appreciated

Is there a simple way, in a pretty standard UNIX environment with bash, to run a command to delete all but the most recent X files from a directory?  To give a bit more of a concrete example, imagine some cron job writing out a file (say, a log file or a tar-ed up backup) to a directory every hour. I'd like a way to have another cron job running which would remove the oldest files in that directory until there are less than, say, 5.  And just to be clear, there's only one file present, it should never be deleted.


Consider the function $f:(0, \infty) \longrightarrow \mathbb{R}$ $$ g(x) = \frac{1}{x} - \left\lfloor\frac{1}{x}\right\rfloor$$ How can I show that the $ \lim_{x\to 0} \frac{1}{x} - [\frac{1}{x}]$ does not exist?

Let $x \in \mathbb{R}$ and let $\lfloor y\rfloor$ be the largest integer less than or equal to $x$. $$ f(x) = \frac{1}{x} - \left\lfloor\frac{1}{x}\right\rfloor$$ How does one prove that the $ \lim_{x\to 0} f(x)$ does not exist by using a Epsilon Delta proof? There is a hint given that you can use a proof by contradiction.


I have read these questions:                My question is different. We live in a world, where quarks can have a real fraction of the elementary charge (-1/3 or 2/3). I do understand that the experimental data fit the models and that Baryons are made up of three quarks, and that those quarks can have -1/3 or 2/3 the elementary charge. This way, the quarks can combine so that the Baryon will have an integer of the elementary charge. This way, the nucleus and the electron can be in a stable atomic state, where their electric charges cancel (attract) exactly. Any other way, the atom would not be stable.  So electron says: hey quarks, let's team up, let's make an atom.   Quarks: Hey, great idea, how much electric charge do you have? Let's call it e. OK so we will team up of three of us, so we will just take each of us -1/3 or 2/3 of your charge.   Electron says: Great!, I feel it, this way we can have a stable atom.  Quarks: Great!  I mean come on! I do understand the respect that the experimental data tells us that electrons and quarks are both elementary particles.   It seems that the quarks teamed up exactly so three of them in Baryons so they can cancel out (attract) exactly the electron's electric charge. Now I do understand that there could be Baryons made up of four quarks, and they could have then -1/4 and 3/4 charge of the electron's elementary charge. This would work too, and the neutron and proton would have the same way an integer of the electron's charge. So the atom would be stable.   We could do this with any integer number of quarks. But, come on, my question is, what if the quarks' charge could only be -1/sqrt(3) and 2/sqrt(3)? How many quarks would we then need to make up the nucleus - to make it match the electron's charge? Is it mathematically possible to have any kind of electric charge for the quark? We could simply put as many valence quarks in a Baryon to make a stable atom?  Question:   Is it a coincidence that quarks have -1/3 and 2/3 the electron's charge and there are three quarks in a Baryon? Could we have quarks with any kind of electric charge, like Sqrt(3)*elementary charge? Could we make a stable atom this way too? How many quarks would we put in this case into a Baryon to make atoms stable? I accept and respect that currently, electrons are elementary particles. Is it impossible as of today's view that both electrons and quarks are made up of the same something smaller (strings)?

What is the explanation between equality of proton and electron charges (up to a sign)? This is connected to the gauge invariance and renormalization of charge is connected to the renormalization of photon field, but is this explanation enough? Do we have some experimental evidence that quarks have 2/3 and -1/3 charges? By the way I think about bare charge of electron and proton. And I am also wondering if this can be explained by Standard Model.


A lot of tennis players, from professional to recreational, grunt when they hit the ball while playing tennis. Is there a reason for this?   related:

While watching  play for the gold medal in London 2012, I noticed Williams was going about her business while Sharapova was grunting each time she hit the ball.  After doing some , grunting in tennis dates back to 1962. Although men grunt, women draw more attention due to their high-pitched grunts. In addition, there is an initiative to eliminate excess grunts in the next generation of tennis players.  Another quote from said research says:     "I have not found in my 32 years anybody who says grunting or not   grunting has an empirically positive or negative effect on performance   -- it's all about belief system."   What is this "belief system?"  If grunting is not related to performance, why do tennis players do it excessively?


I want to ask a question about how to do something with DyNet. I am not sure what site is the best place for this question. A possible way to find out is to look for the site where the tag "dynet" exists (and, if there is more than one, find the site with the largest number of questions with this tag).   How can I find all the Stack Exchange sites that have a specific tag?

I want to find all questions tagged  on the meta sites of . Is there a better way than searching manually on each individual site?


When you upvote answers on the web version, the up arrow becomes orange (or some variation on other sites) to show that you've already voted. Here, it does not happen, so I have no indication that I've already voted. The arrow looks exactly the same as before I voted. This often makes me think I haven't voted, so I vote again, and get the error banner. This is frustrating and has happened many times. Please make the voting arrows indicate that you've voted.

Related:   I am using 1.0.71 on KitKat.  Immediately after voting, the arrow is displayed in red and the vote count is correct. However, when I scroll to read answers and then back to the top, the arrow is grey again and the vote count is reset to the previous value.  A reload of the question (pulling the finger down) is needed to show the correct situation, which is kept from then on.  This case was on security.stackexchange.com but I observed the same behavior on other sites too.  Screenshots   original state:  upvoted:  scrolled down and back up  after a reload


Recently while using my system for testing  I got my machine infected with a malware,  My system gets displayed with the following screen :    While browsing internet with screenshot i found that its  and its demanding money inorder to decrypt my files  The possible solutions which i could explore where :  system restore and format a system  But as per recent post the ctb locker encrypts shadow copies too..  is it there any way to bypass and decrypt all data?  P.S Got infected at my ubuntu machine any solutions for ubuntu?

I got infected by the CTB Locker and probably I have removed the virus itself. But the files all got polluted. I tried to use shadow explorer but it shows all blank in CDEF any drives and got no dates listed. I have turned on all system restoration now but still showing nothing.


I am trying to execute program (let's call that program2) that I wrote from another program.  I compile program2 and have executable file call client.  I want to run program2 and for that I create process fork for trying to execute program2 by using the exec function.  The program needs two arguments run.  I use:  execvp("client",arguments)   Where arguments is a NULL-terminated char*-array, and arguments[0] is "client". The program fails in the exec operation with error No Such File Or Directory.  In other words, how do I run my code from another program using the exec function?  code:  int main(int argc,char* argv[]) {  struct Integrals* shm_ptr;  key_t key;       int i,status; int shm_id; pid_t pid;   int child_pid[PROCESS]; char  curPid[10]; int curpid; double calcSegment[SIZE]; int from,to; double segment;  curpid=getpid(); sprintf(curPid,"%d",curpid);  char* arguments[]={"client",argv[1],curPid,NULL};  signal(SIGUSR1, sig_handler);//"install" the 'sig_handler' func in case ^C signl.  printf("---------->%s",arguments[0]); key=ftok("\tmp",(char)argv[1][0]);  if( (shm_id=shmget(key,sizeof(Integrals),IPC_CREAT|0600))==-1) {     perror("Fail To Allocate Shared Memory");     exit(1); }   if((shm_ptr=(Integrals*)shmat(shm_id,NULL,0))<0) {     perror("Fail To Attach Memory");     exit(1);  }   pid=fork();  if(pid<0) {     perror("The Fork Failed");     exit(1);     }  else if(pid==0) {     if(execvp("workspace/hafala/EX2/client",arguments)==-1)     {         perror("Faile To Execute 'client.c' Program");         exit(1);      }  }

How should I run another program from within my C program? I need to be able to write data into STDIN of the launched program (and maybe read from it's STDOUT)  I am not sure if this is a standard C function. I need the solution that should work under Linux.


The following question was asked by someone few years ago but the question was answered a bit superficially. Previous question:   I want to calculate an angle $\theta$ to get the correct trajectory to hit an enemy in my video game.  I have two equations for the projectile motion. $$ x(t) = v_0\cos(\theta)*t $$ $$ y(t) = v_0\sin(\theta)*t + {1 \over 2}gt^2$$  Now I solved the first equation for $t$ and put it in $y(t)$.  $$ y(x) = v_0\sin(\theta)*{x \over v_0\cos(\theta)}+{1 \over 2}g{x^2 \over v_0^2\cos^2(\theta)}$$  We can simplify that into  $$ y(x) = {\sin(\theta) \over \cos(\theta)}*x+{gx^2 \over 2v_0^2\cos^2(\theta)}$$  I want to solve for $\theta$ for any point $(x,y)$, so I can multiply both sides with $\cos^2(\theta)$ to get a quadratic equation, and then substitute $\cos(\theta)$ with $u$, like $$ 0 = -y \cos^2(\theta) + \sin(\theta)\times x\cos(\theta) + {gx^2 \over 2v_0^2}$$ $$ \cos(\theta) = u$$  The problem is, that I can't solve this in a regular way. I type that in mathematica, and got this:  $$\theta=-\cos^{-1}\cfrac{\sqrt{-\cfrac{\sqrt{-x^4(g^2x^2+2gv^2y-v^4)}}{v^2(x^2+y^2)}-\cfrac{gx^2y}{v^2(x^2+y^2)}+\cfrac{x^2}{x^2+y^2}}}{\sqrt{2}}$$  Does someone have an idea or had a similar problem?

Consider the problem of projectile motion where the angle to hit a target $(x,y)$ is asked, once given the initial velocity magnitude $v_0$. The projectile is fired from the point $(0,0)$.  Here is the final formula for theta, solving the equations of motion ()  $$\theta = \arctan{\left(\frac{v_0^2\pm\sqrt{v_0^4-g(gx^2+2yv_0^2)}}{gx}\right)} \tag{1}$$  Now if I impose $\Delta=0$ [Edit: $\Delta=v_0^4-g(gx^2+2yv_0^2)$ is the discriminant ( (for which we have the only solution $\theta=\arctan \frac{v_0^2}{gx}$) I find $$y=\frac{v_0^2}{2g}-\frac{g}{2v_0^2}x^2\tag{2}$$  Now in my view this is the equation of a parabola which describes the points $(x,y)$ in plane that can be hit only firing at $\theta=\arctan \frac{v_0^2}{gx}$, once given the initial velocity $v_0$.  On my textbook it is claimed that $(2)$ represents the equation of the trajectory of the projectile, if fired at $\theta=\arctan \frac{v_0^2}{gx}$.  I don't think that this is possible, to begin with the fact that $(2)$ does not pass through $(0,0)$.  Can anyone tell me what exactly $(2)$ means?


I would like to execute this query :      String query = "delete from table_a where id_table_a = ? and id_entity in ()";     PreparedStatement prepare = db_connection.prepareStatement(query);     prepare.setInt(1, var_a);   In the SQL query, I'm trying to put between the parentheses an attribute (defined as "id") of objects (defined as "Entity"). Objects "Entity" are contained in an ArrayList.  My goal is to put in a string all the "Entity.id" separated by commas. And then I will put this string between parentheses in my query.  I'd like to have advice cause I don't know if it's the better way to realize it...

What are the best workarounds for using a SQL IN clause with instances of java.sql.PreparedStatement, which is not supported for multiple values due to SQL injection attack security issues: One ? placeholder represents one value, rather than a list of values.  Consider the following SQL statement:  SELECT my_column FROM my_table where search_column IN (?)   Using preparedStatement.setString( 1, "'A', 'B', 'C'" ); is essentially a non-working attempt at a workaround of the reasons for using ? in the first place.    What workarounds are available?


Say I have 20 predictor vars (X's) and 1 response var (Y) and I'm attempting to build a supervised model y=f(x). Is it advisable or is it "OK" to firstly run PCA on all of the Predictor variables - and if say 3 PC's account for ~70% of the overall variance...can these 3 NEW PC variables be used as new predictor variables to the supervised learning.  Does it violate any rule - given that PCs are just linear combinations of all original predictor vars that do not correlate with other PCs...?  Paul.

Suppose I am running a regression $Y \sim X$. Why by selecting top $k$ principle components of $X$, does the model retain its predictive power on $Y$?   I understand that from dimensionality-reduction/feature-selection point of view, if $v_1, v_2, ... v_k$ are the eigenvectors of covariance matrix of $X$ with top $k$ eigenvalues, then $Xv_1, Xv_2 ... Xv_k$ are top $k$ principal components with maximum variances. We can thereby reduce the number of features to $k$ and retain most of the predictive power, as I understand it.   But why do top $k$ components retain the predictive power on $Y$?   If we talk about a general OLS $Y \sim Z$, there is no reason to suggest that if feature $Z_i$ has maximum variance, then $Z_i$ has the most predictive power on $Y$.   Update after seeing comments: I guess I have seen tons of examples of using PCA for dimensionality reduction. I have been assuming that means the dimensions we are left with have the most predictive power. Otherwise what's the point of dimensionality reduction?


Is it possible to check if ip is free with a script  pseudo code would look something like this  if [ip is available]    echo "IP is available" else    echo "IP is not available" fi   Can ping be used for this perhaps?

I am trying to write a bash script in a file that would, when run start pinging a host until it becomes available, when the host becomes reachable it runs a command and stops executing, I tried writing one but the script continues pinging until the count ends,  Plus I need to put that process in the background but if I run the script with the dollar ($) sign it still runs in foreground,  #!/bin/bash ping -c30 -i3 192.168.137.163 if [ $? -eq 0 ] then /root/scripts/test1.sh exit 0 else echo “fail” fi


I have a long string of text saved in a file that I want to easily copy to clipboard using Os X 10.11 terminal

Is there functionality in Unix that allows for the following: echo "Some Text" | copy-to-clipboard


I have a library script named A and a script B, C which includes A with   . ../../../A    The problem is how A can know which time I run ./B.sh or ./C.sh, example:  if(run ./B.sh)    echo "B (file path) is calling" else    echo "C (file path) is calling"

How can I determine the name of the Bash script file inside the script itself?  Like if my script is in file runme.sh, then how would I make it to display "You are running runme.sh" message without hardcoding that?


What does "She wheedled her mother into buying John a mink coat" mean?  Does it mean "She wheedled her mother and her mother bought a mink coat and her mother gave John a mink coat" or "She wheedled her mother and her mother bought a mink coat from John"?  I think "wheedle" is "persuade"


Without using L'Hospital's Rule, why does $$\lim_{x\to 0} \frac{\sin x}{x} = 1?$$

How can one prove the statement $$\lim_{x\to 0}\frac{\sin x}x=1$$ without using the Taylor series of $\sin$, $\cos$ and $\tan$? Best would be a geometrical solution.  This is homework. In my math class, we are about to prove that $\sin$ is continuous. We found out, that proving the above statement is enough for proving the continuity of $\sin$, but I can't find out how. Any help is appreciated.


I have a raspberry 4 with Ubuntu 20.10. I need to see one firefox in kiosk mode from hdmi0, and lounch it from ssh. any ideas?

Sometimes I need to start XMBC media player or other GUI software a one of my PC (small Xubuntu PC used as a media center).  Usually I do this starting a X11vnc server on the remote PC via SSH and than connecting with an Xvnc client to the Xfce desktop.  Is there a way to start a GUI software on a remote Linux PC via SSH?  Thanks!


Is it possible to go from point A to point B (which are on same latitude) by hovering above A and wait till the earth rotates to point B below and then come down vertically?  I believe there would be some more subtleties involved which I could not think of.

I was reading somewhere about a really cheap way of travelling: using balloons to get ourselves away from the surface of the earth. The idea held that because the earth rotates, we should be able to land in a different place after some time. As we all know, this doesn't happen.  Someone said that the reason why this doesn't happen is because the atmosphere (air, clouds etc.) also revolves around the earth (with the same angular velocity as the earth's rotation). Since we are also part of the atmosphere, our position doesn't change relatively.  Well, I'm not convinced with that answer. Why does the atmosphere rotate along with earth?  Gravitational force is towards the centre of the earth, but I don't see how it's making the atmosphere rotate.


I have a bib entry that is just a forum name and the URL. The problem is that all the bibliography is generated using firstinits=true. For this one with firstinits=true biblatex shortens the company name.  Any idea?   @misc{UPNP,    author =       {{UP}n{P} {F}orum},    url =          {http://www.upnp.org},    urldate =      2014,  }   [For] U. Forum. Url:    If I left the author blank and put the content in organization/institution then the cite is only the year (BTW I'm using alphabetic IEEE).

I want to list a company name in the author field of a bibliographic entry:  @book{CUDA,   author    = {NVIDIA Corporation},   title     = {NVIDIA CUDA Compute Unified Device Architecture Programming Guide},   publisher = {NVIDIA Corporation},   year      = {2007} }   But the entry keeps showing up "N. Corporation".  Is there a way to get the full author name to show up?  I'm currently using the siam BibTEX style.


When I compile my beamer it says that I have some problem with \end{frame} (like the photo I up here) but I don't know why. I still compile my beamer well last hour, but now I can't compile it anymore. Please help me. Thank you.

I have this document which contains Vietnamese characters, and it doesn't compile correctly:  \documentclass[letterpaper]{article} \usepackage[vietnam]{babel} \begin{document}         Ðàn con chung một trái tim \end{document}   The characters come out as gobbledygook. I don't know how to give Latex the ability to display characters in any language. It's rather frustrating because I'm used to just typing anything I want in UTF-8.   What are the steps to enabling a language in a Latex document? For the answer, you can use my Vietnamese example.


I have tried many times, but I could not complete the process.

I want to install Skype, but I can't locate it in Software Center or by using Synaptic Package Manager. Can anyone help me?


I saw that if I edit a post once then it gives me a +2. But then if I again edit the same post then I get another +2. Isn't this wrong? Reputation points must be awarded only once per question. The successive edits must be treated as the correction of the previous edit.

On Stack Overflow, I saw some users editing the same question multiple times, and getting the 2 point reputation bonus for each time.  I saw it during review of a suggested edit (some months ago, I forgot the question that's why I'm unable to paste the link here). I rejected it and gave the reason in the "Other" reason field.  Most of the time I saw that users first formats the code, and then after approval they edit the title and fix the grammar.  Why is this allowed?  My point is, if an user gained 2 reputation points for a particular edit, then why give another 2 points again for the same post? Because the second edit on same question/answer means that there were some mistakes or misses in their previous edit.


I have accidentally (well actually carelessly) provided 11gb swap memory for my dual boot Ubuntu 20.04 installation with Windows 10. I have allocated 25gb to the root partition, which I would like to expand. Can I convert my swap memory to root storage in Ubuntu? If so, how? If not, any alternatives? I'm a complete Linux noob, so sorry if this is a dumb question! Edit: It is a swap partition that I'm talking about Edit 2: The following is what I see in Gparted. /ext4 is my root partition, and the one below unallocated is the linux-swap. Can I do the resizing then?

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


If $\gcd(a,b)=1=\gcd(c,d)$, $b>0$, $d>0$ and $\frac {a}{b}+ \frac {c}{d}$ is an integer, show that $b=d$. Can someone give me hints to solve the problem? I have a feeling that we need to show that $b|d$ and $d|b$, but cant figure out how to do it. Can anyone help me? Just need some hint not the entire solution!

Prove for positive integers $a,b,c$ and $d$  (where $b  \neq 0$ , $d \neq 0$ and $b \neq d$), if $\gcd(a,b) = \gcd(c,d) = 1$, then $\frac{a}{b} + \frac {c}{d}$ is not an integer.  I understand that if $\gcd(a,b)$ and $\gcd(c,d) = 1$, at least one number in each pair is a prime or is $1$. As for after that, I'm totally stumped, could I get some tips, clues, help?


Is there an easy way to print "\\" in a Latex document? I tried using \\\ and it threw an error.

I know what my symbol or character looks like, but I don't know what the command is or which math alphabet it came from. How do I go about finding this out?


I want to add new tags to some old questions.   Will the question will show up in Top Questions active as it has an updated answer?

What can cause a question to be "bumped" to the first page in the Active tab of a Stack Exchange site? (Changing the "Last Active" date.)  .


I am trying to create directories 1-15 in single line mkdir with a script. The complete working command is: mkdir testdir{1..15} This command create 15 directories: testdir1, testdir2, testdir3..    I defined: Directory name, range-start and range-end as variables. Instead of getting 15 directories on the given path (testdir1, testdir2, ..) I get 1 directory named: testdir{1..15}    What am I doing wrong ?    #!/bin/bash  path=/export/lofi range_start=1 range_end=15 dirname=testdir cd "$path" echo "Current directory: `pwd`" echo "Creating directories from $range_start - $range_end" mkdir $dirname{$range_start..$range_end} echo $dirname{$range_start..$range_end}   I tried:    mkdir $dirname{$range_start..$range_end} mkdir '$dirname{$range_start..$range_end}' mkdir $dirname`{`$range_start..$range_end`}` mkdir "$dirname{$range_start..$range_end}"

I'm trying to make a bash script that would make a series of directories  and requesting a parameter of how many directories should be created.  $> ./createDir.sh 5  $> ls  ex_01 ex_02 ex_03 ex_04 ex_05   I tried using mkdir ex_{01..$1} but it does not seem correct. How could I make this work (without using any loop)?


I'm using a package called sk-rf. The class provided has numerous methods. I built a wrapper around that class, and I want to use methods of that class based on string as follows:  my_string = "method1"  object.my_string()   I can do with with exec and eval, but I want something elegant, pro and not hacky.

What is the best way to go about calling a function given a string with the function's name in a Python program.  For example, let's say that I have a module foo, and I have a string whose content is "bar". What is the best way to call foo.bar()?  I need to get the return value of the function, which is why I don't just use eval. I figured out how to do it by using eval to define a temp function that returns the result of that function call, but I'm hoping that there is a more elegant way to do this.


I need help proving this inequality.  Let $a_2,a_3,...,a_n$ be positive non zero real numbers such that their product is $1$  Prove that  $$(1+a_2)^{2}(1+a_3)^{3}... (1+a_n)^{n}>n^{n}$$  I tried Bernoulli that yields a LHS greater than $n! $  I also tried a trig $tan^{2}$ substitution without success...  Thanks for helping.

Let $n \ge3$ be an integer, and let $a_{2},a_{3}, ... ,a_{n}$ be positive real numbers such that $a_{2} a_{3}\cdots a_{n}=1.$ Prove that:   $$(1+a_{2})^{2}(1+a_{3})^{3}\cdots(1+a_{n})^{n}\ge n^n$$   This is the 2nd problem of the 53rd IMO and seems pretty interesting. How would we solve that?


I know similar question is floating on the same site, but no solution works for me.  I have been using Karbonn A26 Smart phone for the last two years, and I was not able to install run YouTube and Google+ since 2 years. Its hardware is quite ok. It runs Android 4.1.1.  Let me be clear what I am doing:   When I install and open YouTube, it says YouTube cannot work without Google Play Services. When I click on Get Play Services, it gives me error: "Incompatible with other applications(s) using the same shared user ID". So I factory reset the phone. Then I try it out, same. I can download and install YouTube, but when open it, it keeps saying same "Cannot play without Play Services". Same thing happens when I install and run Google+.   Installing YouTube on clean OS itself does not work.  Do I need to wipe cache? I think factory resetting must also wipe cache. What should I do to resolve this issue?

I need to run Google Plus, and Google Plus needs the Google Play service.  Every time I install google play service from the Google Play store it fails to install with this error:     Incompatible with other applications(s) using the same shared user ID   What could be the issue? How can I fix this?  UPDATE: I know almost nothing about android, so I dont know what ROM is, or such thing, I get my phone from local production and I guess, yes, it uses custom system, so I just know that I'm using Android Version 4.0.4. any help would be greatly appreciated.


HI! So, I shot a live band that played under purple stage lights. Most acts have strong colored LED lights affecting the subject's skin and I'd like to know how to tone these colors down when I'm shooting.   Ex: How to counteract the strong purple light shown on my subjects' faces? I'm aiming for as realistic color as possible.   I toggled between different White Balance settings and Picture Styles to go for a whiter picture overall.   1:    Pictures show different settings but all come out either too purple or too pink.  **I want to control these settings and get the best image quality as possible before even touching or relying on post editing.  Thank you!

I've only recently started taking photos and got into shooting concerts in a small venue that has neither a pit, nor proper lighting. All they use is some kind of simple LED array.  The thing is nobody wants to operate the lights and they tend to be too strong (I think).    Sometimes it's just like that for 15 mins or something... Photos seem to be out of focus, but I'm 99% sure they are (you can never be sure with a Nikon D7000, though).  These were shot using the 35mm DX and then cropped. Sometimes you can get something out of these kind of photos in LR (luminance, clarity), but it mostly looks like you f*ed up...  What can I do about it, except waiting for the light to change?   Underexposing will lead to heavier post-processing, which is unacceptable and B&W looks ugly and not sharp...  Of course not every photo has to be a keeper, nonetheless I'd like to know how to deal with that.  edit to explain(...)  Not exactly a duplicate, because I'm not using aperture priority so metering problems don't apply here. Different colour of light (green) + same settings, and the photo is fine. I'm aware of light waves having different lengths, etc. Just asking whether I should underexpose or it's just the way it is.


How to do I inject Drupal\user\Entity\User class as dependency? I could not find service name in service list.  for example:  $user = User::load($this->currentUser->id())   for this code I want to call like this  $user = $this->user->load(($this->currentUser->id())   when injecting in Controller. How can I achieve this?

I cannot get my head around this dependency injection theory. How are we supposed to get the below methods aligned with dependency injection?   \Drupal::routeMatch()->getParameter('node'); \Drupal::request(); \Drupal::formBuilder()->getForm('Drupal\enquirycart\Form\EnquiryForm'); \Drupal::config()   Here is a class that I need to fix this warning message when viewed in       "\Drupal calls should be avoided in classes, use | | dependency   injection instead"       class EnquirycartBlock extends BlockBase implements BlockPluginInterface {    /**    * {@inheritdoc}    */   public function defaultConfiguration() {     $default_config = \Drupal::config('enquirycart.settings');      return [       'label_display' => FALSE,       'enquiry_email' => $default_config->get('enquirycart.email'),     ];    }    /**    * {@inheritdoc}    */   public function build() {      $builtForm = \Drupal::formBuilder()->getForm('Drupal\enquirycart\Form\EnquirycartButtonForm');     $renderArray['form'] = $builtForm;      return $renderArray;    }    /**    * {@inheritdoc}    */   public function blockForm($form, FormStateInterface $form_state) {     $form_new = parent::blockForm($form, $form_state);      return $form_new;    }


I have a parent div and two child divs. The second child div is variable height, but is absolutely positioned at the bottom of the parent div.  I want the first div to have a dynamic height based on the second div. I thought margin-bottom: 10px would specify the height of the first div to go up until 10px of the second div, but apparently this is not true.  Is there any workaround to get what I want?  HTML:

      Hello

   CSS:   .parent {   height: 500px;   min-width: 500px;   position: relative;   background-color: red; }  .first {   background-color: green;   margin-bottom: 10px; }  .second {   height: 100px;   background-color: grey;   bottom: 0px;   box-sizing: border-box;   position: absolute;   width: 100%; }   JSFiddle:

I am working on a web application where I want the content to fill the height of the entire screen.  The page has a header, which contains a logo, and account information. This could be an arbitrary height. I want the content div to fill the rest of the page to the bottom.  I have a header div and a content div. At the moment I am using a table for the layout like so:  CSS and HTML    #page {     height: 100%; width: 100% }  #tdcontent {     height: 100%; }  #content {     overflow: auto; /* or overflow: hidden; */ }

...

...

     The entire height of the page is filled, and no scrolling is required.  For anything inside the content div, setting top: 0; will put it right underneath the header. Sometimes the content will be a real table, with its height set to 100%. Putting header inside content will not allow this to work.  Is there a way to achieve the same effect without using the table?  Update:  Elements inside the content div will have heights set to percentages as well. So something at 100% inside the div will fill it to the bottom. As will two elements at 50%.  Update 2:  For instance, if the header takes up 20% of the screen's height, a table specified at 50% inside #content would take up 40% of the screen space. So far, wrapping the entire thing in a table is the only thing that works.


I'm not too sure how I would go about solving $2017^{2017}$ mod $13$.

How do I efficiently compute $a^b\bmod c$:  When $b$ is huge, for instance $5^{844325}\bmod 21$? When $b$ is less than $c$ but it would still be a lot of work to multiply $a$ by itself $b$ times, for instance $5^{69}\bmod 101$? When $(a,c)\ne1$, for instance $6^{103}\bmod 14$?  Are there any other tricks for evaluating exponents in modular arithmetic?  This is being asked in an effort to cut down on duplicates, see  and .


If I want to shut down my machine programmatically or on the terminal, I must do sudo poweroff or sudo shutdown.  If I want to shut down my machine through my window manager and desktop environment, I navigate to my application menu and click "shut down".  This does not require my password.  How is this implemented?

I am reading the book , in chapter 5 "System Call Implementation" page 77 says      For example, capable(CAP_SYS_NICE) checks whether the caller has the   ability to modify nice values of other processes. By default, the   superuser possesses all capabilities and nonroot possesses none. For   example, here is the reboot() system call. Note how its first step is   ensuring that the calling process has the CAP_SYS_REBOOT . If that one   conditional statement were removed, any process could reboot the   system.   However, in my Debian Sid I can reboot my machine by using gnome or by executing /sbin/reboot without sudo or su. How is this possible?  Maybe with systemctl?   ls -l /sbin/reboot  lrwxrwxrwx 1 root root 14 Jun 28 04:23 /sbin/reboot -> /bin/systemctl   EDIT: My user groups  [damian@xvz:~]$ groups  damian sudo wireshark bumblebee   EDIT 2: systemctl permissions   [damian@xvz:~]$ ls -l /bin/systemctl  -rwxr-xr-x 1 root root 626640 Jun 28 04:23 /bin/systemctl


I use Git in command line with linux and not as a graphic client.  I wrote the wrong thing in a commit message.  How do I change the message?

I wrote the wrong thing in a commit message.  How can I change the message? The commit has not been pushed yet.


I've gotta create a bst and read in a text file to it so that the words of the file are recorded into that bst. I have to print the frequencies and probabilities of each word being searched however when i run my code i get an exception and I'm not really sure why. It's something having to do with my insert method I think. Here's my code:  import java.util.*; class Lepep3{     node root;     int counter;  class node{     String word;     int frequency;  //how many times the word shows up in the text file being read into the BST     double probability; //the probability that the node will be searched for      node leftLink, rightLink;   node(String w){         String word = w;         int frequency = 1;         node leftLink = null;         node rightLink = null;       }  }  Lepep3(){     root = null; }  void insert(String w){     if(root == null ){         root = new node(w);     }      else{         insert(w, root);     } }  void insert(String w, node t){     node parent = t;     while(t != null){         parent = t;         if(t.word.equals(w)){             t.frequency++;             return;         }          else if (w.compareTo(t.word) < 0)             t = t.leftLink;         else             t = t.rightLink;     }     if(w.compareTo(parent.word) < 0)         parent.leftLink = new node(w);     else          parent.rightLink = new node(w); }  void readInput(){     String x;     counter = 0;     Scanner inf = new Scanner(System.in);     while(inf.hasNext()){         x = inf.next();         insert(x);         counter++;     } }  double getProbability(node n){     double temp = n.frequency;     temp = temp/counter;      return temp; }  void printNodes(){     printNodes(root); }  void printNodes(node r){     if(root == null)         return;     printNodes(r.leftLink);     System.out.print(r.word + "   " + r.frequency + "   \n");     System.out.printf("%.4f\n", getProbability(r));     printNodes(r.rightLink); }  public static void main(String[] args) { System.out.print("\n Program to: find the frequency and probability of words form a given test file.");   System.out.print("\n Prepared by Lepe, Alfredo, Student ID: 109698093.");   System.out.print("\n Date: 3/8/2020");  Lepep3 ject = new Lepep3();  ject.readInput();  System.out.print("word   frequency   probability\n"); ject.printNodes(); }   }  Here's what my command prompt prints when i run the code:  C:\School\comp 282>java Lepep3 < p3.txt  Program to: find the frequency and probability of words from a given file.  Prepared by Lepe, Alfredo, Student ID: 109698093.  Date: 3/8/2020  Exception in thread "main" java.lang.NullPointerException      at Lepep3.insert(Lepep3.java:38)      at Lepep3.insert(Lepep3.java:31)      at Lepep3.readInput(Lepep3.java:58)      at Lepep3.main(Lepep3.java:88)

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 was trying to apply "sudo apt-get update" command. However when I run the command, I get output like this; berke@berke-ABRA-A5-V15-8:~$ sudo apt-get update Hit:1 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu focal InRelease Ign:2 http://dl.google.com/linux/earth/deb stable InRelease                                                                  Hit:3 http://security.ubuntu.com/ubuntu bionic-security InRelease                                                            Hit:4 https://download.docker.com/linux/ubuntu focal InRelease                                                               Hit:5 http://ppa.launchpad.net/tsbarnes/indicator-keylock/ubuntu focal InRelease                                             Hit:6 http://dl.google.com/linux/earth/deb stable Release                                                                    Hit:8 http://archive.ubuntu.com/ubuntu focal InRelease                                                                       Hit:9 http://archive.ubuntu.com/ubuntu focal-updates InRelease                                                               Hit:10 http://archive.ubuntu.com/ubuntu focal-security InRelease                                               Hit:11 http://archive.canonical.com/ubuntu bionic InRelease                                           Err:12 http://tr.archive.ubuntu.com/ubuntu bionic-updates InRelease             Could not connect to tr.archive.ubuntu.com:80 (193.140.98.183), connection timed out Reading package lists... Done                             W: Failed to fetch http://tr.archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease  Could not connect to tr.archive.ubuntu.com:80 (193.140.98.183), connection timed out W: Some index files failed to download. They have been ignored, or old ones used instead.    After this step I also tried to change the server as "Main Server". Yet, that didn't solve the time out error. What is the solution for this time out error in Ubuntu 20.04 Focal Fossa?

I just installed a fresh version of Ubuntu 19.10 today, and the first thing I decided to do was to install GNU Screen, using sudo apt-get install screen. my output was: Reading package lists... Done Building dependency tree        Reading state information... Done E: Unable to locate package screen  I figured the package archives were not quite updated as it was a clean install so I tried sudo apt-get update. This is what I got: Get:1 http://security.ubuntu.com/ubuntu eoan-security InRelease [97.5 kB]       Err:2 http://au.archive.ubuntu.com/ubuntu eoan InRelease   Cannot initiate the connection to au.archive.ubuntu.com:80 (2001:388:30bc:cafe::beef). - connect (101: Network is unreachable) Could not connect to au.archive.ubuntu.com:80 (202.158.214.106), connection timed out Err:3 http://au.archive.ubuntu.com/ubuntu eoan-updates InRelease      Cannot initiate the connection to au.archive.ubuntu.com:80 (2001:388:30bc:cafe::beef). - connect (101: Network is unreachable) Err:4 http://au.archive.ubuntu.com/ubuntu eoan-backports InRelease   Cannot initiate the connection to au.archive.ubuntu.com:80 (2001:388:30bc:cafe::beef). - connect (101: Network is unreachable) Fetched 97.5 kB in 31s (3,106 B/s) Reading package lists... Done Building dependency tree        Reading state information... Done All packages are up to date. W: Failed to fetch http://au.archive.ubuntu.com/ubuntu/dists/eoan/InRelease  Cannot initiate the connection to au.archive.ubuntu.com:80 (2001:388:30bc:cafe::beef). - connect (101: Network is unreachable) Could not connect to au.archive.ubuntu.com:80 (202.158.214.106), connection timed out W: Failed to fetch http://au.archive.ubuntu.com/ubuntu/dists/eoan-updates/InRelease  Cannot initiate the connection to au.archive.ubuntu.com:80 (2001:388:30bc:cafe::beef). - connect (101: Network is unreachable) W: Failed to fetch http://au.archive.ubuntu.com/ubuntu/dists/eoan-backports/InRelease  Cannot initiate the connection to au.archive.ubuntu.com:80 (2001:388:30bc:cafe::beef). - connect (101: Network is unreachable) W: Some index files failed to download. They have been ignored, or old ones used instead.  I'm really not sure why it would be doing this, other than maybe some first-use hiccups? The computer is definitely connected to the internet, as I am writing this from that machine, and I have tried running the commands after rebooting and it still gives the errors. I can't seem to be able to connect to au.archive.ubuntu.com at all. ping au.archive.ubuntu.com just sits there without a response. If anyone could help, that would be great! If any extra information is required I'd be happy to edit it into the question.


I've installed the ubuntu-sdk according to :  sudo add-apt-repository ppa:ubuntu-sdk-team/ppa && sudo apt-get update && sudo apt-get install ubuntu-sdk   But when following the  I find some discrepancies between the tutorial and my setup.  It says:  Select the Projects > Ubuntu > Simple Touch UI template and click   But all I get is    So I choose to go HTML5 and two steps further I'm at the Kit selection page which says  No valid kits found.   Any ideas where to go from here?  The system is Ubuntu 13.04

After following the  on the  page, everything seems just fine.  All the Ubuntu specific stuff is there, but when I try to create a new project using the Qt Quick 2 UI template, it's just missing. There are almost no templates available.  I'm on Ubuntu 12.10 64-bit, clean install.    This is how my New File or Project dialog looks like.


I want to splice an array in Java. I tried the method Array.copyOfString to solve the problem. However, the output in the terminal is just two strange strings. Is there anything I can do to fix the functioning of the code? package exp;  import java.util.Arrays;  public class exp {   public static void main(String[] args){      int[] array={0,1,2,3,4,5,6,7,8,9,10};      int[] a=Arrays.copyOfRange(array, 0, 10);      int[] b=Arrays.copyOfRange(array, 5, 5);      System.out.println(a);      System.out.println(b);   } }  terminal: [I@6acbcfc0 [I@5f184fc6  Process finished with exit code 0

In Java, arrays don't override toString(), so if you try to print one directly, you get the className + '@' + the hex of the  of the array, as defined by Object.toString():  int[] intArray = new int[] {1, 2, 3, 4, 5}; System.out.println(intArray);     // prints something like '[I@3343c8b3'   But usually, we'd actually want something more like [1, 2, 3, 4, 5]. What's the simplest way of doing that? Here are some example inputs and outputs:  // Array of primitives: int[] intArray = new int[] {1, 2, 3, 4, 5}; //output: [1, 2, 3, 4, 5]  // Array of object references: String[] strArray = new String[] {"John", "Mary", "Bob"}; //output: [John, Mary, Bob]


texlive now has about 150,000 files, and thousands of packages.  I obviously don't know the vast majority.  I only know what I regularly use.  A long time ago, the LaTeX Companion was my bible, but the most recent edition was so long and is so old by now that I had to give up on this one, too.  is there a list of "most important" and "most popular" packages that I should be aware of but am not yet aware of?  unfortunately, there is no "public use" counter for latex packages :-( .   I did a quick scan through my hundreds of latex files over the years to identify my own list of most used packages, which contain   amsmath array babel booktabs caption color float graphicx hyperref microtype needspace rotating setspace ulem url xcolor   I would consider latex almost useless without about half of these packages.  I also use beamer and tikz, too---not as often, but important.  (I am still keeping an eye on lualatex and context; and every two decades, I am checking back on latex3.)  I think novices and experts would both benefit from a list of "need-to-know" great packages for latex users.  what other essential common packages that every latex user should know did I not list?

I'm getting the impression from reading the answers written by some of the real experts here that there are quite a few little packages that just tweak LaTeX2e's default behaviour a little to make it more sensible here and there.  Rather than try to pick these up one by one as I read answers to questions (and thus risk missing them), I thought I'd ask up front what LaTeX2e packages people load by default in (almost) every document.  As this is a "big list" question, I'm making it CW.  I don't know if there are standard rules across all SE/SO sites for such questions, but on MathOverflow the rule is generally: one thing (in this case, package) per answer.  I guess that if a couple of packages really do go together then it would be fine to group them.  This is perhaps a little subjective and a little close to the line, so I'll not be offended if it gets closed or voted down!  (But please explain why in the comments.)  Also see our community poll question:


Having a little trouble with this. The Cauchy-Schwatrz inequality for vectors $u$ and $v$ is generally   $$|(u,v)^2|\le (u,u)\cdot(v,v).$$    Then for a two dimensional space its   $$|(u,v)^2|= (\|u\| \|v\|\cos(\theta))^2\le \|u\|^2\|v\|^2.$$  What I did was set two vectors $u$ and $v$ with the values $u=(a,b), v=(x,y).$  Then I used the inequality to plug in the values.   $$||u||=(a^2+b^2),\qquad ||v||=(x^2+y^2),$$   \begin{align*} \cos(\theta)&= (u\cdot v)/(||u||\cdot||v||)\\ &= (ax+by)/((a^2+b^2)\cdot(x^2+y^2)) \end{align*}  $$((a^2+b^2)\cdot (x^2+y^2)\cdot(ax+by)/((a^2+b^2)\cdot(x^2+y^2)))^2\le (a^2+b^2)^2\cdot(x^2+y^2)^2$$  after canceling becomes $$(ax+by)^2\le(a^2+b^2)^2\cdot(x^2+y^2)^2.$$  How could I get rid of the square on the terms on the right side of the inequality?  Edited: Looks like a duplicate but when I searched it did not come up on SE as the inequality was rearranged in the previous question.  Thanks DcMcMor for the editing.

Prove $(a^2+b^2)(c^2+d^2)\ge (ac+bd)^2$ for all $a,b,c,d\in\mathbb{R}$.  So $(a^2+b^2)(c^2+d^2) = a^2c^2+a^2d^2+b^2c^2+b^2d^2$  and $(ac+bd)^2 = a^2c^2+2acbd+b^2d^2$  So the problem is reduced to proving that $a^2d^2+b^2c^2\ge2acbd$ but I am not sure how to show that


I want to solve this question using mod arithmetic:  7/3 mod 8.  Somebody told me to do it using multiplicative inverse:  7 (Multiplicative inverse of 3) mod 8  I can't find any example related to the above method. Somebody please guide me.  Zulfi.

What is the best way to solve equations like the following:  $9x \equiv 33 \pmod{43}$  The only way I know would be to try all multiples of $43$ and $9$ and compare until I get $33$ for the remainder.  Is there a more efficient way ?   Help would be greatly appreciated!


The distribution of prime numbers, at first glance, appears to be somewhat random. It is however, deeply structured and deterministic. Does this qualify it as chaotic.   As chaotic is somewhat of a loose term, I will use the following definition: when the initial conditions determine later conditions, but the approximate initial conditions do not approximately determine later conditions. To be more clear, I will break this question down into three parts:   Can particular "conditions" be identified for prime numbers? Again this is hard to answer, but maybe there are similar distributions that prime numbers can be compared to.    This aleads to the next question,    Do the initial conditions determine the later conditions?   And    Do approximate initial conditions not approximate later conditions

There is a famous citation that says "It is evident that the primes are randomly distributed but, unfortunately, we don't know what 'random' means." R. C. Vaughan (February 1990)  I have this very clear but rather broad question that might be answered by different opinions and view points. However, my question is really not targeting an intuitive or philosophical answer, and I beg you for view points with a strength of mathematical foundation.   are primes randomly distributed?  so then what is 'random' in this context?    A posterior I  A possible hint comes perhaps from the theory of complex dynamical systems.  It can be difficult to tell from data whether a physical or other observed process is random or chaotic, because in practice no time series consists of pure 'signal.' There will always be some form of corrupting noise, even if it is present as round-off or truncation error. Thus any real time series, even if mostly deterministic, will contain some randomness. All methods for distinguishing deterministic and stochastic processes rely on the fact that a deterministic system always evolves in the same way from a given starting point.(ref , , , and "") - complying to latter, remind that every prime $p$ can be trivially identified by a sieving that applies prior primes $q<p$ so it is possible to determine that somehow the system evolves in the same way from a given starting point. Of course to take into account that time must be substituted by a walking index as well.    A posterior II  Thank you for all of many the comprehensive answers and discussions. This is a quite classic question on MSE and meanwhile we moved much forward. You are right that primes are not random as per above question. Indeed we could show that they are in their sequence some type of "deterministic chaos". We don't need the Riemann function for this purpose. The primes sequence is a so called "ordered iterative sequence". Meanwhile this has been further elaborated by this source: "The Secret Harmony of Primes" (ISBN 978-9176370001)  Some of you correctly referred to sieving. It is crucial however that we regard sieving procedures as a subset of "interference" (incl. frequencies and amplitudes). We can iteratively apply interference rules in order to gain from the first prime 2, the next ordered sequence. This can be iterative continued in an "ordered" way and within exact boundaries of p-squares (for 100% certainty). Indeed, in order to construct an ordered sequence of primes you just need to begin with 2. The Riemann approach is charming but would raise difficulties since we don't have yet a proof of the hypothesis that connects the order of the non-trivial zeros with the primes. So if you apply Riemann, as some colleagues here suggest, we would need to say at any time in the begin of your argumentation something like "provided the Riemann hypothesis would be true...". Having in mind that the very unique rule that primes follow, is that in an interference scheme all odd prime frequencies dance on the base frequency of 2 (ordered iterative sequence), one may even give it a thought to something of a parallel in the Riemann transformed world, that all non-trivial zeros dance on 1/2. But latter remains not more than a tempting trivial speculation yet.


I'm from Peru and I'm going to The Netherlands in the beginning of 2017. I fly back on February 28th. My flight is the next: Amsterdam - London Heathrow - London Gatwick - Lima. The time between arriving in the UK and leaving again is 16 hours. (I arrive Feb 28 at 10p.m. and leave again at Mar 1 at 2p.m.)  I want to know if I need a Transit Visa to change airports in London, or if i can go back home without a visa. Both flights are with British Airways.  All the information I find on the internet is very confusing and doesn't give me a clear answer.  Thanks in advance

Is there a website or some other way to find out if I need a transit visa for a short stop in the UK on my way somewhere else? Ideally this should give me the answer for all nationalities, and take into account any other visas I may have.


I am trying to make a slightly modified version of checkers for a final project, however I am getting a strange error whenever I run anything related to graphics:  Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException     at Board.drawBoard(TacticalCheckers.java:45)     at TacticalCheckers.paint(TacticalCheckers.java:14)     at sun.awt.RepaintArea.paintComponent(RepaintArea.java:264)     at sun.awt.RepaintArea.paint(RepaintArea.java:240)     at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:358)     at java.awt.Component.dispatchEventImpl(Component.java:4967)     at java.awt.Container.dispatchEventImpl(Container.java:2294)     at java.awt.Component.dispatchEvent(Component.java:4713)     at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)     at java.awt.EventQueue.access$500(EventQueue.java:97)     at java.awt.EventQueue$3.run(EventQueue.java:709)     at java.awt.EventQueue$3.run(EventQueue.java:703)     at java.security.AccessController.doPrivileged(Native Method)     at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)     at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)     at java.awt.EventQueue$4.run(EventQueue.java:731)     at java.awt.EventQueue$4.run(EventQueue.java:729)     at java.security.AccessController.doPrivileged(Native Method)     at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)     at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)     at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)     at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)     at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)   My code:  // TacticalCheckers.java import java.awt.*; import java.applet.*; import java.util.*;    public class TacticalCheckers extends Applet {      public void paint(Graphics g){         Board.drawBoard(g);     }  }   class Square {      private Color clr;      public void drawSquare(Color clr,Graphics g,int r,int c){         clr = this.clr;         g.setColor(clr);         g.drawRect(r*90,c*90,(r+1)*90,(c+1)*90);     }  }   class Board {     private static Color green = new Color(167,254,138);     private static Color tan = new Color(222,184,135);      private static Square board[][] = new Square[8][8];      public static void drawBoard(Graphics g){         for(int r = 0; r < 8; r++){             for(int c = 0; c< 8; c++){                 if(((r%2 == 0) && (c%2 == 0)) || ((r%2 == 1) && (c%2 == 1))){                     board[r][c].drawSquare(green,g,r,c);                 }else{                     board[r][c].drawSquare(tan,g,r,c);                 }              }           }           }     }   I have tried re-installing the IDE (j-grasp) as well and the jre and jdk, but I still get the same error. I have also gotten very similar errors (the only difference being the file/method names) on other graphics programs, which I know used to work. Does anyone know what this error means or more importantly know how to solve it? Thank you for your time! - Fr3d

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 List and i need to create DataGrid that each item in the List is a column.   So i try to do this   <DataGrid Columns="{Binding MyList}" />   But this is not working.  So i also try this    <DataGrid AutoGenerateColumns="False" ItemsSource="MyList"/>   also not working.

My WPF application generates sets of data which may have a different number of columns each time.  Included in the output is a description of each column that will be used to apply formatting.  A simplified version of the output might be something like:  class Data {     IList<ColumnDescription> ColumnDescriptions { get; set; }     string[][] Rows { get; set; } }   This class is set as the DataContext on a WPF DataGrid but I actually create the columns programmatically:  for (int i = 0; i < data.ColumnDescriptions.Count; i++) {     dataGrid.Columns.Add(new DataGridTextColumn     {         Header = data.ColumnDescriptions[i].Name,         Binding = new Binding(string.Format("[{0}]", i))     }); }   Is there any way to replace this code with data bindings in the XAML file instead?


I have a git repository with code from salesforce instance. The SF project is managed in eclipse (keppler version with egit plugin). I ignored the package and schema files in order to prevent conflicts. I would like to have another developer using the same instance and repository with his own Salesforce and git credentials. What are the steps that i need to perform in order to get the new developer start working with the git repository?  Here is what i tried on the 2nd developer computer: 1. Created a new SF project and didn't get the components from SF (In order to get them from the repository). 2. Shared the project, choose git and created a new local repository. 3. Setup remote repository with the path of the repository and the 2nd developer user name and pass. 4. When i'm asked to set the directory and choose the directory of the local repository, i get a notification that the directory is not empty.  That's as far as i got...i tried additional ways to set it up but none of them worked.  Thanks.

I have previous experience using GIT in other development environment and I never had much troubles using it.   We where using SVN for salesforce, however we want to migrate to GIT for the uncountable number of advantages compared to SVN.   I could configure the remote and local repo without any problem and also I could commit and push the changes to my remote repo.   However, I can't figure out how can we use GIT when more than one developer is doing changes on the repo. I always get conflict after refresh from server.  Sample where bought dev's are working on the same repo/branch  Dev 1:    Refresh from Server  Change code Save to Salesforce Commit  Push to remote   After Dev 1 pushing   Dev 2 (Steps A):   Refresh from Server  Change code Save to Salesforce Commit  Push to remote (Error: out of date)  If dev 2 try pull (or fetch + merge) then Conflict    Other steps we tried  Dev 2 (Steps B):   Refresh from Server  Pull (or fetch + merge) then Conflict   I was thinking in the possibility to use two branches: one for dev, just to be able to push commits to remote repo and the merged code will come always from Salesforce.  But this practice will kill some of the GIT benefices as diff and blame.   I've tried searching on Google unsuccessfully.


I have a xml file as below  <?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">  <url>   <loc>https://ezinearticles.com/</loc>   <changefreq>hourly</changefreq>   <priority>1.0</priority>  </url>  <url>   <loc>https://ezinearticles.com/submit/</loc>   <changefreq>weekly</changefreq>   <priority>0.3</priority>  </url>  ...................   I want to use xpathin lxml module to get URL from all  tag. I implemented it as below code but it didn't work. The result is empty list  from lxml import etree parser = etree.XMLParser(ns_clean=True) xmlfile = "sitemap1.xml" xmlobj = etree.parse(xmlfile, parser)  loc = xmlobj.xpath('//loc[text()]')  print(loc)   Can anyone help me fix my script ?

I am testing against the following test document:  <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"                        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">    <head>         <title>hi there</title>     </head>     <body>         <img class="foo" src="bar.png"/>     </body> </html>   If I parse the document using lxml.html, I can get the IMG with an xpath just fine:  >>> root = lxml.html.fromstring(doc) >>> root.xpath("//img") [<Element img at 1879e30>]   However, if I parse the document as XML and try to get the IMG tag, I get an empty result:  >>> tree = etree.parse(StringIO(doc)) >>> tree.getroot().xpath("//img") []   I can navigate to the element directly:  >>> tree.getroot().getchildren()[1].getchildren()[0] <Element {http://www.w3.org/1999/xhtml}img at f56810>   But of course that doesn't help me process arbitrary documents.  I would also expect to be able to query etree to get an xpath expression that will directly identify this element, which, technically I can do:  >>> tree.getpath(tree.getroot().getchildren()[1].getchildren()[0]) '/*/*[2]/*' >>> tree.getroot().xpath('/*/*[2]/*') [<Element {http://www.w3.org/1999/xhtml}img at fa1750>]   But that xpath is, again, obviously not useful for parsing arbitrary documents.  Obviously I am missing some key issue here, but I don't know what it is.  My best guess is that it has something to do with namespaces but the only namespace defined is the default and I don't know what else I might need to consider in regards to namespaces.  So, what am I missing?


I am having problems displaying Unicode like "★", it wont insert into the database, it just shows up as "â˜… ", however when I do it directly in PHPMyAdmin it works fine, so I don't think its the MySQL database I think its something to do with PHP. Wondering if anyone knows the cause and a way to fix it?

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'm trying to find an indexed family {An:n∈N} that satisfies:   each An is an infinite subset of the naturals N the intersection of any two arbitrary sets is empty the union of all the subsets is is the naturals N

Is it possible to have a countable infinite number of countable infinite sets such that no two sets share an element and their union is the positive integers?


Which would be correct who or whom at the beginning of this interrogative  sentence _____ do you think will win?

I can never figure out whether I should use who and whom. Most people use who for both colloquially, but some people say this is not correct.  What’s the rule for using who and whom correctly?


I've spent years writing a math paper I call "A study of Pythagorean Triples" and I would like to publish. I've written and re-written for accuracy and clarity and I ported it from Word to TexShop after having found that most publications require that format.  My paper is currently 14 pages long including 8 [ small ] graphic Exhibits in .png format.  How do I begin to get peer review as a total amateur and how do I proceed from there?  Update: My work was original to me but comments have led me to links showing that some of it has been done by others. The only distinction my work still has is in showing how this or that function was developed and how it works. I should rename my paper something along those lines and reflect that in my abstract.

Assume you have already completed your undergrad and have been working for a number of years. Does one need to be part of a university or a learning institution to publish papers?


I sell custom built computers in a niche market. I include specific software pre-loaded on the systems for my customers. If the customer ends up needing to reinstall the OS then the pre-loaded software is all gone. I have had requests to include recovery media that includes this stuff.   I am aware of the technique behind building a custom windows installation disc and we already do this to image the computers when we finish building them. However, would it be legal to burn a copy of this disc and include it with the system?

This is a  about Licensing.    Questions on licensing are off-topic on Server Fault.  If your question has been closed as a duplicate of this question, then this is because we want to help you understand why licence questions are off topic rather than just telling you "it just is". In all likelihood, this question will not address your question directly, it was not meant to.    I have a question regarding software licensing. Can the Server Fault community please help with the following:   How many licenses do I need? Is this licensing configuration valid? What CALs do I need to be properly licensed? Can I run this product in a virtual environment? Can I downgrade this product to an earlier version? Am I entitled to feature X with license Y?


I upgraded to 11.04 using update-manager -d. When I try to boot, I just get a purple blank screen, with no ubuntu logo/dots showing. It never gets to the gdm login screen (I left it for 20min) and I can't get to a tty by pressing Ctrl+Alt+F1. I don't see a grub menu/count down screen either.  My computer is a Dell Vostro 1500 with a Nvidia Geforce. I had the proprietary nvidia driver installed before upgrading.   I've boot with a live cd, from where I am writing this, and I can mount the disk, but I don't know where to start looking for the issue.

I've been running Alpha releases of Ubuntu for some time now. I keep running into issues - how can I get these resolved? What should I do when I encounter these problems? And where can I find other Ubuntu+1 users to ask questions?


On Windows 8.1, My action centre flag (telling me  'Maintenance in progress') won't stop or go away.  I've left it for two days now and it's still there.  There are no details and I've tried stopping it and starting it and have restarted the PC several times.  What is causing this?  The PC is only  weeks old.  I'm running an SSD and an SSHD, so any defragging should be minimal.  Any idea what is causing it or how I can stop it without disabling maintenance altogether?  Edit: I was asked to move this answer to a new question because it was on a different operating system (8.1 not 8).  It was down-voted there, so I created this question with 8.1 clearly marked.

My desktop PC (used primarily for development) has recently been telling me (via Action Center) that it needs to perform "maintenance". I allow it to do so, and hours later (I left it running overnight a couple of times) it is still reporting Maintenance in progress.    Task manager reports no significant CPU or disk usage, and I have separately trimmed/defragmented my disks (a 256GB Samsung SSD and separate 1TB HDD).  Can anyone suggest what might be boing on?


Hi I have this problem and it is very frustrating. I downloaded 64 bit ubuntu 14.04 and make both DVD and USB drive from the ISO file.   I want to install Ubuntu alongside with my win 8.1. When I choose to boot from USB/DVD under UEFI mode, I can see to options to try or install ubuntu. But if I select one of them, I just see a black screen and it stays that way forever.   SO I can never actually install Ubuntu because I cannot even see the installation screen!  I turned off fast boot in win 8.1 and secure boot in UEFI. I do not know what causes the problem. I built this desktop by my own and the motherboard is Asrock Z77 and CPU is 3570k.  Can anyone help me with this problem? I really need to use ubuntu.   Thank you so much!!

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


I have a list of items displayed one below the other. I have been trying to make the images next to the text display parallel to the text but it seems like the images almost hover over the text. The image shows what is being displayed:            <title>Page</title>

                                                                                User ID

                                                                                Password

                                                                                Confirm Password

      I want the check mark and 'X' images to displayed right next to the text rather than slightly above the text. This is how I want the images to be displayed:

Why won't vertical-align: middle work?  And yet, vertical-align: top does work.   span{   vertical-align: middle; }
      Doesn't work.


If a variable is declared as:  char ** argv;    And a function's definition is something like:  extern int my_system(const char *argv[]);   Now if we are passing the argument in the function as:  (my_system(argv))   then it throws the warning passing argument 1 of 'my_system' from incompatible pointer type.  What can be the possible solution to this?

The following code snippet (correctly) gives a warning in C and an error in C++ (using gcc & g++ respectively, tested with versions 3.4.5 and 4.2.1; MSVC does not seem to care):  char **a; const char** b = a;   I can understand and accept this. The C++ solution to this problem is to change b to be a const char * const *, which disallows reassignment of the pointers and prevents you from circumventing const-correctness ().  char **a; const char* const* b = a;   However, in pure C, the corrected version (using const char * const *) still gives a warning, and I don't understand why. Is there a way to get around this without using a cast?  To clarify: 1) Why does this generate a warning in C?  It should be entirely const-safe, and the C++ compiler seems to recognize it as such. 2) What is the correct way to go about accepting this char** as a parameter while saying (and having the compiler enforce) that I will not be modifying the characters it points to? For example, if I wanted to write a function:  void f(const char* const* in) {   // Only reads the data from in, does not write to it }   And I wanted to invoke it on a char**, what would be the correct type for the parameter?


Let A and B be two positive definite matrices.Then is it true that A+B is also positive definite? My view:I have taken several examples and every time it indicates that A+B is p.d.But haven't able to prove it explicitly.Anybody please help.

I have two matrices, which are square, symmetric, and positive definite. I would like to prove that the sum of the two matrices still have the same properties, that is square, symmetric, and positive definite. The first two properties are obvious, what about the positive definite property. Any clue to the proof? Thank you.


class DotCom{     int[] arr;     int numOfhits=0;     void setLocation(int[] location){         int[] arr=location;     }       String checkGuess(int guess){         System.out.println(guess);         String result="miss";         for(int i:arr){             if (i==guess){                  result="hit";                 numOfhits++;                 break;                 }              if(numOfhits==arr.length){                 result="kill";             }         }         System.out.println(result);         return result;     } }  class TestDotCom{     public static void  main(String[] args){         DotCom obj=new DotCom();         int[] location ={1,2,3};         obj.setLocation(location);         int userGuess=2;         String testResult="fail";         String result=obj.checkGuess(userGuess);          if(result=="hit"){             testResult="passed";             }          System.out.println(testResult);     } }      in Dotcom class the int[] arr=location causes error. When I remove that i doesn't get any error what is going on over here? The error I get are  2 Exception in thread "main" java.lang.NullPointerException      at DotCom.checkGuess(DotCom.java:12)     at TestDotCom.main(TestDotCom.java:8)    I don't get it what's wrong with the program.

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?


What is the ` character's name and what is its significance outside of SE code formatting because I cannot get it to work? I'm familiar with its use in the Stack Exchange forums used to format code blocks, so please outside of that.

I came across the following command:  sudo chown `id -u` /somedir   and I wonder: what is the meaning of the ` symbol. I noticed for instance that while the command above works well, the one below does not:  sudo chown 'id -u' /somedir


I am trying to unistall a Windows application installed in Wine.  When I run the command:  wine unistall - -software   it says uninstall: command not found.

I am using Ubuntu 11.10. By using wine software i installed some software like nimbuzz and ibibo messenger. Both the programs are not working and showing the bug as We're sorry, but an unknown error has caused ibibo Messenger to close.  So I wanna uninstall those.   How to uninstall those type of programs which I installed through Wine?


I have the below Insert statement query as part of an stored procedure that is taking some time to be complete (20-30) minutes, when normally in another server with same hardware specifications takes 1-2 minutes  Query:  INSERT INTO [DBO].[cond]     (        [LAST_NAME]      , [FIRST_NAME]      , [MIDDLE_NAME]      , [BUSINESS_NAME]      , [TIN]      , [date_of_birth]      , [OCCUPATION]      , [CTR_TRANSACTION_FK]      , [CREATED]      , [CREATED_BY]      , [LAST_MODIFIED]      , [LAST_MODIFIED_BY]      , [CTR_FK]      , [CUSTOMER_FK]      , [cust_type_FK]      , [gender]      , [naics_code]      , [name_suffix]      , [alternate_name]      , [extra_type]      , [ID_ISSUING_COUNTRY_FK]      , [id_issuing_state]      , [ID_TYPE]      , [ID_NUMBER]      , [FLEX_1]      , [FLEX_2]      , [FLEX_3]      , [FLEX_4]      , [ID_TYPE_OTHER_DESCRIPTION]      , [person_involved_source]      , [person_involved_date]      , [DEPOSITOR]     )     OUTPUT    [INSERTED].[ID]      , [INSERTED].[customer_FK]      , [INSERTED].[CTR_TRANSACTION_FK]      , [INSERTED].[CASHTX_CUSTOMER_FK]        INTO [#COND_INSERTED]     SELECT    [cust].[last_name]      , [cust].[first_name]      , [cust].[middle_name]      , [cust].[COMPANY_NAME]      , [foi].[identification_number]      , [cust].[birth_incorporation_date]      , [cust].[occupation]      , NTRX.[CTR_TRX_ID]      , @FilingDateTime      , @Filer      , @FilingDateTime      , @Filer      , NTRX.[CTR_ID]      , [cust].[id]      , [cust].[customer_type_FK]      , [cust].[GENDER]      , [cust].[NAICS_CODE]      , [cust].[SUFFIX]      , NULL      , CASE        WHEN [cashmap].[cb_type] = 'C'        THEN 'Conductor'        WHEN [cashmap].[cb_type] = 'O'        THEN 'Common Carrier'        ELSE ''    END      , [ctry1].[id]      , [cust].[id_issuing_state]      , [cust].[id_type]      , [cust].[id_number]      , [cashmap].[FLEX_1]      , [cashmap].[FLEX_2]      , [cashmap].[FLEX_3]      , [cashmap].[FLEX_4]      , [cust].[ID_TYPE_OTHER_DESCRIPTION]      , 1      , [cust].[LAST_MODIFIED]      , [cashmap].[DEPOSITOR]     FROM  [DBO].[cashcust] AS [cashmap]       INNER JOIN [DBO].cust AS [cust] ON [cashmap].[CUSTOMER_FK] = [cust].[id]       LEFT JOIN [DBO].custf AS [foi] ON [foi].[customer_FK] = [cust].[id]       LEFT JOIN [DBO].country AS [ctry1] ON [cust].[id_issuing_country] = [ctry1].[fincen_code]       INNER JOIN [DBO].trans AS [TXN] ON [txn].[UNIQUE_TRANS_ID] = [cashmap].[transaction_id]                AND txn.INSTITUTION_FK=cashmap.INSTITUTION_FK       LEFT JOIN [DBO].custacc AS [custmap] ON [txn].[account_FK] = [custmap].[account_FK]                 AND [custmap].[mapping_type] = 1                 AND [custmap].[IS_ACCOUNT_HOLDER] = 1                 AND [cashmap].[customer_FK] = [custmap].[customer_FK]       JOIN [#TMP_INSERTED] AS NTRX ON NTRX.TRX_ID=[txn].[id]     WHERE  [cashmap].[conductor_bene] = 'C'       AND @SourceConBenFromTellerFile = 0       AND ISNULL([cashmap].[has_error], 0) = 0;   Execution Plan: I noticed that the heaviest operator is the Clustered Index Insert.    Note: First set of inserted row was: 4810       Second set of inserted row was: 4886       Third set of inserted row was: 62  So not sure why is taking that time to insert them.      Important Server Info: MaxDOP = 4. Cost Treshold of Parallelism = 5  Top Waittypes:   Page life expectancy  =                                                                                60  Also I noticed some implicit conversion warnings in some of the insert statements:    Full Execution Plan: Part 1:   Part 2:   Part 3:   Memory Clercks for Blocking:

I have a piece of SQL that seems to run really fast in Environment A, but the exact same query runs really slow in Environment B!  Environments are supposed to be the same, so what should I do and/or where should I look in order to see why the query doesn't perform the same?


Mathematicians designate one solution to $x^2 = -1$ as $i$ and the other as $-i$.  Would anybody notice if we switched their identities?  Any polynomial $p(x)$ with a complex root will also have its conjugate as a root.  Is there any equation in real numbers with a complex solution that does not have its conjugate as another solution?

Consider the two imaginary numbers $i$ and $-i$. Is there any fundamental difference between the two of them? If I take the field $\mathbb{C}$ and apply the map $a + bi \mapsto a - bi$ does the image end up meaningfully different from the field I started with? Or when we write out complex numbers are we arbitrarily choosing which of the non-real solutions to $z^4 = 1$ to call $i$ and which to call $-i$?


How do I copy all the folder, subfolders and files permissions (recursively) from /www_03062018 to my new /www ?  I came across this post:   chmod --reference=RFile file   Which didn't help much, it did apply a change for the main folder /www but didn't apply on its subfolders and files.    i have tried:   chmod -R --reference=/www_03062018 /www   and it didn't work.   My situation:   I have 2 folders on my Ubuntu machine: /www and /www_03062018.   /www is a "git clone" from the production machine.   /www_03062018 is my old directory that i used to work on and upload files via FTP.   I started to use GIT and when I clone a directory - all its folder ownerships and file accesses settings doesn't get cloned too.

I have two files in a directory. One has correct permissions and the other has not. Is there a way I can "copy" the set of permissions from one file to another?


I tried to do -1 >> 1 in java, but the result printed was still -1 At the beginning, I thought this is because of sign extending nature of arithmetic right shift. But through additional tests, I found that -1 >> [0, 64] is -1. Why is this happening?

I've been attempting to learn C in my spare time, and other languages (C#, Java, etc.) have the same concept (and often the same operators) ...   What I'm wondering is, at a core level, what does bit-shifting (<<, >>, >>>) do, what problems can it help solve, and what gotchas lurk around the bend? In other words, an absolute beginner's guide to bit shifting in all its goodness.


The General Question  What is the python3.5+ syntax for calling a function that accepts *args, where *args references a variable with multiple items.     I am self taught python; I can't help but think I am missing something rather elementary about how *args works. Feel free to point me to some necessary reading.   A Specific Question  When sorting a list of lists by columns using operator.itemgetter(*items), how can I provide *items variably?  Sample List  import operator  records = [     ['0055613893 ', 'AP', 'BU', 'AA', '00005000012404R'],     ['0048303110 ', 'MM', 'BU', 'AB', '00028230031385R'],     ['0044285346 ', 'AP', 'BU', 'AA', '00062240050078R'],     ['0048303108 ', 'MO', 'BU', 'AF', '00047780036604R'],     ['0048751228 ', 'AP', 'ME', 'AC', '00000750013177R'],     ['0045059521 ', 'AR', 'YT', 'AB', '00005430014570R'] ]   If I wanted to sort this particular recordset by the 3rd column and then by the 1st column I would:  records.sort(key=operator.itemgetter(3, 1))  This, of course, works as one would expect.  What I'm getting at is how can I provide the "3, 1" to itemgetter() variably?  i.e.:  indices = {insert some code here to provide itemgetter() what it needs} records.sort(key=operator.itemgetter(indices))  I've Tried:  tuple:   indices = (3, 1)  or  indices = 3, 1  TypeError: list indices must be integers or slices, not tuple  list:   indices = [3, 1]  TypeError: list indices must be integers or slices, not list     It's never too late to be humbled by the basics. Thanks in advance for assisting in filling this gap in my python foundation.

In the following method definitions, what does the * and ** do for param2?  def foo(param1, *param2): def bar(param1, **param2):


My pc specifications :  Display: Intel 82945G Express chipset Family  Ram :2 gb  Processor: Intel Core 2 Duo E4500 @2.20GHz 32 Bit windows 7  I want to run gta 4 on my pc anyway and graphics could be messed up but should give at leat 15-29 fps . Is it possible to rum this game on my pc smoothly (With any use of modding, swiftshader etc )  Bcoz I can't buy dedicated Gpu right now but really want to play it on my pc .  Please help !

Is there a service that I can use to check if my machine will be able to run a certain game?


I can seem to get this code to work, I receive the error "Commands out of sync; you can't run this command now" when it gets to " $stmt->execute(); "   I'm using eclipse to debug it but I'm more familiar with procedural code, it appears to be running ok upto the stmt->execute part.  the code is below  function execSQL($sql, $params, $close){ $mysqli = new mysqli("localhost", "web_user", "jaitec", "ebay");  $stmt = $mysqli->prepare($sql) or die ("Failed to prepared the statement!");  call_user_func_array(array($stmt, 'bind_param'), refValues($params));  $stmt->execute();  if($close){     $result = $mysqli->affected_rows; } else {     $result = $mysqli->affected_rows;     $meta = $stmt->result_metadata();      while ( $field = $meta->fetch_field() ) {         $parameters[] = &$row[$field->name];     }      call_user_func_array(array($stmt, 'bind_result'), refValues($parameters));      while ( $stmt->fetch() ) {         $x = array();         foreach( $row as $key => $val ) {             $x[$key] = $val;         }         $results[] = $x;     }      $result = $results; }  $stmt->close(); $mysqli->close();  return  $result; }   function refValues(&$arr) // Changed $arr to reference for PHP v7.1.7 { if (strnatcmp(phpversion(),'5.3') >= 0) //Reference is required for PHP 5.3+ {     $refs = array();     foreach($arr as $key => $value)         $refs[$key] = &$arr[$key];         return $refs; } return $arr; }  $_REQUEST['term']   = "m8 knob"; $part_1     =   "knob"; $part_2 =   "m8"; execSQL("SELECT * FROM web_search WHERE part_no LIKE ? AND part_no LIKE ?", array('ss', $part_1, $part_2), false);

I am trying to execute my PHP code, which calls two MySQL queries via mysqli, and get the error "Commands out of sync; you can't run this command now".  Here is the code I am using  <?php $con = mysqli_connect("localhost", "user", "password", "db"); if (!$con) {     echo "Can't connect to MySQL Server. Errorcode: %s\n". Mysqli_connect_error();     exit; } $con->query("SET NAMES 'utf8'"); $brand ="o"; $countQuery = "SELECT ARTICLE_NO FROM AUCTIONS WHERE upper(ARTICLE_NAME) LIKE % ? %"; if ($numRecords = $con->prepare($countQuery)) {     $numRecords->bind_param("s", $brand);     $numRecords->execute();     $data = $con->query($countQuery) or die(print_r($con->error));     $rowcount = $data->num_rows;     $rows = getRowsByArticleSearch("test", "Auctions", " ");     $last = ceil($rowcount/$page_rows); }  else {  print_r($con->error); } foreach ($rows as $row) {     $pk = $row['ARTICLE_NO'];     echo '
' . "\n";     echo ''.$row['USERNAME'].'	' . "\n";     echo ''.$row['shortDate'].'	' . "\n";     echo 'DELETE RECORD	' . "\n";     echo '
' . "\n"; } function getRowsByArticleSearch($searchString, $table, $max) {     $con = mysqli_connect("localhost", "user", "password", "db");     $recordsQuery = "SELECT ARTICLE_NO, USERNAME, ACCESSSTARTS, ARTICLE_NAME, date_format(str_to_date(ACCESSSTARTS, '%d/%m/%Y %k:%i:%s'), '%d %m %Y' ) AS shortDate FROM AUCTIONS WHERE upper(ARTICLE_NAME) LIKE '%?%' ORDER BY str_to_date(ACCESSSTARTS, '%d/%m/%Y %k:%i:%s')" . $max;     if ($getRecords = $con->prepare($recordsQuery)) {         $getRecords->bind_param("s", $searchString);         $getRecords->execute();         $getRecords->bind_result($ARTICLE_NO, $USERNAME, $ACCESSSTARTS, $ARTICLE_NAME, $shortDate);         while ($getRecords->fetch()) {             $result = $con->query($recordsQuery);             $rows = array();             while($row = $result->fetch_assoc()) {                 $rows[] = $row;             }             return $rows;         }     } }   I have tried reading up on this, but I am unsure of what to do. I have read about store result and free result, however these have made no difference when using them. I am unsure at exactly which point this error is being caused, and would like to know why it is being caused, and how to fix it.  Going by my debug statements, the first if loop for countQuery is not even being entered, because of an error in my sql syntax near near '% ? %'. However if I just select * instead of trying to limit based on a LIKE clause, I still get the command out of sync error.


How about a millionaire badge? I got this idea after reading another post about SO recontinuing swag, where one of the answers asked what swag, if any, users would get when they reach one million reputation. Because this is such a major milestone, I am proposing that there is a gold badge to mark when members of SO or another site reach 1 million or 1000k points. (This would also be given to existing users like Jon Skeet who already have reached the 1 million mark.) Please tell me what you think of this idea, and whether or not it is a good idea.

Should there be a new level of badges added above gold, ie Platinum badges?  My reasoning is that two questions on SO (the programmer  and  questions) have greater than 100k views, and several others are well above the 10k view requirement for the "Famous Question" badge.  Maybe SO should implement platinum badges, say for 250k views, getting 1k favorites or upvotes, things that are extremely rare but will happen eventually.  Since gold badges are so common now, I think it's fair to have some achievements that are extremely difficult to achieve.  What are your thoughts?  Edit:  Maybe the things like view-counts and stuff aren't the best example for achieving platinum badges.  Maybe it would be best to reward extremely stellar contributions, but I just like the idea of having some super-rare achievements.


I am trying to understand the difference between a continuous function and a uniformly continuous function.  Is there example of a function that is continuous but not uniformly continuous and a function that is both continuous and uniform continuous?

Let $f(x) = \frac{1}{x}$ for $x > 0$ and take our set at which the function act on $(0,1]$. This function is continuous but not uniformly continuous on $A$.  To prove this consider $\epsilon = 10$,and suppose we have $\delta$, $0 < \delta < 1$. Taking $x = \delta$ and $p = \frac{\delta}{11}$, we get  $|x - p| < \delta$ and $|f(x) - f(p)| = \frac{11}{\delta} - \frac{1}{\delta} > 10$.   In the following example from my book shows this is continuous but not uniform continuous but the example is missing correct ? since we also need to find counter example for $\delta \geq 1$ right ? If someone could present that example too that would be nice.  Also my question is different since the possible duplicate above shows very different question to the question I am asking here since I am asking why we must consider $\delta \geq 1$ so please read carefully my question.


So my GRUB partition got corrupted and eventually I decided to format the partition and reinstall GRUB.  I want to install it on /dev/sda which has the following partitions:  /dev/sda2 (at the beginning of the disk, 24MB, where grub used to be) /dev/sda1 (Kubuntu 18.04 LTS) /dev/sda3 (Arch Linux)   I am using an old-ish Sony VAIO (BIOS system) and the Kubuntu Live CD. I've formatted /dev/sda2 using gparted.  /dev/sda2 is mounted in /mnt. Trying to install GRUB gives me this error:  root@kubuntu:~# grub-install /dev/sda2 --force Installing for i386-pc platform. grub-install: error: failed to get canonical path of `/cow'.   The partition /dev/sda2 is empty, by the way. I don't have GRUB installed on it as it has just been formatted.

I am trying to install Ubuntu 12.10 for quite some time, and passing hurdles one by one. Now I am in a situation as follows.  I have got a PC and 10 GB HDD which will be totally dedicated to Ubuntu so no option of Wubi and dual boot.  I was trying to install from DVD, but it is getting stuck at "Out of frequency" error. So I had to adapt for USB boot option. But my PC is USB non bootable, so workaround is "Plop Boot Manager". So I am doing the installation procedure as follows:   starting  from a CD drive which is having plop installed. opting for for USB boot in plop options. booting begins from USB. monitor eventually gives "out of frequency" error press Shift+Alt+F1 to get the terminal. open the grub with sudo nano /etc/default/grub. do necessary changes. sudo update-grub.   Now here I am getting error as follows:   /usr/sbin/grub-probe:error:failed to get canonical path of /cow.     My system is   P4 3.06 GHz, 1 GB ram , 10 GB HDD without an OS, monitor CRT lg StudioWorks (7 years old). Mobo Mercury P4 266a NDMx (865 equivalent). The whole system is perfectly in working condition under XP, but it is USB non bootable, and all other devices working perfectly.  What should I do next?


Edit: Apologies for posting a duplicate and such a basic question! I thought it was a trickier one than it actually was, and failed to discover the cited article in my original search.  For the language standard experts out there, is the value of an expression like:  (a=1, b=2, c=3)   ... defined? From my tests, it appears that all of our compilers evaluate this expression as 3 (GCC, MSVC, Clang).  However, I'm not sure if we should lean on this behavior. I have no intention of writing code like this, but encountered some obscure code which was leaning on this behavior with multiple assignment in a conditional, and was wondering if it was well-defined.

How does the comma operator work in C++?  For instance, if I do:  a = b, c;     Does a end up equaling b or c?   (Yes, I know this is easy to test - just documenting on here for someone to find the answer quickly.)  Update:  This question has exposed a nuance when using the comma operator.  Just to document this:  a = b, c;    // a is set to the value of b!  a = (b, c);  // a is set to the value of c!   This question was actually inspired by a typo in code.  What was intended to be  a = b; c = d;   Turned into  a = b,    //  <-  Note comma typo! c = d;


I am getting the error message Missing insert { when using the below mathematical equation. I have no spaces between the equation so not sure where is the issue. Thanks \begin{equation} MAE = \frac{1}{n}\sum_{i=1}^{n}|{y}-{y^_j}| \end{equation}  \begin{equation} RMSE = \sqrt{\frac{1}{n}\sum_{i=1}^{n}({y}-{y^_j})^2} \end{equation}

I need to display the symbol '^'  d <- dist(fascores, method = "euclidean")^2   How do I do that?


I'm using . In chapter 3 I tried referring the placeholder image but it is not referring to it correctly as shown in image.    \section{Figure}\index{Figure} I'm referring to figure \ref{fig:placeholder}. \begin{figure}[h] \label{fig:placeholder} \centering\includegraphics[scale=0.5]{placeholder} \caption{Figure caption} \end{figure}   You can find the complete code .  What should I do to correct it?

\documentclass{article} \usepackage{algorithm}  \begin{document} \setcounter{section}{54} \section{A section with no label} \begin{algorithm} \label{myalg} \caption{An algorithm with the label `myalg'.} \end{algorithm} Reference to myalg: \ref{myalg}. \end{document}   With this code, the reference givens 55 (the section number); if I move the label after the caption command, I get the correct reference (1).  Why should this be the case? I find it confusing: when thinking about an algorithm as an environment, you expect to be able to label it right after you began it. At the very least I would expect some kind of error or "??" to appear, rather than the previous environment or reference-able entity being used.


I am making a program to record the position of a mouse when someone presses the Space button.  This works fine, however when I put the cursor in any textBox in the form the code becomes useless of course because the space gets typed in the textBox. I tried to change the focus() or try other keys like LeftWin ... but none worked!   Any advice on how can I detect the Space button (or any other key) all the time in a form?  private void lebel1_KeyDown(object sender, KeyEventArgs e) {    if (e.KeyCode == Keys.Space)    {       //bla bla    } }

I'm looking for a best way to implement common Windows keyboard shortcuts (for example Ctrl+F, Ctrl+N) in my  application in C#.  The application has a main form which hosts many child forms (one at a time). When a user hits Ctrl+F, I'd like to show a custom search form. The search form would depend on the current open child form in the application.  I was thinking of using something like this in the ChildForm_KeyDown event:     if (e.KeyCode == Keys.F && Control.ModifierKeys == Keys.Control)         // Show search form   But this doesn't work. The event doesn't even fire when you press a key. What is the solution?