According to dictionary:  adjective     well known for some bad quality or deed.   But sometimes I see news or people say:   infamous [person] infamous [movie] ...   and I checked these person or movie don't have bad manners or bad quality at all, and it sounds to me "infamous" in these cases more positive (or I am wrong). So should I understand "infamous" with a negative meaning?  EDIT: For example, one video went viral about a dad having an interview at home and his toddler broke into the room, it was funny, and the event was harmless (I guess). And now I am reading this article:  . If according to dictionary, then it means bad deed. But this event went viral and peope loved it.

I read this sentence on BBC News,     He was among those beaten by police during the infamous Selma-Montgomery voting rights march of 1965.   link:   As  I read suggested, Infamous is used for      having an extremely bad reputation   or     deserving of or causing an evil reputation   It seems to me, the word infamous only can be used to describe a event caused by the bad people, so in this BBC News article, it is the attack on the march being bad (infamous) and the march itself organised by civil rights activists to express a good will is not.  I just lost here, can someone explain it to me why they use infamous here?


Since the df are different between t-tests and emmeans ones (cf. ), how then should I interpreted the results?

Let us look at some sample data for 5 hypothetical subjects.  library(emmeans) library(lme4)  # generate some sample data # condition (Placebo, Treatment) # type (some factor, e.g. two different medications) # value (outcome of interest) # subject  data <- data.frame(condition = as.factor(rep(c(0,1), times = 10)), value = rnorm(20), type = rep(c("A","B"), each = 10), subject = as.factor(rep(rep(1:5, each = 2), times = 2)))   Now we like to conduct a mixed model and post-hoc tests with emmeans, where we test conditions per type in a pairwise fashion:  # caluculate a mixed model fit_data <- lmer(value ~ condition*type + (1|subject), data = data)  # emmeans post-hoc test emmeans(fit_data, pairwise ~ condition | type)   So for each type (A or B), I have paired data (condition 0 has 5 data points and condition 1 has 5 data points). If I would do a paired t-test like so:  # paired t-test t.test(data[data$condition==0 & data$type=="A","value"], data[data$condition==1 & data$type=="A","value"], paired = TRUE) t.test(data[data$condition==0 & data$type=="B","value"], data[data$condition==1 & data$type=="B","value"], paired = TRUE)   I would get degrees of freedom of 4 for the paired t-test, but emmeans says the degrees of freedom are 12. Why is there this huge difference? If the emmeans package also would use df = 4, then the p-values would also be more comparable.


I noticed in  that there are multiple close reasons presented. Here's a screenshot of the post notice:  From my understanding, only one close reason is selected when closure occurs, and this reason is typically the reason chosen first, most highly-voted for, or the reason a moderator chose. Quoting :  Multiple canned off-topic reasons are no longer shown on closures going forward; instead, only one is shown, and the one that gets shown is the first one to have been voted for. (This does not affect questions closed prior to the revamp.)  But this doesn't appear to be true given that multiple closure reasons are visible above. Question closure was very recently updated to no longer show the users who voted to close to the author in the author's post notice. Instead, it simply explains the closure reason and gives guidance on what to do next. So... When are multiple closure reasons displayed? Further, is this intentional? When the post notice changes were launched, it appeared that only the highest (or first) voted off-topic/community-specifc reason was chosen. Is this no longer the case?

When voting to close a question, it's possible for users to vote for any close reason, even if others have voted for different reasons. However, in the end, once the question reaches five close votes for any reason, only one of those reasons can be displayed.  How does the system determine which one close reason to display, given the votes made by users?


If I were to accidentally ask a question as an unregistered user, could I go back and delete that question?

I used to think that all users can delete their own posts, as long as these posts haven't gained a relevant number of upvotes. After seeing posts  again and again, I decided to verify my assumption and found out that you actually can't delete your own answers if you post from a low reputation, cookie based account.  Is there a reason for this or is this unintentional?  In my opinion even users without a "substantial" account should be able to change their minds and delete an answer if they think better of it.


I have an early 2011 MacBookPro 13" with a dead motherboard.  I would like to detach the screen and use it as an external monitor.  Has anyone ever done that? Does anyone have information about pins on the video connector which goes from the display to the motherboard? Any information is welcome :)  Thanks.

Is it possible to use my Macbook Pro's display to receive inputs from other sources?


This question is prompted by the latest of a long series of questions on English Language and Usage about gender neutral terms in English.    I seem to remember that Captain Janeway was called "Sir", but I have a broader question than about that particular point: did Startrek change over the years, from the first TGO episodes filmed to the recent films about the alternate universe, in how women officers were addressed when their rank was not the means of address?  (Female officers certainly changed in how they were dressed!)

It is well established in Star Trek: The Next Generation that female superior officers are normally referred to as sir.  This is applied to Dr. Crusher, Counselor Troi, Cmdr. Shelby, Maj. Kira, Lt. Dax, and numerous admirals.   This obviously fits in well with the egalitarian ideals of Star Trek. This convention is made explicit in "Thine Own Self":  DATA: Counsellor, have you been promoted in my absence? TROI: That's right. Which means from now on you can call me sir. DATA: Yes, sir.  In Addition, the first episode of Star Trek: Voyager, "Caretaker" contains this dialog:  KIM: Thank you, sir. JANEWAY: Mister Kim, at ease before you sprain something. Ensign, despite Starfleet protocol, I don't like being addressed as sir. KIM: I'm sorry, ma'am. JANEWAY: Ma'am is acceptable in a crunch, but I prefer Captain. We're getting ready to leave. Let me show you to the bridge.  which again establishes that sir is the norm, although Capt. Janeway doesn't prefer it. Did this usage of the honorific sir start with ST: TNG or does it predate TNG in either sci-fi or the real world?  Related:


I know stackoverflow wants to be very concise about their questions and answers, so I was thinking that they may not want formalities mixed in with the Q&A. To be clear, I am asking if "Thanks!" and "You've been very helpful!" belong in comments. Any thoughts?

There have been a number of cases where I would like to thank someone for providing me with a thorough response and give them feedback beyond the vote up. Often I wish people would tell me why they voted me up. Not that the thank you part is necessary but it sets it apart from the other comments related to answering the question itself.  In this type of situation is a "Thank you" acceptable in a comment?     For more information, see  in the .


For an attack to successfully hit a given Armor Class, would it need to get a number higher than the Armor Class? Or does it hit if the total exactly equals the Armor Class value as well? Does the answer to this question change depending on what type of attack it is?

I'm having trouble finding something to clarify this. It's been mentioned in the Difficulty Class section of the DMG (238) that there should be a 50/50 chance that an average person can succeed at a DC 10 challenge, implying you have to beat it. However, I'd always thought that there's a 50/50 chance for an average person to hit another average person, but the chance is really 55/45, since you only have to equal their AC.


For some reasons I have to use old distro Fedora12, and yum in its default configuration is unable to locate URLs for packages.  % yum search gcc Loaded plugins: refresh-packagekit Error: Cannot retrieve repository metadata (repomd.xml) for repository: fedora/ Please verify its path and try again   YUM repos configuration at /etc/yum.repos.d/fedora.repo has the following:  #baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/ mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch   This means that the above mentions site links are no longer valid, don't exist. Are there some mirrors still keeping packages for old distros? In this situation, what URL should I provide to make it work?

I'm trying to rebuild , which uses Fedora Core 4 as its base. Can anyone direct me to a mirror that still hosts the files?


I have the following table:

         Transformations

   This table is filled with generated tds when a user do something.What i want is when a user click on a generated td to show the text of the td he clicked on.I am using the following javascript code:  $("#table_tran td").on("click",function(){     alert($(this).html()) });   This code won't work on generated tds.Any ideas? If i use this:

             Transformations

fxfjjf

   The code will work only for the td "fxfjjf"

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


I need to know which files have been copied to or removed from a directory or folder such /dev or /mnt or any other directory.  How can I do that?

How can I create a script for monitoring file transferring  including the source location and the destination location ? ( example : Test.file from /home/Desktop to /home/Documents ) .


Habitat:  Men's room at a rest stop in Syracuse, New York.  Size: ~1 cm  Based on my limited searching ability, I think it's a type of "drain fly" (Psychodomorpha):   Hard to get a better picture without a macro lens, but is anyone able to speciate this fuzzy urinal-fly?

It's about 3 millimetres in length. Found on September 10, 2015.


In TWRP, I originally intended to only formating Data as F2FS but didn't know that from around Android 5, data is a subfolder under /sdcard and everything in /sdcard is gone. How could I retrive a full image of Android internal storage so that I could try to use some data recovery softwares recovering as much as possible?

I factory reset my rooted Android M phone but now I realize that there was a file in the /data directory which I need.  Is it possible to create an image (.img or something similar) of the /data partition so that I could run some recovery software for ext4 on that image? I have a little knowledge about ADB.


I have this function f(x, a, b):  def f(x, a, b):     return a*x + b   and I have to pass this function to another one with 'a' and 'b' pre-set, e.g.:  def print2(f):     x = np.linspace(0,1,10)     print(f(x))  print2(f( , 1, 1))   I know that there are other ways to solve this particular problem, however this is just an example, not the real problem, and I'd like to know if there's anyway to do something like this "print2(f( , 1, 1))". In other words, is there anyway to do this without having to pass the arguments all the way through? Like,  def print3(f, a, b):     x = np.linspace(0, 1, 10)     print(f(x, a, b)) print3(f, a, b)

How can I bind arguments to a Python method to store a nullary functor for later invocation?  Similar to C++'s boost::bind.  For example:  def add(x, y):     return x + y  add_5 = magic_function(add, 5) assert add_5(3) == 8


Me and my friend have leveled up to level 51 and fought Pyro Pete on TVHM 3-4 times and he hasn't dropped a single crystal. The quest was on the first time and we just farmed him but nothing was happening. What are we doing wrong?

There's someone much like Crazy Earl in Oasis behind a locked door. He tells me to leave until I've killed a seraph guardian or I get some sort of guardian crystal.  I just beat the DLC and did many of the sidequests and I'm still stumped as to how to get such a crystal. I assumed there would be Guardian foes just like in Borderlands 1, and they'd drop this item. After completing the story...there were no such enemies. So what do I do?


Is possible to get the original function "behind" a function that is a result of .bind()? I want to get the toString() of it.  function foo() {     return 'bar'; }  let baz = foo.bind();  console.log(baz.toString()); //-> function foo() { return 'bar'; } and not -> function () { [native code] }

function main() {    Hello(); }  function Hello() {   // How do you find out the caller function is 'main'? }   Is there a way to find out the call stack?


Let $A$ be a Noetherian ring and $M$ a finitely generated $A$ module. In Ravi Vakil's notes he first states that the associated points of $M$ satisfy the following:  (A) The associated points of $M$ are precisely the generic points of irreducible components of the support of some element of $M$ on Spec $A$.   I am working on the following exercise: Assuming (A) show that the associated points of $S^{-1}M$, where $S$ is a multiplicative subset of $A$, are precisely those associated points of $M$ that do not meet $S$.  I was able to show that: given $m/s \in S^{-1}M$ there is a bijective correspondence as sets between Supp $m/s$ and the the points on Supp $m$ that do not meet $S$. From here I think I can use (A) somehow to complete the exercise, but  I am having difficulties with it. I would appreciate any assistance! Thank you very much!  PS I asked this question also  working on this exercise. It might be helpful here, but I couldn't quite complete the exercise...

$\DeclareMathOperator{\ass}{Ass}$     Let $R$ be a Noetherian ring and $S$ be a multiplicative set in $R$. Then show that   $\ass_R(S^{-1}M)=\ass_R(M)\cap \{P\in \text{Spec}(R):P\cap S=\emptyset\}$   Attempt: Let $P\in \ass_R(S^{-1}M)$. We argue that $S\cap P=\emptyset$. Say $P=\text{Ann}(m/s)$ for some $m/s\neq 0$ in $S^{-1}M$. If $r\in P\cap S$, then from $r\cdot (m/s)=0$ we get $(r/1)\cdot (m/s)=0$. But $r/1$ is invertible in $S^{-1}R$ and thus we have $m/s=0$, a contradiction. So we must have $S\cap P=\emptyset$.  The main difficulty I am having is in showing that $P\in \ass_R(M)$. I suspect that $P=\text{Ann}(m)$. Clearly, if $r\cdot m=0$, then $r\cdot (m/1)=0$ and therefore $r\in P$. So $\text{Ann}(m)\subseteq P$. On the other hand, if $r\in P$, then $(r\cdot m)/s=0$, giving an element $u\in S$ such that $(ur)\cdot m=0$. But I am getting nowhere with this.


Currently we are showing the description of meta participation badges(Convention and Quorum) as      Quorum: One post with score of 2 on meta      Convention: 10 posts with score of 2 on meta   It should be like post with score of 2 or more will be more apt.    We already have this wordings for many other badge descriptions.

The  has the wording:     10 posts with score of 2 on meta.   Does this mean that to get the badge I need 10 posts with a score of exactly 2 at the same time?  Should the wording be changed to something like:     10 posts with score of 2 or more on meta.


I'm using a ViewPager Activity in my app, and in the template activity it includes a static Fragment. In the provided template there are 3 pages in the ViewPager each showing this single static Fragment. I want to have a button in this Fragment, but it seems like when adding a button with an OnClickListener in a static class things get weird. Unless there is another issue. Here is my Fragment code:  public static class LinearFragment extends Fragment {          RecyclerView recyclerView;         public ArrayList<AndroidVersion> data;         public DataAdapter adapter;          @Override         public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){             View rootView = inflater.inflate(R.layout.fragment_linear, container, false);              Button button = (Button) getActivity().findViewById(R.id.view_pager_button);             button.setOnClickListener(new View.OnClickListener() {                 @Override                 public void onClick(View v) {                     Intent mainActivityIntent = MainActivity.newIntent(getActivity().getApplicationContext());                     startActivity(mainActivityIntent);                 }             });              recyclerView = (RecyclerView) rootView.findViewById(R.id.card_recyler_view_pager);             recyclerView.setHasFixedSize(true);             RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false);             recyclerView.setLayoutManager(layoutManager);             loadJSON();              return rootView;         }          private void loadJSON() {             Retrofit retrofit = MainActivity.getRestAdapter();             RequestInterface request = retrofit.create(RequestInterface.class);             Call<JSONResponse> call = request.getJSON();             call.enqueue(new Callback<JSONResponse>() {                 @Override                 public void onResponse(Call<JSONResponse> call, Response<JSONResponse> response) {                     JSONResponse jsonResponse = response.body();                     data = new ArrayList<>(Arrays.asList(jsonResponse.getAndroid()));                     adapter = new DataAdapter(data);                     recyclerView.setAdapter(adapter);                     Log.d("TAG","Adapter should have gotten set", new Exception());                 }                  @Override                 public void onFailure(Call<JSONResponse> call, Throwable t) {                     Log.d("Error", t.getMessage());                 }             });         }      }   I get the runtime error: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference when attempting to click the button. Is this because the class is static?  Thanks

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


I'm doing a simple Javax.swing program, but there's some errors I really don't get. Here's the full code:  import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.Color; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField;  public class JFrameColore extends JFrame { public JFrameColore() {     this.setSize(600, 300);      label_R = new JLabel();     label_R.setText("R");      label_G = new JLabel();     label_G.setText("G");      label_B = new JLabel();     label_B.setText("B");      text_R = new JTextField();     text_G = new JTextField();     text_B = new JTextField();      button_COLORA = new JButton();      Azusa azunyan = new Azusa();      button_COLORA.addActionListener(azunyan);      panel_COLORE = new JPanel();       label_COLORA = new JLabel();  }  public final JLabel label_R, label_G, label_B;  public final JTextField text_R, text_G, text_B;  public final JButton button_COLORA;  public final JPanel panel_COLORE;  public final JLabel label_COLORA;  private class Azusa implements ActionListener {      @Override     public void actionPerformed(ActionEvent e)     {         boolean colorable = true;         if (!isNumber(text_R.getText()))         {             colorable = false;             text_R.setText("ERR");         }         else if (Integer.getInteger(text_R.getText()) < 0                 || Integer.getInteger(text_R.getText()) > 255)         {             colorable = false;             text_R.setText("ERR");         }         if (!isNumber(text_G.getText()))         {             colorable = false;             text_G.setText("ERR");         }         else if (Integer.getInteger(text_G.getText()) < 0                 || Integer.getInteger(text_G.getText()) > 255)         {             colorable = false;             text_G.setText("ERR");         }         if (!isNumber(text_B.getText()))         {             colorable = false;             text_B.setText("ERR");         }         else if (Integer.getInteger(text_B.getText()) < 0                 || Integer.getInteger(text_B.getText()) > 255)         {             colorable = false;             text_B.setText("ERR");         }            if (colorable)         {             panel_COLORE.setOpaque(true);             panel_COLORE.setBackground(new Color(                      Integer.getInteger(text_R.getText()),                     Integer.getInteger(text_G.getText()),                      Integer.getInteger(text_B.getText())             ));         }      }  }  protected boolean isNumber(String gringo) {     for (int i = 0; i < gringo.length(); i++)     {         if (!Character.isDigit(gringo.charAt(i)))         {             return false;         }     }     return true; }  }   For example, when I do  else if (Integer.getInteger(text_R.getText()) < 0                     || Integer.getInteger(text_R.getText()) > 255)  I get a NullPointerException, I really don't know why since I checked the values to be integer. What am I doing wrong? It would be nice for someone who's more experienced in Swing to explain.


I am developing a program for my final project of college that consists of taking several SQL scripts from a fixed folder and executing them. In a meeting with my project supervisor he said that it would be a good idea to make sure that if an error is detected while running one of the scripts the program should stop running the script and stop. And i'm having problems with the part of stopping the program after it detects the error. Help would be very appreciated. Btw this is all done in C# (WindowsFormsApp(.NET Framework)). The script that i'm showing works perfectly.         public string ExecuteFiles(string connectionString, string fileName)         {             var result = string.Empty;             //var error = ">> [" + MethodBase.GetCurrentMethod().Name + "]\n";              try             {                 string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Updates", fileName);                  string script = File.ReadAllText(path);                  using (SqlConnection connection = new SqlConnection(connectionString))                 {                     Logger.Debug("Script a ser executado: " + fileName);                      connection.Open();                      Server server = new Server(new Microsoft.SqlServer.Management.Common.ServerConnection(connection));                      server.ConnectionContext.ExecuteNonQuery(script);                      Logger.Debug("Script executado: " + fileName);                 }             }             catch (Microsoft.SqlServer.Management.Common.ConnectionFailureException cfe)             {                 Logger.Error("Message: " + cfe);                 lblmsg.Text = ">> [Message] => " + cfe.Message + "\n";              }             catch (SmoException se)             {                 Logger.Error("Message: " + se);                 lblmsg.Text = ">> [Message] => " + se.Message + "\n";              }             catch (Exception ex)             {                 Logger.Error("Message: " + ex);                 lblmsg.Text = ">> [Message] => " + ex.Message + "\n";                  if (ex.InnerException is SqlException)                 {                                   SqlException sqlex = (SqlException)ex.InnerException;                     lblmsg.Text = ">> [Message] => " + sqlex.Message + "\n";                     Logger.Error("Message: " + sqlex);                 }             }             return result;         }

What are the best practices to consider when catching exceptions and re-throwing them? I want to make sure that the Exception object's InnerException and stack trace are preserved. Is there a difference between the following code blocks in the way they handle this?  try {     //some code } catch (Exception ex) {     throw ex; }   Vs:  try {     //some code } catch {     throw; }


Let  $ f_1,\ldots,f_n$ be linearly independent linear functionals on a vector space $X$. Show that there are $n$ elements  $x_1,\ldots,x_n$ in $X$ such that the $n\times n$ matrix $[f_i(x_j) ]$ is non-singular.

Let  $f_1,\ldots,f_n$ be linearly independent linear functionals on a vector space $X$. Show that there exist $x_1,\ldots,x_n\in X,$ such that the $n\times n$ matrix $\big(f_i(x_j) \big)_{i,j=1}^n$ is non-singular.


Is there any library can do "ping" in pure python library and return like True or False. Currently I am using subprocess  for that

How do I ping a website or IP address with Python?


I am refactoring a series of RegExp a/b patterns that are used in two ways.  One uses the ^ as the third character.  /[^a-zA-Z0-9,?@&!#'"~ _;\.\*\/\-\+ ]/  The other doesn't use the ^  /[a-zA-Z0-9,?@&!#'"~ _;\.\*\/\-\+ ]/  Rather than write this pattern in two way is there a way to write it once and add the ^ to a second version?  This throws an error but as an example is there something available like this?   varOne = /[a-zA-Z0-9,?@&!#'"~ _;\.\*\/\-\+ ]/  varTwo = [varOne.slice(0, 1), '^', varOne.slice(1)].join('')

I would like to create a String.replaceAll() method in JavaScript and I'm thinking that using a regex would be most terse way to do it.  However, I can't figure out how to pass a variable in to a regex.  I can do this already which will replace all the instances of "B" with "A".  "ABABAB".replace(/B/g, "A");   But I want to do something like this:  String.prototype.replaceAll = function(replaceThis, withThis) {     this.replace(/replaceThis/g, withThis); };   But obviously this will only replace the text "replaceThis"...so how do I pass this variable in to my regex string?


I'm trying to code a simple script that uses sed to basic find&replace functionality. I want to have original file untouched and have results in new files called "file.n" (n is being incremented).  My main problem is with numbering new files. This is basic code of mine that has static functionality for n=1 and n=2:  #!/bin/bash n=1  if [[ -f file.$n ]] then sed -e 's/'$2'/'$3'/g' $1 > file.$((n+1))  else sed -e 's/'$2'/'$3'/g' $1 > file.1 fi   Input in terminal looks like: ./script text_sample.txt word_1 word_2  This code works okay for first and second use (if file.1 hasn't existed, it's going to save results here; else it will be saved in file.(n+1) which is file.2).  But how do I make it for file.3, file.4 etc? After launching this script every single time, at start it's n=1 and I don't really have more ideas how I can deal with it.  I've already tried some export variables, using specific variable as a command (to make this integer more like global); I guess some loops might be needed...  Any help would be appreciated.

I have a need to collect some duplicate files and want to avoid name collisions. The problem is that this collection of files might be added to by another execution of my script before the files are cleaned out and just want to continue to increment the number.  I decided on a simple until loop to increment the number like so.  until [[ ! -f ${PWD}/DUPES/${num}-$1 ]]; do num=$((num +1)) done mv --no-clobber $1 ${PWD}/DUPES/${num}-$1   I can't imagine ever exceeding 1k files in an extreme example, so my questions are...  Is this a terribly inefficient way to achieve this? Should I be parsing the existing files to get the highest leading number to start incrementing from there, or is this ok for the extreme example I put forth?  Or is there a better way all together?


I am still confused with whether, for example, the electron of carbon is exactly identical to that of hydrogen.   How can the scientist confirm this?

Why should two sub-atomic (or elementary particle) - say electrons need to have identical static properties - identical mass, identical charge? Why can't they differ between each other by a very slight degree? Is there a theory which proves that?  Imagine an alien of size of order of Milky-way galaxy examining our solar system with a probe of size of 10's of solar system dimension and concludes that all planets are identical.


Why do we cast malloc, as in the following?  ptd = (double *) malloc(max * sizeof(double));   What is malloc's normal return type? Why do we need to cast it?

In , someone suggested in a  that I should not cast the result of malloc. i.e., I should do this: int *sieve = malloc(sizeof(int) * length);  rather than: int *sieve = (int *) malloc(sizeof(int) * length);  Why would this be the case?


Here is the code:  import itertools, time x = {1:[1, 2], 2:[2, 3], 3:[3, 4]} l = [1, 2, 3] * 10000000 start = time.time() y = [x[i] for i in l] y = list(itertools.chain.from_iterable(y)) print(y[:6]) print(time.time() - start)  start = time.time() y = [] [y.extend(x[i]) for i in l] print(y[:6]) print(time.time() - start)   The first approach is to allow the inner lists to be nested, then flatten them out when the comprehension is finished. The second approach is to construct a flat list during comprehension.  It seems the first approach is a bit faster:  3.8479559421539307 4.469805955886841   I am wondering if there are better (faster) ways to do it?

Is there a simple way to flatten a list of iterables with a list comprehension, or failing that, what would you all consider to be the best way to flatten a shallow list like this, balancing performance and readability?  I tried to flatten such a list with a nested list comprehension, like this:  [image for image in menuitem for menuitem in list_of_menuitems]   But I get in trouble of the NameError variety there, because the name 'menuitem' is not defined.  After googling and looking around on Stack Overflow, I got the desired results with a reduce statement:  reduce(list.__add__, map(lambda x: list(x), list_of_menuitems))   But this method is fairly unreadable because I need that list(x) call there because x is a Django QuerySet object.  Conclusion:   Thanks to everyone who contributed to this question.  Here is a summary of what I learned.  I'm also making this a community wiki in case others want to add to or correct these observations.  My original reduce statement is redundant and is better written this way:  >>> reduce(list.__add__, (list(mi) for mi in list_of_menuitems))   This is the correct syntax for a nested list comprehension (Brilliant summary !):  >>> [image for mi in list_of_menuitems for image in mi]   But neither of these methods are as efficient as using itertools.chain:  >>> from itertools import chain >>> list(chain(*list_of_menuitems))   And as @cdleary notes, it's probably better style to avoid * operator magic by using chain.from_iterable like so:  >>> chain = itertools.chain.from_iterable([[1,2],[3],[5,89],[],[6]]) >>> print(list(chain)) >>> [1, 2, 3, 5, 89, 6]


The setting is a planet that has several regions, mostly medieval in technology level. Each region's people has a strange power; the story begins in the region of a people with enhanced healing. However, sometimes the healing factor goes too fast and starts growing too many/incorrect body parts; these misshapen monstrosities with dozens of limbs etc are kept in pens and I think harvested somehow? I forget the details.  The prince has recently begun to grow breasts, an obvious precursor to this condition, which will inevitably progress. He escapes (with the help of someone, I think?) and leaves the country before he is penned as well. He travels to many places, at some point is captured by lawmen, executed via crossbow, and buried, all of which he survives by virtue of his hyperactive healing. He eventually reaches a forest where the tribal inhabitants can accelerate and decelerate the flow of time around them, and learns to do this. The chieftain is relatively young upon meeting the main character, but is older by the time he learns the tribe's power. It is revealed that the cheerful and energetic chieftain has been living at an accelerated pace for quite some time and will soon die of old age. When this happens, main character and his girlfriend from the tribe decide they have nothing in particular to stick around for, and have time-dilated sex in public incredibly slowly for several real-time generations. He leaves, I think leaving her behind, and goes to a desert? Where he meets a hermit who teaches him genetic manipulation and fixes the error in his healing factor that causes it to generate extraneous body parts, while leaving it operating at its accelerated (even for his people) rate. Also something about sand, maybe telekinesis?  I don't remember much else about the book and the events may easily be out of order. I think the book itself was a relatively small hardback, with a cover either tan or off-white.

I read a book while in the US for a few months back in the early 1990s.  I remember liking the book, and only have loose bits and pieces in my head.  The main character was a male. I believe it started with him being horribly disfigured and was thrown of a ship. He discovered he could regenerate if seriously hurt. On his journeys he picked up new abilities (He learnt how to speed up and slow down time, just for himself). He could also travel through earth.  I remember a passage where he was with the people that could control time, there was a "statue" of a woman, but it was really a woman who lost someone and slowed down time so much that she appeared to be a statue for years..  I seem to remember some sort of twist with a spaceship at the end, but I might be mixing it up with something else.  I've been looking for this book for over 15 years now without any luck. Any idea what it is?


If you have:  $N\equiv 2\mod 3 ,\: N\equiv 3 \mod 4 , \: N\equiv 4 \mod 5 $  What is N?

Find natural number $x$ so that $$\begin{align}x&\equiv 9\pmod{10}\\ x&\equiv8\pmod9\\ &\ \ \vdots\\ x&\equiv 1\pmod2\end{align}$$


How to prove that  $\int_{0}^{+\infty }\frac{\cos x}{x}\ \mathrm dx $ diverges ?

Although I have known that $\displaystyle\int_0^\infty {{\sin x} \over x} \, dx = {\pi  \over 2}$, I have no idea how to work out $\displaystyle\int_0^{ + \infty } {{\cos x} \over x} \, dx$. How can I?


How can I make it so that the grub start up screen will not show up in debian when I boot?

Whenever I boot on Ubuntu, I see the entire GRUB menu by default. Is there a way I could make it simply auto-boot if uninterrupted within X seconds? I remember that this was the case on previous releases of Ubuntu, it would only show the GRUB menu if you held down a button during the boot.   How can I make GRUB do this by default and just get on with the boot process?


As a child is boy or girl; this doesn't depend on it's elder siblings. So the answer must be 1/2, but I found that the answer is 3/4. What's wrong with my reasoning? Here in the question it is not stated that the couple has exactly 4 children

This is similar to the .  So there are five cases, the gender of the children written according to their age,   GGGG GGGB GGBG GBGG BGGG   So the probability should be $\frac{4}{5}$. But the given answer is $\frac{3}{4}$.  Am I missing something?


My 8 Gb pen drive has suddenly change to read-only. In fact 2 pen drives have changed to read-only.  I don't know about how the first pen drive changed into read-only, but with the second pen drive I tried to make a bootable pen drive using start-up disk creator. In the middle of writing suddenly it threw some error. After this I couldn't copy any files to the drive or delete any file from it any more.  How can I make a read-only drive writeable?

At some point, the filesystem on my digital audio player has become read-only. I cannot copy files into it or remove files on it.  Are there some possible reasons for the player's file system to change permissions in this way?  I tried using chmod:  $ sudo chmod a+rw SGTL\ MSCN/  chmod: changing permissions of `SGTL MSCN/': Read-only file system   SGTL MSCN is the mount point of the digital audio player.  What else can I try to make it writeable?


I'm trying to upload a file using Selenium on Windows 7 using AutoIt following this tutorial .  The web page I'm using is this one  (click on "Choose File" button ...).  Here you are my Java code  package practiceTestCases;  import java.io.IOException;  import java.util.concurrent.TimeUnit;  import org.openqa.selenium.By;  import org.openqa.selenium.WebDriver;  import org.openqa.selenium.firefox.FirefoxDriver;  public class AutoIt_00 {  private static WebDriver driver = null;  public static void main(String[] args) throws IOException, InterruptedException {      driver = new FirefoxDriver();      driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);      driver.get("http://www.toolsqa.com/automation-practice-form");      driver.findElement(By.id("photo")).click();      Runtime.getRuntime().exec("C:/Users/xxx/Desktop/testAutoIt_03.exe");      Thread.sleep(5000);      //driver.close();     }  }   and this is the AutoIt code  #region --- Au3Recorder generated code Start (v3.3.9.5 KeyboardLayout=00000410)  --- WinWaitActive("C:\Users\520\Desktop\testAutoIt_03.au3 - SciTE","") Send("{TAB}") WinWaitActive("C:\Users\520\Desktop\testAutoIt_03.au3 * SciTE","") Send("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}") WinWaitActive("Caricamento file","") MouseClick("left",242,415,1) Send("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{UP}{UP}{UP}{ENTER}") #endregion --- Au3Recorder generated code End ---   I've tried to move in the window where select my file using keyboard and not the mouse hoping to semplify my job.  When execute the Java code it works, connect to the web site, open the window for the file choice but after this nothing happens .....   Suggestions?  Thank you very much in advance  Cesare

This is a canonical question, intended to provide a comprehensive answer to many related questions  During the course of a Webdriver test, I want to upload files. However, this opens a native file picker, which Webdriver doesn't seem to support interacting with. How do I interact with it?


Please help how can I solve that problem

I am using Micromax Spark which is running on 1 GB RAM and Android lollipop 5.0.   I downloaded the game from APK Mirror.  When I run it, it displays the Niantic logo and suddenly my phone restarts.  This happens every time I launch the game.


I understand the mechanics of the Pauli-Exclusion principle and how it is a common sense idea that a fermion can not occupy the same coordinates, quantum state, as another one.    Why is the Pauli-Exclusion principle not considered a force rather than just a principle?

You can have two electrons that experience each other's force by the exchange of photons (i.e. the electromagnetic force). Yet if you compress them really strongly, the electromagnetic interaction will no longer be the main force pushing them apart to balance the force that pushes them towards each other. Instead, you get a a repulsive force as a consequence of the Pauli exclusion principle. As I have read so far, this seems like a "force" that is completely separate from the other well known forces like the strong, electroweak and gravitational interaction (even though the graviton hasn't been observed so far).   So my question is: is Pauli-repulsion a phenomenon that has also not yet been explained in terms of any of the three other forces that we know of?  Note: does this apply to degenerate pressure too (which was explained to me as $\Delta p$ increasing because $\Delta x$ became smaller because the particles are confined to a smaller space (Heisenberg u.p.), as is what happens when stars collapse)?


I just started learning C after I already got a few years experience in Python, C# and Java. I learned in a tutorial, that char anything[] is always a pointer. (Today, someone told me this is wrong) - I think my question has something to do with this. Nevertheless, I'm trying to get the length of a char-array: #include <stdio.h>  int get_string_length(char * string) {     int length = 0;     while(string[length] != '\0')     {            char c = string[length];         length++;     }     return length; }  int get_string_size(char * string) {     return sizeof(string); }  int main() {     printf("%d\n", get_string_size("hello world")); // returns 8     printf("%d\n", get_string_length("hello world")); // returns 11     printf("%d\n", sizeof("hello world")); // returns 12 -> Okay, because of '\0'-char     return 0; }  result:  8 11 12  so, why is my get_string_size-method  returning 8 instead of 12? (Since both only call sizeof())

How do I determine the size of my array in C?   That is, the number of elements the array can hold?


This is a code fragment that I am working with for a logon system using hashset Users. I checked the enhanced for loop part it works but the if statement seems like it never works out, even if the values are equal.  if (comm.equals("Sign in")) {     user urs = new user(p_name, p_pass, p_id );      Iterator<user> iter = Users.iterator();     for(user obj : Users) {         if (p_u == obj.getUsername()&& p_pw == obj.getPassword ()&& p_sn== obj.getStudentID()) {             JOptionPane.showConfirmDialog(                 jf,                  "Success", "Success",                 JOptionPane.DEFAULT_OPTION);             break;         } else {             log_in.setText("Try Again");             exit.setText("Create User");          }

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


I do not encounter so big problems with the English language although I'm not a native English speaker. But I'm curious why some languages (like English or French) are written different from the way they are read? And the German or Slavic languages are WYSIWYG. So especially for beginners (but I use them sometimes too) there are transcriptions in the dictionaries how to read the corresponding word.  Is this because in the middle ages the west European societies were separated in classes (castes) and some of them were privileged to be literate and some not? Or this is a special way to save the pronunciation of the word?  Thanks in advance and regards!  PS: Some examples (the entire language is an example but... ;))   example [ig'za:mpl]  sometimes ['sʌmtaimz] literate ['litərət] language ['længwidʒ] although [ɔːlˈðəʊ] because  [bi'kɔz] you [ju] ...   and in German the corresponding words:   Beispiel manchmal gebildet obwohl weil du / ihr / Sie   And here (in German) you can see few exceptions too.   "ei" is actually [ai]. "sp" is [ʃp] "ch" is [h] vowel + "h" = long vowel / obwohl [obvo:l] / ihr [i:r] "ie" is [i:]   In English:   "A" is [a] and [ei] "C" is [s] and [k] "E" is [e] and [i] and nothing at the end of the word etc...   But in German "A" is only [a], "E" is only [e]...  I'll not give you examples in Slavic languages.

Given that English is derived mostly from German, when Anglo-Saxons (German tribes) migrated to Britain, how do you explain that   although German has a strict correspondence between written language and spoken language (the sounds largely follow 1-1 what is written)... English has sooo intricate pronunciation rules, sometimes directly at odds with what is written? (Too bored to give examples, but it should be obvious).   My pet, tongue-in-cheek theory is that those tribes weren't too literate, didn't have a sound knowledge of the written form of words, so it was easy the pronunciation to follow its own independent path.   Anyone with a more informed explanation?


I'm wondering if some of the device drivers will fail, or does the 64-bit CPU emulate 32-bit?

What's the difference between 32 bit OS and 64 bit OS? Can a 32 bit OS run in a 64 bit processor?


Let $G$ be a finite group, $A\subseteq G$ and put $A^{-1}=\{ a^{-1}:a\in A\}$.  Is it true that if $|A|>\frac{|G|}{2}$ then $A^{-1}A=AA^{-1}=G$?

I'v found this proposition.  If $G$ is a finite  group , $ A \subset G $ a subset and $|A| > \frac{|G|}{2} $ then $AA = G $.  Why this is true ?


While working on a different problem, I've run into the infinite product: $$\prod_{i=1}^\infty (1-2^{-i}) $$ Which I'm reasonably sure should be equal to $1-\frac{1}{\sqrt{2}}$. EDIT: It definitely doesn't equal this value, nevermind   However, I don't really have any notion of how to work with / prove things about an infinite product of this form. I tried considering the log of the partial products, but that doesn't seem to make the numerical value any easier to evaluate.  Doing some googling, these sorts of products seem to be called Euler products, or q series (see here: ). However, I can't find much or anything online about methods for finding their value. Is there any process that would yield a precise answer in this case?

I know that  $$\prod_1^\infty \left(1-\frac{1}{2^n}\right)$$  converges to a positive number because the series $\sum 2^{-n}$ is convergent.  Do we know the limit?  If so, how?  Aside:  I am interested in this product because it describes asymptotically the fraction of $n\times n$ matrices with entries in $\mathbb{F}_2$ that are nonsingular.


Today I was walking using my iPhone 6S running iOS 9.3 as a pedometer and it shutdown.   When I got home and plugged it in, it said 30% capacity.   That seems strange. I would expect it for 2% or 5% to preserve RAM, but 30%? Maybe there is a setting I don't know about.   My question is: Why does my iPhone power off when the battery is down to 30%?   Edit: this is not a duplicate of the low battery crash as I witnessed the low power shutdown and it was not a crash.

Some iPhone users (especially those with devices that've been in use for a while) encounter a problem where the device crashes once the battery gets low. For example:        "After updating to iOS 7 my iPhone 5 has been doing something strange.   When the battery gets low (usually around 20-30%), iOS will shut down   completely, and when you try to power the phone back on it flashes on   the screen telling you to plug the phone in to charge it (saying that   the battery is almost completely dead).   The phone refuses to power   on until you plug it in, but once I plug the phone in and power it   back on, the battery life shows the last percentage it was at before   it crashed (20-30%). This has happened to me more than once, so I know   it's not just some crazy fluke."      "I have a 3GS that is almost 2 years old now and had a hard life. It   has now developed a tendency to crash when the battery gets below 25%.   it will restart using the top button ok but as soon as you put any   strain on the battery it crashes when at this low level. When the   phone is charged it seems to work fine."      "I have a weird problem with my iPhone 5. My phone switches off when   the battery is low. I was at 23% charge and just browsing facebook   when my battery died. The other day I was at 13% charge and it   switched off. Last week 17%.. It refuses to switch back on until it   was plugged into the wall. I have tried restoring the phone and set up   as new but I still have the same problem. It just seems to switch off   when the battery is low at different percentages."         It seems to happen on various model iPhones and versions of the OS; it's currently happening to me on a heavily used two year old 4S running iOS 6.1.1.   that:     "The common element in these crashes is low battery life, usually under 20 percent, although one crash occurred at almost 30 percent. When I give the iPhone power, it restarts immediately and shows the expected amount of battery life remaining. So it’s not that the battery is actually running out; instead, [iOS's] power management code is freaking out once the battery level falls to around 20 percent. I do see a number of LowBatteryLog files in Settings > General > About > Diagnostics & Usage > Diagnostic & Usage Data, though their contents don’t reveal a smoking gun. Letting the battery run down completely and then recharging entirely to recalibrate it made no difference."   (NB. TidBITS writes about this as it pertains to iOS 7 only.)  So, my question:   Do we know, technically, what is causing these crashes beyond simply "the power management code is freaking out"? Are there any software hacks, fixes or usage habits (beyond usual battery saving/care techniques and "just get a new battery/don't let the battery get low!") that might help avoid these crashes?   (I'm interested in general answers, but in case it's of use  are the low battery logs from my two most recent crashes.)


Some program always asks for my login password. I do not know what causes this. How can I stop it?

Whenever Ubuntu boots up, a dialogue pops up asking me to unlock my default keyring. Is there some way this can unlock automatically through PAM or some other magical way?


We understand from the books that there are multiple parts of the Ministry of Magic and its counterparts devoted to deceiving Muggles, including concocting explanations for Muggle head of states in the event of magical catastrophes. We also know that Obliviators will wipe any Muggle's memory of such an accident.  But what happens when a Muggle takes a video or photo of a magical incident, which their phone then uploads to cloud storage? Even if you wiped the Muggle's memory and broke their phone, they'd still be able to access their cloud storage later, and upload the media to a sharing site.  Stopping a disaster like this has three parts:     Wizards have to know and understand how cloud storage works, including the idea of redundant backups among different servers. If the media is uploaded, they also have to understand how to find that media within every server that stores it. Wizards have to be able to interface with computers via magic to correct the problem. Wizards have to be able to find every Muggle that ever saw the media and obliviate them. If the media was uploaded to a sharing site, this could potentially be anything from a handful of people to hundreds of millions!    Alternately, wizards have to convince all Muggles that ever saw the media that it was fake. But if wizards can't solve parts 1-3, the problem will keep happening.  It seems to me there's no way wizards can avoid getting detected by Muggles once cloud storage becomes common, but am I missing something?

In the Harry Potter universe, wizards and witches have managed to keep Muggles unaware of their existence, across the planet and over many centuries. Up to the timeframe that the novels take place in (the 1990s), I can see how this can be achieved through a combination of discretion and magic, with discretion being the preferred method on occasion (e.g., you don't need magic to slip into Platform 9 3/4 unnoticed, you just need to check that nobody is looking).   Our current world of 2016, however, its a very different place. The UK is (in)famously heavily camera-monitored (). Even more poignantly, a very large (and growing) segment of the population carries an internet-enabled HD camera with them at all times and are willing to use it at a moment's notice (, but it is comedy in part because a more realistic version could happen). It looks like, the moment something magical happens in public, a video of it would be on Youtube/Facebook/Twitter and within minutes.   How does the Ministry of Magic deal with this development? Do they need to create a dedicated corps to monitor social media services and alter records as necessary?


Here is the current situation I face:  I am currently a postdoc but have begun to apply for jobs as a faculty member for the 2019 academic year. My issue is in securing letters of recommendation.   My PhD supervisor is currently going through chemotherapy and I do not want to worry them with a letter of recommendation on my account. My supervisor seems to be taking a small break from academia during treatment.   My question is, for search committees, if my letters of recommendation include my postdoctoral supervisor but not my phd supervisor, will that be considered a faux pas?

I did my PhD in Electrical Engineering with supervision from three people. Very hard times during PhD as there was not much supervision from the three. Presently, I am working in an industry doing R and D, but look forward to apply for post doctoral positions. One of my advisers have told me he won't recommend me for any university in the foreign country, the second one is not reachable and the third is very rude fellow. In short, I wont get recommendation from any. What are chances for a post-doctoral position in a reputed university.  I have 3 international journals (2 Elsevier and 1 IEEE) and 3 conferences from my PhD work. I also have a Best Paper Award from one of the main IEEE conferences (EMBC 2014). I can manage reference letters from my masters advisers. Will recommendation from my masters advisers sufficient for applying to post-doctoral studies? Chances of getting a recommendation from any faculty from the university where I did PhD is very low.


I have a few python scripts which contain no pause commands and no prompts for user input however I find that when I change my window focus to the Windows cmd window the output will freeze until I press 'Enter'.  Is there a know cause for this? Should I enable/disable a setting in the cmd options to avoid this?  A search of my case keeps bringing up cases of people wanting pauses in their code - which I do not.

Suppose I run cmd.exe and ping localhost. After that I ping localhost again but I click into the window and the ping stops until I press enter.  What happens exactly when I click into the window? Does it suspend the process or something else? I attached a screenshot to clarify this issue.  Note: I do not actually click but drag using the mouse which creates a white box in the window as you can see on the screenshot.  Edit: further clarification: What I really wish to know is whether dragging the window halts the cmd process or not?  Edit: even more clarification: I know that I'm using Quick Edit and pressing enter copies the contents I selected. What I do not know is what happens in the background.


for example 210 = 2*3*5*7,number of relative primes is 2*(4-1) =8,please help me derive this result.here's my try = 4C0+4C1+4C2+4C3+4C4=2*4 .Since nCr = nCn-r we decide this by two.4C0 couples with 4C4 ,4C1 couples with 4C3 but 4C2 is left.The idea I apply is that when we select r objects out of n,n-r are automatically selected.

Let N denote the number, and suppose $N=a^p \times b^q \times c^r \cdots$, where $a,b,c,\cdots$, are different prime numbers and $p,q,r,\cdots$ are positive integers.Then it is clear that each term of the product   $$(1+a+a^2+\cdots+a^p)(1+b+b^2+\cdots+b^q)(1+c+c^2+\cdots+c^r)\cdots$$  is a divisor of the given number,and that no other number is a divisor; then how could we use this to show/find that the number of ways in which this $N$ can be resolved into two factors which are prime to each other is $2^{n-1}$,where $n$ is the number of different prime factors in $N$?


I want to use the align environment inside a list but the equation shouldn't be centered with respect to the pagewidth but with respect to the intented block of the list.   A minimal example:  \documentclass[12pt,a4paper]{amsart} \usepackage[utf8]{inputenc} \begin{document} Some text.. \begin{itemize}     \item Very import point:     \begin{enumerate}         \item Yet another very important point substantiated by a long equation         \begin{align*}             x^2+y^2+5\int_{10003}^{10033455}\sin x\;dx+\tan^2(74638263x^2)=1.         \end{align*}      \end{enumerate} \end{itemize} \end{document}   I want to have the long equation centered under point (1).

I have equations inside an environment which has a larger left-margin than the main text (analogous to an enumerate/itemize environment, implemented with the changepage package's adjustwidth environment). Just as equations in enumerate/itemize behave, the equations are centered with respect to the entire text, rather than just the width of the container environment. I want the latter behavior.  I'm trying to accomplish this by wrapping all display-math in minipages. Namely, I'm modifying the mathdisplay environment in amsmath.sty as follows:  \makeatletter \let\oldmd\mathdisplay \def\mathdisplay#1{%   \newline   \begin{minipage}{\textwidth-\@totalleftmargin}%     \oldmd{#1}% } \let\oldendmd\endmathdisplay \def\endmathdisplay#1{%   \oldendmd{#1}%   \end{minipage} } \makeatother   This is almost working, but there are some issues with spacing which I don't understand how to fix. Here's how the the normal \[ ... \] and numbered \begin{equation} ... \end{equation} look with the above modification:      My main confusion is why the numbered version is behaving so differently from the unnumbered. But all in all I want to fix this so that the spacing above and below is even as it usually is. Any help is appreciated, thanks.  Edit: Here's a compilable example:  \documentclass{amsart}  \usepackage{lipsum} \usepackage{calc} \usepackage{changepage}  \makeatletter \let\oldmd\mathdisplay \def\mathdisplay#1{%   \newline   \begin{minipage}{\textwidth-\@totalleftmargin}%     \oldmd{#1}% } \let\oldendmd\endmathdisplay \def\endmathdisplay#1{%   \oldendmd{#1}%   \end{minipage} } \makeatother  \setlength{\parindent}{0pt}  \begin{document}  \lipsum[1]  \begin{adjustwidth}{20pt}{} \lipsum[2] \[ x \mapsto \hom(-,x) \]  \lipsum[3] \begin{equation}   y \mapsto \hom(y,-) \end{equation} \lipsum[4] \end{adjustwidth}  \lipsum[5]  \end{document}


I have 2 forms,form 2 has a DataGridView and a label.The datagridview loads data from My.Settings.Sourcename and the label shows My.Settings.Sourcename value.  Now form 1 has a button and openfiledialog. On OpenFileDialog.Dialogresult.OK,the file name gets added to My.Settings.Sourcename and then shows form 2. And what form 2 does is already mentioned above.  Now,i can do this :  My.Settings.sourcename = Path.GetFileName(OpenFileDialog1.FileName)   or  My.Settings.sourcename = OpenFileDialog1.SafeFileName   But if i do so, My.Settings.Sourcename value becomes only the file's name, not the destination. As a result my DataGridview on form 2 fails to load data from My.Settings.Sourcename. Now to fix this i can do this :  My.Settings.sourcename = OpenFileDialog1.FileName   But then the label(form2's)'s text shows the filename along with the filepath.. Is there any way to remove the file path from the label ?

I am using the following method to browse for a file:      OpenFileDialog.ShowDialog()     PictureNameTextEdit.Text = OpenFileDialog.FileName   Is there a way get ONLY the file name?  The FileName method returns the entire path and file name.  i.e. I want Foo.txt instead of C:\SomeDirectory\Foo.txt


Is there any way to rephrase "what number are you in the line"?

I want to make a question having an answer as follows:     5 is the third prime number.   The bold part is the answer. How to phrase the question?


I know the thread  which is a subset of this question.  I want to understand how you can improve battery lasting in Android, which is a much broader topic than the original. I am especially interested in Android versions later than 4.4 because of , a necessity of  applications, is developed for those versions but still in the experimental phase.   I see this after morning use in Samsung Galaxy 4 and Android 5.0.1:    which is too fast. I am using battery saving mode and disabled step-counter from my phone.  How can you use better battery in Android?

What can I do to get better battery life on my Droid? Battery life seems awful. Less than 15 hours or so on normal usage.


Can you cast an instant that gives creature(s) +X/+X until end of turn /after/ you've declared attackers /and/ your opponent has declared blockers? E.g. Tandem Tactics or Swell of Growth

My friend has a green  deck. When he declares a creature to attack and I allow it to go through unblocked, he suddenly plays all these Instants that 'pump' the creature up, and because of Infect, it's an instant loss most of the time. We solved that issue (without really understanding the full rules) that it wouldn't make sense to pump his creature up for an instant win without allowing me to block, although recently, my friend told me that 'Instants' can be played 'anytime' so once I allow a creature to deal me damage, technically, he's allowed to play all those Instants.  I'm really confused about it all, and would like to get an answer once and for all for this.   Also, once he has stacked all the pumps for his creature and attacks me (after I initially let it pass to hit my life because I did not expect the pumps) am I allowed to play ?


I'm worried about the intel hardware level meltdown hacking. Several days ago, I experienced my Ubuntu system malfunctioning from booting. It went to something like initramfs. I couldn't fix the issue so I changed the kernel to previous version, 4.10. (I'm using Ubuntu 16.04.) Then it succeeded to boot normally. However I'm now worried since I feel like I should use the newer version that had issue booting. What should I do? Where do I confirm which version kernel is safe?

Any questions relating to status updates, or asking if anything is going to be patched for these vulnerabilities should be closed as duplicates of this question.    are in the news right now and sound pretty severe. I don't see any security updates from Ubuntu that cover these vulnerabilities.  What is Ubuntu doing about these vulnerabilities, and what should Ubuntu users be doing?  These are CVE-2017-5753, CVE-2017-5715 and CVE-2017-5754.


I have set of many cases that I want to test on a single function. Let's say: @pytest.mark.unittest def test_simple_test_id_odd():     numbers = [1, 2, 3, 4, 5, 6, 7, 8]      for number in numbers:         assert number % 2 == 0  When I run this it stops on the first number with the error. I want the test to go all over the numbers and check each one of them. I don't want to write a test for each number, it does not make sense, it's too long. How can I test all the numbers and raise error for every one of them that failed?

I have some kind of test data and want to create a unit test for each item. My first idea was to do it like this: import unittest  l = [["foo", "a", "a",], ["bar", "a", "b"], ["lee", "b", "b"]]  class TestSequence(unittest.TestCase):     def testsample(self):         for name, a,b in l:             print "test", name             self.assertEqual(a,b)  if __name__ == '__main__':     unittest.main()  The downside of this is that it handles all data in one test. I would like to generate one test for each item on the fly. Any suggestions?


I've got two columns populated with names, and I want to see if the names in each row are similar (not the exact same, just similar) to each other. Is there any way to do this on Excel?

I am currently trying to reconcile “Name” fields from two separate data sources.  I have a number of names that are not an exact match but are close enough to be considered matched (examples below).   Do you have any ideas of how I can improve the number of automated matches?    I am already eliminating middle initials from the match criteria.    Current Match Formula:  =IFERROR(IF(LEFT(SYSTEM A,IF(ISERROR(SEARCH(" ",SYSTEM A)),LEN(SYSTEM A),SEARCH(" ",SYSTEM A)-1))=LEFT(SYSTEM B,IF(ISERROR(SEARCH(" ",SYSTEM B)),LEN(SYSTEM B),SEARCH(" ",SYSTEM B)-1)),"",IF(LEFT(SYSTEM A,FIND(",",SYSTEM A))=LEFT(SYSTEM B,FIND(",",SYSTEM B)),"Last Name Match","RESEARCH")),"RESEARCH")


i have the following button with id "openWindow"  <button id="openWindow">Open Window on Click</button>   and I have this jquery code, which send an alert "Open" and change the button id to "closeWindow"  $( "#openWindow" ).click(function() {    alert("Open");    $( "#openWindow" ).attr("id", "closeWindow"); })   $( "#closeWindow" ).click(function() {         alert("Close"); });   On first click:   Alert "open" appears and the id changed to "closeWindow"   On second click   the alert "Close" will not appear.   Can anybody tells me why?

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


I want to make a DIN-A0 poster using the documentclass a0poster. Why can't I draw diagrams in that documentclass? The MWE below crashes and I don't know how to fix that. :(  MWE:  \documentclass[a0,portrait]{a0poster}  \usepackage{amsfonts, amsmath, amscd, amssymb} \usepackage{graphicx} \usepackage{xy}  \begin{document}  \begin{align*} \xymatrix{A & B} \end{align*}  \end{document}

I am trying to use xy package to draw some diagrams. So I use the command \usepackage{xy} and I type a sample as follows:  \xymatrix{     A &*+[F]{\sum_{i=n}^m {i^2}} \\   & {\bullet} & D \ar[ul] }   But this fails with the error undefined control sequence \xymatrix  I don't understand why. Someone can help me?


I am using amazon 85 ec2 instances. Day before yesterday got emails from AMAZON for AMAZON EC2 abuse. it says about the DOS attacks on remote host.  Amazon mail content attached for your reference.  Denial of Service attacks against remote hosts on the Internet; check the information provided below by the abuse reporter.  Log Extract:  2012-02-23 00:31:38.218128 IP (tos 0x0, ttl 64, id 5911, offset 0, flags [DF], proto: UDP (17), length: 78) IP_addres.33840 > 89.36.27.40.0: UDP, length 50 2012-02-23 00:31:38.218146 IP (tos 0x0, ttl 64, id 5912, offset 0, flags [DF], proto: UDP (17), length: 78) IP_address.33840 > 89.36.27.40.0: UDP, length 50     my client informed me to block port 17 in iptables. we Blocked by using iptables command:-  sudo iptables -A OUTPUT -p udp --dport 17 -j DROP.   After the UDP port blocked in 17. still the DOS attacks continued.   finally we fetch the DOS attack log by command :  sudo tcpdump -nnvv -i any 'udp[tcp-syn]  & (tcp-syn)' != 0 and not port 22   I need to clarify whether from AMAZON log values "proto: UDP (17)" means UDP port 17. If yes means once we blocked the outbound port. How the attack continues?  Otherwise, We need to make additional measures or test.  Kindly anyone provide solution to stop this DOS attacks

This is a  about Server Security - Responding to Breach Events (Hacking)   See Also:                  Canonical Version I suspect that one or more of my servers is compromised by a hacker, virus, or other mechanism:   What are my first steps? When I arrive on site should I disconnect the server, preserve "evidence", are there other initial considerations? How do I go about getting services back online? How do I prevent the same thing from happening immediately again? Are there best practices or methodologies for learning from this incident? If I wanted to put a Incident Response Plan together, where would I start? Should this be part of my Disaster Recovery or Business Continuity Planning?   Original Version       2011.01.02 - I'm on my way into work at 9.30 p.m. on a Sunday because our server has been compromised somehow and was resulting in a    attack on our provider. The servers access to the Internet   has been shut down which means over 5-600 of our clients sites are now   down. Now this could be an FTP hack, or some weakness in code   somewhere. I'm not sure till I get there.      How can I track this down quickly? We're in for a whole lot of   litigation if I don't get the server back up ASAP. Any help is   appreciated. We are running Open SUSE 11.0.            2011.01.03 - Thanks to everyone for your help. Luckily I WASN'T the only person responsible for this server, just the nearest. We managed   to resolve this problem, although it may not apply to many others in a   different situation. I'll detail what we did.      We unplugged the server from the net. It was performing (attempting to   perform) a Denial Of Service attack on another server in Indonesia,   and the guilty party was also based there.      We firstly tried to identify where on the server this was coming from,   considering we have over 500 sites on the server, we expected to be   moonlighting for some time. However, with SSH access still, we ran a   command to find all files edited or created in the time the attacks   started. Luckily, the offending file was created over the winter   holidays which meant that not many other files were created on the   server at that time.      We were then able to identify the offending file which was inside the   uploaded images folder within a  website.      After a short cigarette break we concluded that, due to the files   location, it must have been uploaded via a file upload facility that   was inadequetly secured. After some googling, we found that there was   a security vulnerability that allowed files to be uploaded, within the   ZenCart admin panel, for a picture for a record company. (The section   that it never really even used), posting this form just uploaded any   file, it did not check the extension of the file, and didn't even   check to see if the user was logged in.      This meant that any files could be uploaded, including a PHP file for   the attack. We secured the vulnerability with ZenCart on the infected   site, and removed the offending files.      The job was done, and I was home for 2 a.m.            The Moral   - Always apply security patches for ZenCart, or any other CMS system for that matter. As when security updates are released, the whole   world is made aware of the vulnerability.   - Always do backups, and backup your backups.   - Employ or arrange for someone that will be there in times like these. To prevent anyone from relying on a panicy post on Server   Fault.


Suppose that: $$f'(z)=f(z) \text{ for all }z\in\mathbb C.$$ In other words, the complex function $f$ is equal to its own derivative.  Prove that there is a constant $c\in\mathbb C$ such that $f(z)=c e^z$; that is $f$ is the exponential function (up to a multiplicative constant).    So far, I've tried substituting $f'(z)=f(z)$ into the limit definition of $f'(z)$, to no avail. I'm trying to think of what other simple expressions I have relating $f$ and $f'$, but am not having much success.

I was wondering on the following and I probably know the answer already: NO. Is there another number with similar properties as $e$? So that the derivative of $\exp(x)$ is the same as the function itself. I can guess that it's probably not, because otherwise $e$ wouldn't be that special, but is there any proof of it?


I'm getting an error message when I start QGIS3. I've tried all sorts but don't know what else to do?   Couldn't load plugin 'processing'   ImportError: cannot import name 'ogr'  Traceback (most recent call last):   File "/Applications/QGIS3.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 312, in loadPlugin     __import__(packageName)   File "/Applications/QGIS3.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 674, in _import     mod = _builtin_import(name, globals, locals, fromlist, level)   File "/Applications/QGIS3.app/Contents/MacOS/../Resources/python/plugins/processing/__init__.py", line 28, in      from processing.tools.dataobjects import *          # NOQA   File "/Applications/QGIS3.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 674, in _import     mod = _builtin_import(name, globals, locals, fromlist, level)   File "/Applications/QGIS3.app/Contents/MacOS/../Resources/python/plugins/processing/tools/dataobjects.py", line 51, in      from processing.algs.gdal.GdalUtils import GdalUtils   File "/Applications/QGIS3.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 674, in _import     mod = _builtin_import(name, globals, locals, fromlist, level)   File "/Applications/QGIS3.app/Contents/MacOS/../Resources/python/plugins/processing/algs/gdal/GdalUtils.py", line 38, in      from osgeo import ogr ImportError: cannot import name 'ogr'   Python version: 3.6.5 (default, Apr 25 2018, 14:22:56) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]  QGIS version: 3.2.1-Bonn Bonn, exported   Python Path: /Applications/QGIS3.app/Contents/MacOS/../Resources/python /Users/Lauh/Library/Application Support/QGIS/QGIS3/profiles/default/python /Users/Lauh/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins /Applications/QGIS3.app/Contents/MacOS/../Resources/python/plugins /Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6 /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages /Users/Lauh/Library/Application Support/QGIS/QGIS3/profiles/default/python

I have installed QGIS3 from the AUR package, as well as all optional dependencies:   However, when launching, I receive the following error:  Couldn't load plugin 'processing'   ModuleNotFoundError: No module named 'osgeo'  Traceback (most recent call last):   File "/usr/share/qgis/python/qgis/utils.py", line 311, in loadPlugin     __import__(packageName)   File "/usr/share/qgis/python/qgis/utils.py", line 664, in _import     mod = _builtin_import(name, globals, locals, fromlist, level)   File "/usr/share/qgis/python/plugins/processing/__init__.py", line 28, in      from processing.tools.dataobjects import *          # NOQA   File "/usr/share/qgis/python/qgis/utils.py", line 664, in _import     mod = _builtin_import(name, globals, locals, fromlist, level)   File "/usr/share/qgis/python/plugins/processing/tools/dataobjects.py", line 51, in      from processing.algs.gdal.GdalUtils import GdalUtils   File "/usr/share/qgis/python/qgis/utils.py", line 664, in _import     mod = _builtin_import(name, globals, locals, fromlist, level)   File "/usr/share/qgis/python/plugins/processing/algs/gdal/GdalUtils.py", line 35, in      from osgeo import gdal   File "/usr/share/qgis/python/qgis/utils.py", line 664, in _import     mod = _builtin_import(name, globals, locals, fromlist, level) ModuleNotFoundError: No module named 'osgeo'   Python version: 3.6.4 (default, Jan  5 2018, 02:35:40) [GCC 7.2.1 20171224]  QGIS version: 3.0.0-Girona Girona, exported   Python Path: /usr/share/qgis/python /home/thiago/.local/share/QGIS/QGIS3/profiles/default/python /home/thiago/.local/share/QGIS/QGIS3/profiles/default/python/plugins /usr/share/qgis/python/plugins /usr/lib/python36.zip /usr/lib/python3.6 /usr/lib/python3.6/lib-dynload /usr/lib/python3.6/site-packages /home/thiago/.local/share/QGIS/QGIS3/profiles/default/python   It seems to be a path issue, but I am not sure how to solve it. Pacman shows gdal and python-gdal both as installed.


I have one application with is server over a number of domains (each customizes the appearance of the application.  In addition, there is a common domain which has multiple subdomains to display the same data as above.  So - www.apples.com appears the same as apples.efruit.co.uk  and - www.bananas.co.uk appears the same as bananas.efruit.co.uk  etc  Now, I have a wildcard ssl for the efruit.co.uk domain so I want to use the htaccess file to force all efruit.co.uk requests to use https (if not already doing so).  All other domains will not have an ssl so they will need to use http to avoid browser warnings - again from the htaccess file.  I would also like to use the htaccess file so that if someone types www.apples.efruit.co.uk it rewrites as apples.efruit.co.uk (over https as above). However, www. is fine if it's not an efruit.co.uk domain.  Finally, I then have the standard and well documented rewrite rule for codeigniter to make the url prettier.  Here's what I have so far.  Options +FollowSymlinks RewriteEngine On  RewriteCond %{REQUEST_URI} !(health_check\.php)$ RewriteCond %{HTTP_HOST} ^(.*)\.efruit\.co\.uk RewriteCond %{HTTP:X-Forwarded-Proto} =http RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]  RewriteCond %{HTTP_HOST} !^(.*)\.efruit\.co\.uk RewriteCond %{HTTP:X-Forwarded-Proto} =https RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R,L]  RewriteCond %{HTTP_HOST} ^www\.([^\.]*)\.efruit\.co\.uk$ RewriteRule (.*) https://%1.efruit.co.uk$1 [R,L]  # block hidden directories RewriteRule "(^|/)\." - [F]  RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]   The only bit that seems to work though is forcing efruit.co.uk domains to be served over https.

This is a  about Apache's mod_rewrite.   Changing a request URL or redirecting users to a different URL than the one they originally requested is done using mod_rewrite. This includes such things as:   Changing HTTP to HTTPS (or the other way around) Changing a request to a page which no longer exist to a new replacement. Modifying a URL format (such as ?id=3433 to /id/3433 ) Presenting a different page based on the browser, based on the referrer, based on anything possible under the moon and sun. Anything you want to mess around with URL   Everything You Ever Wanted to Know about Mod_Rewrite Rules but Were Afraid to Ask!  How can I become an expert at writing mod_rewrite rules?   What is the fundamental format and structure of mod_rewrite rules? What form/flavor of regular expressions do I need to have a solid grasp of? What are the most common mistakes/pitfalls when writing rewrite rules? What is a good method for testing and verifying mod_rewrite rules? Are there SEO or performance implications of mod_rewrite rules I should be aware of? Are there common situations where mod_rewrite might seem like the right tool for the job but isn't? What are some common examples?   A place to test your rules  The  web site is a great place to play around with your rules and test them. It even shows the debug output so you can see what matched and what did not.


For the past months, I've been trying to add thou, thee, thy, thine, and other archaic words in my everyday vocabulary; I just love archaic English words — and the Early Modern English grammar for a bit, but I don't use that grammar. But as I use "thou" and "thee" in some of my school activities in English, I get confuse between the twain. Because after I use the two in one sentence — without adding any commas or periods — I'm not sure if I should use "thou" or "thee" again.  Say I typed: "Do you know what you're doing you stunted son of a scoundrel?!"  Now when I translate it with some archaic pronouns in it:  "Do thou know what thee are doing -(thou or thee?)- stunted son of a scoundrel?!"  ————  Another scenario:  "We will believe You as the awesome God You are."   "We will believe Thee as the awesome God -(Thou or Thee?)- are."  I've been looking around the internet for some answers to my question, but, alas, I wasn't able to find my answer. I don't even have any works of Shakespeare with me. (Because it's not taught in the Philippine Curriculum!) I do have the King James Version of the Bible, but, alas, I couldn't understand it that well — albeit I do understand some words in it.   So, once I've finished using thou and thee, should I use thou or thee again — before I end the sentence above with a comma or a period? Is there a pattern whenever these are used — or nay?

What is the difference between thee and thou and how are they used?


Sometimes I have several questions simultaneously (for example, I'm reading a paragraph and I don't understand two parts of it) and I want to ask them in this site.  However, Stack Exchange just allows you to ask questions every 40 minutes. My question is, does it have a stack of questions which are going to be asked in the future?  At a moment I have several questions and I want to write them all at once in some Stack Exchange format, and then the site asks them one by one every 40 minutes. I want to write them somewhere because I forget them and I want to write them in some Stack Exchange format to post them in the future easily without wasting any extra time.

The draft feature was discussed a lot  and in other posts, but I didn't see much talk about the OP's mention of being able to have multiple.     Optionally, allow multiple draft questions and a page to edit/delete them.    I think the draft feature where it autosaves and stores it server-side is great, but in most things where they have a draft feature (like email clients), they allow you to have multiple drafts (also stored server-side).  The expiration can even work the same as it does for the single draft system right now.  You wouldn't even need full page to store them, I think the user profile page could have a tab for it like it currently has for answers, questions, and everything else.    It could look very similar to how questions look, with it's title and tags listed there.


I was just buying some halogen replacement bulbs for my kitchen recessed lighting  when the salesperson talked me into buying recessed LEDs instead. The sales pitch was great about how long they last and energy efficiency. They look super cool too.....until you turn them on.  Then they have a really harsh, blue light as opposed to the beautiful warm glow of my halogens. I've read that you can use photo gels somehow, but I just need to know more details about how to actually install them.  Do you just sort of "fit" them into the opening?  Will they get too hot?  What color should I get?  Anybody have any ideas?

I recently bought  white LED reading lamp. I like it a lot, but the "white" light produced is significantly blue; I'll guess its  is about 5000K.  I've noticed that, when this is the only source of light, printed text appears slightly fuzzy, and is more difficult to read than with a standard incandescent reading lamp. My guess is that this is  causing color fringing in my eyes, making it harder to read with this new lamp.  Is there a way to make this lamp less blue using some sort of transparent/translucent filter over the lens? This could filter out some of the blue end of the spectrum, or include a  to convert some of the blue to yellow (as  do). The fluorescence idea would be better, as there'd be less light lost. I don't want to go too far, though; a strongly yellow lamp might be worse for reading than this currently blueish lamp.


I'm working on adding geofences to a mobile application. I know the proper way of calculating distance between two points on a sphere is using the  or  formula. I don't know if using those formulas are needed for relatively small scale applications. This leads to my question. At what point does the distance given by a great-circle calculation diverge significantly from a planar calculation?   For the purposes of this discussion assume greater than 5% error is significant.  The geofence is simply a center point and a radius. If the point is within the radius, by distance, it is considered within the boundaries of the fence.  I am not sure if it matters, but I'm just worried about circular geofences at this time with a user defined radius between 50 and 200 meters.

Many people when first trying to calculate distances between two longitude / latitude pairs  ask if Pythagorean theorem works as an appropriate distance function.  Most often people answer "no, the Pythagorean theorem only works on a 2D Euclidean plane." Rarely, however, do people mention the effect of scale and location on the sphere on how inaccurate the Pythagorean theorem is.  The basic idea being at very small scales, the surface of a sphere looks very much like a plane. At very large scales, it distances along the surface are more curved and therefore the difference between the incorrect Pythagorean Theorem and the correct Haversine Formula is greater.  Does anyone know a formula or rule of thumb that tells you the difference between the two distance measures based on the scale of the distance you are trying to measure?   I think having this explicitly would help in:   explaining why the Pythagorean Theorem isn't perfect; and in letting people who are looking for more "rough" distances know when Pythagoras actually will serve their purposes.


I just got a call from someone claiming to be the IRS who threatened the police. The number they used was 434-200-8555

We got a recorded call with a message claiming to be from the IRS.  It said they were giving final notice and preparing to file a lawsuit against us.  In our case, the message went to voicemail so the end was cut off, but it seemed like a scam all the way. (We don't have any pending problems with the IRS as far as we know.)  The question was whether this is a known scam?


I want to change this decimal value within a function. As you can see, it changes within the function but doesn't impact the input argument outside the function when I want it to change. eg. aud = Decimal('500'). aud = Decimal('1000') def changecash(cash):     cash -= Decimal('500')     print(cash)      changecash(aud) print(aud)  The output is:  500 1000

What exactly are the Python scoping rules?  If I have some code:  code1 class Foo:    code2    def spam.....       code3       for code4..:        code5        x()   Where is x found?  Some possible choices include the list below:   In the enclosing source file In the class namespace In the function definition In the for loop index variable Inside the for loop   Also there is the context during execution, when the function spam is passed somewhere else. And maybe  pass a bit differently?  There must be a simple reference or algorithm somewhere.  It's a confusing world for intermediate Python programmers.


Problem If $a$, $b$, $q=\left(\dfrac{a^2+b^2}{1+ab}\right)$ are natural numbers, then $q$ is a perfect square. Are there infinitely many $\left(a,b,q\right)$ triplets?  I have tried to prove the problem assuming that $q$ is not a perfect square and hoped to get some contradiction but unfortunately I can't seem to get it. Regarding the second part of the problem, I think that probably it is not true. In case it is true I add the following problem to the original statement.  Can there be found expressions for $a$, $b$ and $q$ such that it generates an infinitely many (but not necessarily all) such triplets?  Any help will be appreciated.

Let $a,b$ be positive integers.  When $$k = \frac{a^2 + b^2}{ab+1}$$ is an integer, it is a square.    Proof 1: (Ngô Bảo Châu): Rearrange to get $a^2-akb+b^2-k=0$, as a quadratic in $a$ this has two values: $a$ and $kb - a = (b^2-k)/a$. (The second root is determined in two different ways from the expansion $(x-r_1)(x-r_2) = x^2 - (r_1 + r_2)x + r_1 r_2$.)  Now suppose we have $a,b$ such that $k$ is an integer but not a square, by the investigation about roots we have that the second root is a nonzero integer since $k,b,a$ are integers and $k \not = b^2$, futhermore it is positive which is easily seen from its defining equation.  WLOG assume $a \ge b$ so that the second root is strictly smaller than $a$. This leads to a decent, replacing $a$ with the second root.    Proof 2 (Don Zagier): Apply reduction theory (specifically, Sätze 1 and 2 of Section 13 of my book on quadratic fields) to the quadratic form $x^2 + kxy + y^2$, which is the unique reduced quadratic form in its equivalence class.    Note that Proof 2 is pretty much the same as Proof 1 when written out in explicit detail, but I could not read Zagier's book because I cannot read German.  I would like to know more approaches to this and other alternative proofs of this result if possible! Thanks in advance.  I would also be interested in related problems (especially easier ones of a similar nature) and texts which cover the reduction theory in English.


I have a python dictionary, its keys are datetime.datetime objects, such as:  a = {datetime(2018,1,1):1, datetime(2018,1,2):2, datetime(2018,1,3):3, ...}   I would like to get the key (date) with max value in a portion of this dictionary, such as between dates 2018-03-27 and 2018-04-17.  What is the mosy pythonic way of achieving this?

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


2 days ago I have received a very frustrating email from Google Cloud Platform Compliance team and after some investigations I was recommended to post my question to the community and ask for their opinion and help!  So here is the first email I received!     Action required: Critical problem with your Google Cloud Platform / API project.           Dear Developer,                 We have  recently detected that your Google Cloud Project XXXXXXX (id: cuZZZZZZZZZ-XXX-12345) has been performing intrusion attempts against a third-party and appears to be violating our Terms of Service. You can fix the problem by  ensuring that  your project traffic directed at third-parties is expected, and that your project has not been compromised.              We will suspend your project in 3 days unless you correct the problem and respond to this email by submitting an appeal.              I checked with my team for any kind of strange behavior on our server and after digging deeper into our server we were not able to find anything wrong, so I hit the button in the email to "Request and appeal".  In the form I described that there is nothing that we found to be Violating Google guidelines!    After some time I received the second email with a little info about what had happened on our server. The Google team member claimed the following:          Based on our records, we detected SSH brute forcing attacks originating from IP 10x.1xx.xx.xx (our server IP) targeting more than 942 IP addresses on December 26, 2016.       As the project owner, you are responsible for securing the software installed on your machine. Please provide us with more information regarding the behavior of your project and specifically how it could relate to what we have detected.    So this means that on Dec 26, our server has made 942 different SSH requests to different IP addresses, which is impossible! We don't have such a script running on our end that is constantly establishing connections with port 22 to 942 different IP addresses... If there has been such a strange behavior on our server it would mean that our server was hacked and someone is running this strange script! But this is not the case as well, as we have checked the latest added and modified files one by one: all of them are added by us - through Git...   So I contacted back to the Google Cloud Console team asking them for some more info, but they got back to me that they can't give more info and that they recommend me to connect with the community and ask them for help!  Posting the latest email I received from them:          Dear Developer,          Thank you for your response. Unfortunately, we do not have visibility into your instance or how it can be fixed. However, you can reach out to the Google Cloud Platform community support at  for recommendations. Also, you can look at some of the recommendations in the original external escalation as a starting point.          We strongly recommend adopting additional security measures and then completely re-installing your project.        We don't really want to reinstall out project as it is a huge environment with 15k users....   Anybody can help me with any idea or suggestion about how can I track this strange behavior or what would be the best way to with this.  Please note that they initially told that they are going to suspend the instance if the behavior is not fixed and appealed.  Dear community members, I am looking forward to hearing your thoughts! This is very important for our startup!

This is a  about Server Security - Responding to Breach Events (Hacking)   See Also:                  Canonical Version I suspect that one or more of my servers is compromised by a hacker, virus, or other mechanism:   What are my first steps? When I arrive on site should I disconnect the server, preserve "evidence", are there other initial considerations? How do I go about getting services back online? How do I prevent the same thing from happening immediately again? Are there best practices or methodologies for learning from this incident? If I wanted to put a Incident Response Plan together, where would I start? Should this be part of my Disaster Recovery or Business Continuity Planning?   Original Version       2011.01.02 - I'm on my way into work at 9.30 p.m. on a Sunday because our server has been compromised somehow and was resulting in a    attack on our provider. The servers access to the Internet   has been shut down which means over 5-600 of our clients sites are now   down. Now this could be an FTP hack, or some weakness in code   somewhere. I'm not sure till I get there.      How can I track this down quickly? We're in for a whole lot of   litigation if I don't get the server back up ASAP. Any help is   appreciated. We are running Open SUSE 11.0.            2011.01.03 - Thanks to everyone for your help. Luckily I WASN'T the only person responsible for this server, just the nearest. We managed   to resolve this problem, although it may not apply to many others in a   different situation. I'll detail what we did.      We unplugged the server from the net. It was performing (attempting to   perform) a Denial Of Service attack on another server in Indonesia,   and the guilty party was also based there.      We firstly tried to identify where on the server this was coming from,   considering we have over 500 sites on the server, we expected to be   moonlighting for some time. However, with SSH access still, we ran a   command to find all files edited or created in the time the attacks   started. Luckily, the offending file was created over the winter   holidays which meant that not many other files were created on the   server at that time.      We were then able to identify the offending file which was inside the   uploaded images folder within a  website.      After a short cigarette break we concluded that, due to the files   location, it must have been uploaded via a file upload facility that   was inadequetly secured. After some googling, we found that there was   a security vulnerability that allowed files to be uploaded, within the   ZenCart admin panel, for a picture for a record company. (The section   that it never really even used), posting this form just uploaded any   file, it did not check the extension of the file, and didn't even   check to see if the user was logged in.      This meant that any files could be uploaded, including a PHP file for   the attack. We secured the vulnerability with ZenCart on the infected   site, and removed the offending files.      The job was done, and I was home for 2 a.m.            The Moral   - Always apply security patches for ZenCart, or any other CMS system for that matter. As when security updates are released, the whole   world is made aware of the vulnerability.   - Always do backups, and backup your backups.   - Employ or arrange for someone that will be there in times like these. To prevent anyone from relying on a panicy post on Server   Fault.


Hovering over the favourite button on a question gives you a tooltip with the text:     This is a favorite question (click again to undo)   Even if you haven't favourited the question.  Shouldn't it be something like Click to favorite this question?

When viewing a question, when I hover over the star icon (under the voting module) the tooltip says I've made it a favorite when I haven't yet.


Which of the following three is correct?         When parents relate to a child, they do a lot of the work, figuring out what the child needs and then accommodating those needs.   This is not, however, the case when two children are interacting.   [...] This is, however, not the case when two children are interacting.   [...] However, this is not the case when two children are interacting.

Basically, what's the difference between this:     However, it didn't mean that I didn't have the potential to become a   rock star.   and this?     It didn't mean, however, that I didn't have the potential to become a   rock star.   Or does it mean exactly the same thing?


I haven't upgraded Ubuntu in a while and am stuck with Ubuntu 10.10. When I click on upgrade all it says..your version is no longer supported. How do I upgrade then?

What are the different ways I can use to upgrade Ubuntu from one release to another?


From the moderator dashboard, using the “mod → purge all comments” tool refreshes the page. When there are many flagged posts and I'm processing a flag from the middle of the list, this makes it hard to locate the flag I was currently handling.  Please change the UI so that the “purge all comments” tool doesn't refresh the page, or otherwise arranges for the post I was looking at to be at the same scrolling position and still expanded.

Ever since mods gained the ability to undelete comments, deleting them has become easier as the confirmation dialog was removed.  However, this is not the case in the mod queue — I still get a confirmation dialog for each comment I want to delete in the queue under a custom-flagged post (single-comment flags can be deleted just fine). And since this is the place from where I delete comments the most, it can be annoying.  In addition, the "purge comments" button, when invoked from the queue, refreshes it, so I have to scroll back down, remember which post I just purged, and mark the flag as helpful. Usually not a big issue but if there are multiple "obsolete comments" flags, then it can get confusing.  Could the workflow for comment thread moderation from within the queue be improved? Ideally, make comment deletion work like everywhere else on the site, and make the purge button AJAX-based like the comment deletes.