From a exercise list:  Let $f:[a,+\infty)\rightarrow \mathbb{R}$ with continuous second derivative and such that $\lim\limits_{x\rightarrow\infty}f(x)=0$ and $\lim\limits_{x\rightarrow\infty}f''(x)=0$. Prove that $\lim\limits_{x\rightarrow\infty}f'(x)=0$.  Does anybody has a hint or a solution? I believe that, by the limit of $f$, $f'$ is either $0$ or unlimited, than the limit of $f''$ proves that the first option is the right one. But I don't know how to do it.

Let $f\colon\mathbb R\to\mathbb R$ be twice differentiable with $f(x)\to 0$ as $x\to\infty$ and $f''$ bounded. Show that $f'(x)\to0$ as $x\to\infty$. (This is inspired by  to a different question)


Would the total angular momentum of a planet orbiting a star while rotating on it's axis be the sum of the orbital rotational momentum and the rotational momentum about it's axis?

I have problem understanding total angular momentum of earth about center of sun. Consider that earth has an orbital angular velocity of $\omega_0 \hat z$ and a spin angular velocity of $\omega_s \hat s$, distance between the centers of sun and earth as $R$ and radius of earth as $r$ and that earth has mass $m$. My understanding is that total angular momentum of center of mass of earth + angular momentum about CM of earth is $$L = m R^2 \omega_0 \hat z  + \frac{2}{5} m r^2 \omega_s \hat s $$ however a it's given in my text book as  $$L = m R^2 \omega_0 \hat z  + \frac{2}{5} m r^2(\omega_s \hat s + \omega_0 \hat z) $$  Why does the the $\omega_0$ appear when calculating angular momentum about CM of earth?


To review "suggested edits" a reputation of 2k or more is necessary. I never reached 2k but it still looks like I was able to review a couple of suggested edits.    Is this a bug?

When clicking "edit" I see:  Your edit will be placed in a queue until it is peer reviewed. We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.  Like:     Likewise, when I am not logged in, clicking "improve this question" or "improve this answer" shows:  You are not . Your edit will be placed in a queue until it is .  And when I click 'Save', I get:  Thanks for submitting an edit. It is only visible to you until it's been approved by trusted community members  Like:     Who can suggest an edit? Where do suggested edits go? Who can vote on a suggested edit? How do suggested edits get reviewed? Can I earn reputation? What about abuse or bad edits? Sometimes the Community user approves or rejects my edit. Why is that? When can I not suggest an edit? Is there a minimum change requirement for a suggested edit? How do I check my suggested edit history? I disagree with the reasons why my suggested edit was rejected. What can I do? How do I know whether there are edits waiting for review? Someone suggested an edit to my own post, and the reviewers took the wrong action. What can I do? Are tag wikis included in this scheme? What do the "Improve Edit" and "Reject and Edit" buttons do? Why are apparently valid links to rejected edits resulting in 404 errors?   For more information about editing, see "" in the .


I have a script which I want to go over 4 sets of files PURO*.xml, PURR*.xml, SALO*.xml and SALR*.xml.  for j in PUR SAL do         mask=("${j}O*.xml" "${j}R*.xml")         for k in 0 1         do                 for file in `find ${CDIR} -maxdepth 1 -daystart -mtime ${MTIME} -and -name ${mask[$k]} | xargs`   The script works, however, when it is executed, if the working directory has files that match one of the mask, that mask gets expanded.  Question is, what would be the correct way to write the above piece of script so that mask is passed correctly to find command? I want "${j}" expanded at the point where I create mask, but not the "*".  Also, is backticked find OK or should I perhaps rewrite that part differently as well?

Or, an introductory guide to robust filename handling and other string passing in shell scripts.  I wrote a shell script which works well most of the time. But it chokes on some inputs (e.g. on some file names).  I encountered a problem such as the following:   I have a file name containing a space hello world, and it was treated as two separate files hello and world. I have an input line with two consecutive spaces and they shrank to one in the input. Leading and trailing whitespace disappears from input lines. Sometimes, when the input contains one of the characters \[*?, they are replaced by some text which is is actually the name of files. There is an apostrophe ' (or a double quote ") in the input and things got weird after that point. There is a backslash in the input (or: I am using Cygwin and some of my file names have Windows-style \ separators).   What is going on and how do I fix it?


I have a method from a Provider that looks similar to this:  updateUser(user: User): Promise<User> {     return this.http.put<any>('url',JSON.stringify(user))         .toPromise()         .then((result) => {             this.eventsService.broadcast('userEdit:success', user)             return Promise.resolve(true);         })         .catch((err) => {             let errorData = {                 error: err,                 data: user             };             this.eventsService.broadcast('userEdit:failed', errorData)             return Promise.reject(errorData);         }); }   This does work and I do get the value of user. But I believe that user's value is expected to be gone which would cause an error? How does the variable user retain it's value after the function updateUser?   I wanted to have the user's value back especially on the error catching so that I can notify and take the value to repopulate the form if I navigate back to it with the notification.  The current code works but I believe there is a better/correct way to do this to achieve the same objective. Please let me know how you would rather do it yourself.

How would you explain JavaScript closures to someone with a knowledge of the concepts they consist of (for example functions, variables and the like), but does not understand closures themselves?  I have seen  given on Wikipedia, but unfortunately it did not help.


I'm an Indian citizen, and I need to attend a business meeting from 13th of July in the US sponsored by my company. Hence I will require a B-1 visa for 10 days in mid July.   However, soon after the meeting, I'll be moving for studies and hence will need an F-1 visa from 10th of August for staying at an institute in the US for the next few years. The college will be sending me the I-20 this week.  How should I proceed to book slots with the consulate? Will there be any effect on either of the visas? I cannot seem to find information on such a case. Any help would be greatly appreciated.

I got admitted into a university in USA and received my I-20 for the same. I am yet to apply for my F-1 visa. The program start date is 8th August, 2016.  Meanwhile, I also got selected for a Youth Cultural program by an organization in USA, which requires me to travel to USA from 18th June to 10th July on Visitors visa (B1/B2). I am yet to apply for that, too. I am planning to return to my home (India) on 10th July and then go back to USA in August to start my studies.  Now, 3 timelines would be possible for me:    I apply for F-1 visa first, and then for B1/B2. Thus, obtain both the visa before 18th June.  I apply for B1/B2 visa first, and then for F-1, and obtain both the visa before 18th June.  I apply for B1/B2 before 18th June, and apply for F-1 after coming back, i.e. after 10th July.   Can you please suggest me the best option out of these three considering following points :    Getting a F-1 visa is more important for me than the B1/B2, as a very good study program in good university is at stake. I don't want the B1/B2 visa approval/rejection to affect my chances of getting F-1 visa successfully.  Is it possible to have two valid visas stamped (B1 and F1) at the same time? Would there be a problem at entry port on 18th June if my passport has two valid visas stamped (both B1 and F-1) ? I can produce enough documents stating my purpose of visit (cultural program for the first visit).  If in case my B1 visa is rejected, will that decision affect my chances of getting F-1?


I've read quite a few online explanations of how curved spacetime is the reason objects are drawn to each other, and that gravity is an illusion. Most of them follow the same path:   explain what geodesic is, and how it can actually be a straight line. explain how matter warps spacetime. make a conclusion that an object is not pulled by gravity, but instead it tries to follow the straight line which is actually a geodesic.   What i don't understand is the following theoretical situation. Lets suppose we have Earth that doesn't spin, doesn't move around the Sun, or in the Galaxy, or Universe, Earth is absolutely stationary. And there is a person on its surface holding a stone. The stone is then released. If there are no forces that are attached to it, why would it start moving along any geodesic at all? At this point it doesn't even matter how warped the geodesic is if there is nothing to push it along the way in the first place.

They say that gravity is technically not a real force and that it's caused by objects traveling a straight path through curved space, and that space becomes curved by mass, giving the illusion of a force of gravity.  That makes perfect sense for planetary orbits, but a lot less sense for the expression of gravity that we are the most familiar with in our day-to-day lives: "what goes up must come down."  Imagine that I hold a ball in my hand, several feet off the ground, with my fingers curled around it, and my hand is above the ball.  Then I open my fingers, releasing my grip on it, being very careful to not impart any momentum to the ball from my hand as I do so.  An object at rest remains at rest unless acted upon by an outside force.  If the ball is not moving (relative to my inertial reference frame), it has no path to travel that's any different from the Earth's path through space.  It should remain at rest, hanging there in the air.  And yet it falls, demonstrating that an outside force (gravity) did indeed act upon it.  How does curved space explain this?


There is a pair $(2, 4)$ for which $2 ^ 4 = 4 ^ 2$. I wonder if there is another such pair $$(n, m): n ^ m = m ^ n$$ It almost obvious that is not. But I failed to prove it.  The question is: does one studied a commutator and associator of ^ operation? Where can I read about it? Is there another such pair? pairs?

We know that $2^4 = 4^2$ and $(-2)^{-4} = (-4)^{-2}$. Is there another pair of integers $x, y$ ($x\neq y$) which satisfies the equality $x^y = y^x$?


I have a list containing 100 items. How do I convert it to a 20*5 two-dimensional list? My code:  l = [2,3,1,...,77] m = 20 n = 5

I have a list of arbitrary length, and I need to split it up into equal size chunks and operate on it. There are some obvious ways to do this, like keeping a counter and two lists, and when the second list fills up, add it to the first list and empty the second list for the next round of data, but this is potentially extremely expensive.  I was wondering if anyone had a good solution to this for lists of any length, e.g. using generators.  I was looking for something useful in itertools but I couldn't find anything obviously useful. Might've missed it, though.  Related question:


I will start my PhD in the field of Biomedical Computer Vision soon at one of the top 10 universities at UK. I am an international student from Asia.  But unfortunately I haven't received any source of funding yet (no university scholarship, no supervisor grant) to cover my PhD. The tuition fees alone per year is only slightly less than 20,000 British Pounds, which is something I cannot afford on my own for all my years of PhD.   I am thinking of going there initially for one year with self-funding, by taking money from my savings and some from my parents, and will risk it initially and try to secure a source of funding there after starting my PhD, and if everything goes well will have figured a way to fund myself from some grant or scholarship.   I have been thinking about this since many many days now and am not able to make a decision about whether I should go there or not. And if things go really bad financially, what would be ways out ?  Any comments or help is much needed and highly appreciated.

What should I opt for?   Option A) very well paid PhD, around €3000 per month at a respectable university or;  Option B) a non-paid PhD, where I have to pay €2000 per year at one of the top 10 universities of the world?  EDIT: Actually they are both UK universities, Option B  is ranked between the top 10 in the world in engineering and tech, and I do get a scholarship that pays 18000 pounds which covers the difference between international student tuition and EU tuition. In Option A, I will be doing research in a good university and will be working alongside giants in the industry.


These two questions are from a mobile app:        I didn't pass my driving test.   correct answer: "Nor did I."     He didn't pass his driving test.   correct answer: "Neither did I."      Why do we use nor in the first sentence and neither in the second? Is there any exact rule to follow?

In this circumstance, which would be the most correct / natural answer?     Person 1: I don't eat meat   Person 2: Neither do I / Nor do I / Me neither / Me either    says both "neither do I" and "Me neither" are often used. But I have also heard / read "me either" and "nor do I" in multiple scenarios. Which then is the correct way of saying it? Are the others wrong or just not used?


$ xelatex  Command 'xelatex' not found, but can be installed with:  sudo apt install texlive-xetex  If a binary not found but apt knows the package associated with, it would recommend the installation command. When the recommend prompts, is there an easy shortcut or command like maybe instllaptrecommend so that I can skip copy/paste to directly execute the installation command?

I am thinking of the use case of this output:  The program 'tiger' is currently not installed. You can install it by typing: sudo apt-get install tiger   How can I get it to prompt me to install that package? For example it would output this:  The program 'tiger' is currently not installed. You can install it by typing: sudo apt-get install tiger # Confirmation can go here [sudo] password for tim: The following NEW packages will be installed   tiger tripwire 0 to upgrade, 11 to newly install, 0 to remove and 0 not to upgrade. Need to get 8,416 kB of archives. After this operation, 26.5 MB of additional disk space will be used. Do you want to continue? [Y/n]  # and/or confirmation can go here   I don't want to have to run it myself. How can I get it to do it automatically, and give me the option to not install?


I am a Doctor from Bangladesh. I have passed PLAB 1 and going to apply for PLAB 2 visa which falls under the category of Standard Visitor visa. I am really worried because, as currently I am unemployed and working as a trainee Doctor in a hospital, my father is sponsoring me for my upcoming trip. He is a Government employee. His monthly salary is about £500. The problem is the bank statement he is going to show received a recent deposit of about £6,000.  Part of it (around £2,000) was transferred from my mother's savings account to his account and the rest of the money came from a car sale. I am going to show the documents for the car sale during the application.  But the problem is, how can I show that £2,000 which was transferred from another account?

I have applied recently for a general visitor visa to the UK to spend 10 days during Christmas with my British unmarried partner and it has been turned down.   The Entry Clearance Officer stated on his refusal notice the following:     I note that you have never previously travelled to the UK or any country with similar immigration requirements and you therefore do not have a history of travel and compliance to consider.      You have submitted an employment letter to confirm your occupation in KSA but I am required to also assess your personal, domestic and economic circumstances in determining whether you are genuine visitor travelling to the UK for the period and purpose you state.      You claim an income of SAR ........ per month which equal ........ GBP and from the evidence submitted this appears to be your sole source of income.   I note that this monthly income is reflected on your bank statements. However, the bank statement you have presented show a recent large deposit that are in excess of your stated income and inconsistent with the account history. You haven't provided evidence toward the origin of this recent deposit and in the absence of reasonable evidence I am not satisfied that these bank statements accurately reflect your personal circumstances.      In view of the above, I am not satisfied you have demonstrated that your circumstances are as you claim and therefore I am not satisfied that you're travelling to the UK for the period and purpose you stated. 41(i)and(ii).   Its true that I have deposited that sum of money right before I apply and it was a commission I received from work earlier this month.   So, could you please give me your advice on the above as I am planning to apply again soon. and how to avoid my application being refused again?


I want to send a newsletter using MailChimp to everyone I've had an email conversation with over the past year.  What is the best way to export their email addresses?  I only want people I've gone back and forth with (I've sent them at least one email and they've sent me at least one email).  I'm on a Mac and can use Apple Mail if that helps.

How can I export a list containing e-mail addresses for everyone that has sent me an e-mail?  I have all of the messages archived.


Have created one folder say 'cat' in bundle which contains images. Now I need to load all that images in an array. how to do that programmatically ?

For some crazy reason I can't find a way to get a list of files with a glob for a given directory.  I'm currently stuck with something along the lines of:  NSString *bundleRoot = [[NSBundle mainBundle] bundlePath]; NSArray *dirContents = [[NSFileManager defaultManager]                          directoryContentsAtPath:bundleRoot];   ..and then stripping out the stuff I don't want, which sucks.  But what I'd really like is to be able to search for something like "foo*.jpg" instead of asking for the entire directory, but I've not been able to find anything like that.  So how the heck do you do it?


Toshiba satellite c640-x4014.Is ubuntu compatible with my laptop? so please help me with this,or any other Linux OS available for the system

I am a bit financially strapped and received a Gateway GT5056 tower. The tower has an AMD dual core 64-bit processor in it. Will Ubuntu 12.04 run on this machine? I will not have any other application other than LibreOffice installed.


I'm new in Latex and I'm using MIKTeX. For writing equation in a template for a journal, I write the following:  \[S_{ij}=  \mathbb{G} \]   but I face this error:     Undefined control sequence. [S_{ij}= \mathbb   How could I fix that?  note: I have installed "amsfonts" and "amsmath".

I am using WinEdt 6 for compiling my TeX documents. I am getting an error with contains the line $\mathbb{Z}$ showing that it is undefined control sequence. How should I rectify it? Should I include any math packages or something. I am a beginner in using TeX.


Anyone knows how to change the Listing name to Code Snippet?    \documentclass[bsc]{bangorcsthesis} \title{Mirror, mirror on the Web} \author{Loizos Vasileiou} \date{\today} \degreeScheme{BSc Creative Technologies} \supervisor{Prof. Kuncheva L.}  \bibliographySetup[compressed] \addbibresource{references.bib}  \usepackage{soul} \newcommand{\lk}[1]{\textcolor{red}{#1}} \newcommand{\mk}[1]{\textcolor{green}{#1}} \usepackage{listings} \usepackage{color} \definecolor{lightgray}{rgb}{.9,.9,.9} \definecolor{darkgray}{rgb}{.4,.4,.4} \definecolor{purple}{rgb}{0.65, 0.12, 0.82}  \lstdefinelanguage{JavaScript}{   keywords={typeof, new, true, false, catch, function, return, null, catch, switch, var, if, in, while, do, else, case, break},   keywordstyle=\color{blue}\bfseries,   ndkeywords={class, export, boolean, throw, implements, import, this, image, createCapture},   ndkeywordstyle=\color{darkgray}\bfseries,   identifierstyle=\color{black},   sensitive=false,   comment=[l]{//},   morecomment=[s]{/*}{*/},   commentstyle=\color{purple}\ttfamily,   stringstyle=\color{red}\ttfamily,   morestring=[b]',   morestring=[b]" }  \lstset{    language=JavaScript,    backgroundcolor=\color{lightgray},    extendedchars=true,    basicstyle=\footnotesize\ttfamily,    showstringspaces=false,    showspaces=false,    numbers=left,    numberstyle=\footnotesize,    numbersep=9pt,    tabsize=2,    breaklines=true,    showtabs=false,    captionpos=b } \begin{document}  Some text explaining what Listing~\ref{myLabel}.   \begin{lstlisting}[caption=My Javascript Example, label=myLabel] var videoElement = createCapture(VIDEO); \end{lstlisting} \end{document}   Please if you know how to solve this it would be really appreciated. this is my first Latex Project.

I'd like to modify the names used to typeset some of my document elements. For example, the caption of figure floats should change from "Figure" to "Fig.", and my \tableofcontents sectioning heading shouldn't read "Contents", but "Table of Contents". How can I do that?  \documentclass{article} % \usepackage[english]{babel} \begin{document} \tableofcontents \section{foo} \begin{figure}[h] \centering \rule{1cm}{1cm}% placeholder for graphic \caption{A figure} \end{figure} \end{document}


I have to prove that if $\Omega$ is convex, $f$ is holomorphic on $\Omega$ and $\text{Re}(f')>0 $ then $f$ is injection.  Any ideas?

Suppose that $f$ is differentiable on a convex domain (open and connected) D and Re($f')>0$ in D. How can we prove that f is injective on D?  I found some answers using the mean value theorem for holomorphic functions, but I am not familiar with that theorem. Actually I want to use the mean value theorem for integrals, which tells us that the value of an differentiable function $f$ at the center $z_{0}$ of the disk $|z-z_{0}|<r$ is equal to the integral mean of its values on the boundary of that disk: $f(z_{0})=\int^{2\pi}_{0}{f(z_{0}+re^{it})dt}$.  Can you help me proving it by the mean value theorem for integrals?


Suppose $A,B$ are in $\mathbb R^n$, $A$ lebesgue measurable and $|(A \setminus B)\cup(B\setminus A)| = 0$.  Show $B$ must be lebesgue measurable as well and $|A| = |B|$ (where $|\cdot |$ is the lebesgue outer measure).

If $A$ is a Lebesgue measurable set such that $m^*(A\triangle B)=0$, then $B$ is Lebesgue measurable.   I tried the problem as follows:  $m^*(A\cup B)=m^*((A\triangle B)\cup(A\cap B))\leq m^*(A\triangle B)+m^*(A\cap B)=m^*(A\cap B)$  Thus $m^*(A\cap B)=m^*(A\cup B)$ and so $m^*(A)=m^*(B)$. But I got stuck at this point. Please give any hint!


While browsing on my Ipad2 we'd like to take notes and save whole websites (not just bookmark them). The Evernote add-on on Chrome (on my PC) gives the exact functionality that I'm looking for. Is there an equivalent app for Ipad? Note that for a special accessibility reason we use Chrome instead of Safari. Thank you.

How to capture screenshot of entire webpage in iPhone's Safari browser like I can take in my Desktop with Help of Firefox Addon called ?


I have three Textfield.  1.textField1 = 15 charecter  2.textField2 = 50 charecter   3.textField3 = 50 charecter  Code snippet     if (textField1 .text.length <15 && textField2 .text.length <50 &&   textField3 .text.length <50) {      return YES;              }else{          return NO;     }    How to set the limit of three UITextfield.  Thanks in advance

How can I set the maximum amount of characters in a UITextField on the iPhone SDK when I load up a UIView?


How to use the date command, and given a timestamp, to get the timestamp X days ago. For example UTC time stamp is 1525192000, I want to get the UTC timestamp 30 days before that.

Suppose I have a particular date stored in a variable date_m. I want ((date_m)-25) date.   For example: I have 15/09/2014 stored in my variable , then I want 21/08/2014 returned if I subtract 25 from the date stored in variable.


I'm trying to compare the values of the boolean (all of which are 0) to the values of this string array data[] = "1,0,0,0,0,0,0,0,0,0,0,0,1". This is my code:  recipeIngrediants = new boolean[numberOfCuisines][numberOfIngrediants];         int i = 0;         while(file.hasNextLine()){             String temp = file.nextLine();             String[] data = temp.split(",");         for(int j=0; j < recipeIngrediants.length; j++){             String c = data[j];             if(c == "1"){                 recipeIngrediants[i][j] = true;             }             else{                 recipeIngrediants[i][j] = false;             }         }         i++;      }   I get an error saying that it is a type mismatch.  EDIT: Fixed the type mismatch error but it still gives me a value of false for all values in the boolean  Question:  How else can I compare these values to get the 2D array of recipeIngrediants to equal true at whatever position in data has a 1?

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 want to create custom Html Helper for my model that contains multiple attribute (50 label, 20 textbox, 5 dropdown list, 6 checkbox, ...) which there is some their type is Enum:   This is my Enum Class:      public enum ClassType     {         variable1,          variable2,         ...     }    This is The model that contains an Enum attribute:       public class Test2Models     {          [Required]         [Display(Name = "SelectList")]         public ClassType InitialValue2 { get; set; }          ...     }   Now i want to create a custom Html Helper in which i will give the InitialValue2 and i want him to return all the attributes.   public static MvcHtmlString Form<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression } { /// }   To be more clear i want the call of my custom Html Helper like this:  @html.form(it=>it.InitialValue2)    and the result i want a list of input  Could you help me please?

I'm trying to use the Html.DropDownList extension method but can't figure out how to use it with an enumeration.  Let's say I have an enumeration like this:  public enum ItemTypes {     Movie = 1,     Game = 2,     Book = 3 }   How do I go about creating a dropdown with these values using the Html.DropDownList extension method?  Or is my best bet to simply create a for loop and create the Html elements manually?


I've tried several times to install radio tray on my fresh ubuntu 11.10 installation but when I run ~$ sudo apt-get install radiotraythe following dialog pops up at the end of the script:  Media change: please insert the disc labeled  'Ubuntu 11.10 _Oneiric Ocelot_ - Release i386 (20111012)' in the drive '/cdrom/' and press enter   I've performed previous installations of this app on another computer using the same repository and all went smooth. My Ubuntu Oneiric version was installed from a USB flash drive, so don't understand that request from apt-get.

I can't update 12.04 LTS. The Update Manager shows this:  CD/DVD 'Ubuntu 12.04 LTS _Precise Pangolin_ - Release i386 (20120423)' is required Please insert the above CD/DVD into the drive '/media/cdrom/' to install software packages from it.   The image I downloaded and burned to CD is from  the PC (Intel x86) desktop CD version. I burned many CDs but the result is the same.


I accidentally removed myself as administrator on my Facebook business page and now I can't edit it.   The pages, at "golfbookie", now has no administrator and is inaccessible by me, its creator.   How do I fix it so I can edit it, or at least reinstate myself as the admin?  I've had no response from Facebook.

For some unknown reason, my Facebook Page has no Admin. I created the Page myself and have even assigned 2 Editors, but when I checked the page roles last month, I noticed that my status has changed from Admin to Editor. Now we are 3 Editors and no Admin.   Please do note that I did not accidently demote myself as Facebook does not permit that when you are the sole admin. I also did not promote someone else to Admin and got myself demoted that way, because even if that did happen there would still be at least 1 Admin left.   If you check the attached image below you'll see that there are in fact no Admin on my Page, which means this has to be a bug?  Any suggestions on what I should do?


Swift multiline strings that contain quotation marks, such as:      let multilineString =      """          "let myString = 123"         is part of my multiline string     """   are formatted incorrectly. For example see

I noticed that sometimes my code gets highlighted in different colors when rendered.   What is syntax highlighting? How does it work? Why isn't my code being highlighted correctly? How do I report a bug or request a new language? How do I use syntax highlighting? What languages are currently available on Stack Exchange?


I have a problem with a webserver that runs Centos4 with DirectAdmin.  Since a few weeks some websites hosted on it are not redirecting on search engines properly, they are redirected to some malware site, resulting in a ban from google.  Now I have used 3 virusscanners: ClamAV: Didn't find anything Bitdefender: Found a 2-3 files with JS infection, deleted them AVG: Finds lots of files, but doesn't have the option to clean!  The virus that it finds is: JS/Redir JS/Dropper  Still the strange thing is: website a (www.aa.com) does not have any infected files (have gone through all the files manually, is a custom PHP app, nothing special) but does still have the same virus. Website b (www.bb.com) does have the infected files as only one.  I deleted all these files and suspended the account, but no luck, still the same error.  I do get the log entries on the website from the searchengines so the DNS entries are not changed.  But now I have gone through the httpd files but cannot find anything.  Where can I start looking for this?

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.


When you click the "add/show comments" link, the text field for writing new comments is automatically focused. This makes a lot of sense on a regular browser, but it has a very annoying effect on mobile devices.  Each time I click the link to read the remaining comments the on-screen keyboard expands. Most of the time I don't want to write a comment when I click that link, I only want to read them. This is especially true on a mobile device where writing is much more cumbersome than on a regular computer.  On a mobile phone I would of course use the mobile version of the site, but on a tablet the desktop version is the preferred one.   The automatic focus should stay for non-mobile devices, but it is very annoying on tablets and should be removed there.

If I open a post using the mobile theme, which has many comments, there is a link at the footer "add/show n more comments". If this link is clicked, the comments are loaded and displayed.   At the moment the text area is automatically focused which is not a great experience (in my opinion), as you have to close the editor and scroll back to the top if you just wanted to read the comments, without adding a new one.  Would it be possible to either   not focus the text area by default and to load only the comments add a new link for adding a comment


Hello so I have this condition:  if (DateTime.Now.Subtract(dateTimePicker_Doc_BirthDate.Value).Days/(365)<18) {     this.errorProvider1.SetError(this.dateTimePicker_Doc_BirthDate, "Atleast 18 years old");     valid = false; }   And I want to make another that contains graduation of this person and set restriction that at the time when he graduat must be atleast 18 years older.  I have tried this: but it does not work  if (DateTime.Now.Subtract(dateTimePicker_Doc_Graduation.Value).Days / (365) < 18 + (18)) {     this.errorProvider1.SetError(this.dateTimePicker_Doc_Graduation, "Atleast 18");     valid = false; }

Given a DateTime representing a person's birthday, how do I calculate their age in years?


From origination point of view, if i understand correctly, we 'derived' imaginary number mathematically e.g. x^2 = -1. But what is the use of such number in study of mathematics? Are they really helpful in solving some problems or understanding some other problems or its just some useless observation by some mathematician?  Disclaimer: I'm not mathematician. I didnt get answers in

Recently I asked a question regarding the diophantine equation $x^2+y^2=z^n$ for $x, y, z, n \in \mathbb{N}$, which to my surprise was answered with the help complex numbers. I find it fascinating that for a question which only concerns integers, and whose answers can only be integers, such an elegant solution comes from the seemingly unrelated complex numbers - looking only at the question and solution one would never suspect that complex numbers were lurking behind the curtain!  Can anyone give some more examples where a problem which seems to deal entirely with real numbers can be solved using complex numbers behind the scenes? One other example which springs to mind for me is solving a homogeneous second order differential equation whose coefficients form a quadratic with complex roots, which in some cases gives real solutions for real coefficients but requires complex arithmetic to calculate.  (If anyone is interested, the original question I asked can be found here: )  EDIT:  I just wanted to thank everyone for all the great answers! I'm working my way through all of them, although some are beyond me for now!


I want to get the click event on the li element using jQuery. But unable to get it. FoundationJs framework is used for the frontend.  HTML code:

Entry Fee

             <% for(var i=0; i < data.coinOptions.length; i++) { %>               <li class="ui-state-default <%= i == 0 ? 'ui-selected' : ''  %>" data-value="<%- data.coinOptions[i] %>"><%=  (data.coinOptions[i] == 0 ? "FREE" : data.coinOptions[i] + " Coins") %>
             <% } %>

   The jquery code snippet below works on clicking the container but not on li tag  $(".entry-fee .container").click(function (event) {     event.preventDefault();     console.log(event.currentTarget); })   None of the below work when I click on the li tags  $(".entry-fee .container .select-box").click(function (event) {     event.preventDefault();     console.log(event.currentTarget); })  $(".entry-fee .container .select-box li").click(function (event) {     event.preventDefault();     console.log(event.currentTarget); })  $("#coins li").click(function (event) {     event.preventDefault();     console.log(event.currentTarget); })   But I noted one thing that if I fire the event manually using   $(".entry-fee .container .select-box li").click()   in chrome console it works, which means the event listeners are bound to the elements. What can be done here to make it work properly? Let me know if any more info is required.

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.


How can I create a circuit with a total resistance of 144.7 ohm which is composed of 10-ohm resistors? How many parallel and/or series resistors should it contain?  I've tried solving this but the nearest total resistance to 144.7 ohm that I get is 144 ohm exactly. Actually, this isn't for real-life usage rather just a circuit analysis problem. Please help.

In the 70's I had a stack of old Amateur Radio magazines (50s-60s), and for a long time I saved an article about using the  to combine a number of resistors to achieve a specific value. Does anyone recall and have a copy of this article, or know how the Euclidean algorithm is applied to solve this problem?


Let  $$ f: A\to B $$ be a morphism of finitely generated $\mathbb{C}$-algebras, suppose $\mathfrak{m}\unlhd B$ is a maximal ideal, I want to show that $f^{-1}(\mathfrak{m})$ is a maximal ideal of $A$. Consider the morphism  $$ A\to B/\mathfrak{m},  $$ $$ a\mapsto f(a)+\mathfrak{m}, $$ this has kernel $f^{-1}(\mathfrak{m})$, by the first isomorphism theorem we get $$ A/ f^{-1}(\mathfrak{m}) \cong \frac{f(A)\cap \mathfrak{m}}{\mathfrak{m}}, $$ so, RHS is a field, so LHS is a field and $f^{-1}(\mathfrak{m})$ is maximal. I think that my proof is wrong, probably I got RHS wrong and I am not using the fact that these are finitely generated or over $\mathbb{C}$ at all. What is the correct proof?

Suppose that $A$ and $B$ are commutative rings containing a field $k$, and $B$ is finitely generated $k$-algebra. Let $\phi: A\rightarrow B$ be a ring homomorphism with $\phi|_k =\mathrm{Id}$. I am trying to prove that if $M\subset B$ is a maximal ideal, then $\phi^{-1}(M)$ is a maximal ideal of $A$.    The case when $A \subset B$ is an integral extension of rings is well-known. I think I can also prove the result when $\phi$ is surjective.    discusses the case when $B$ is a finitely generated $\mathbb{Z}$-algebra but I am not sure how to generalize this.


I am making pulled pork in my slow cooker this week.  I am going to use a pork shoulder and am planning on cooking it on low for 8-10 hours while at work.    How much liquid should I put in the slow cooker?  Should the liquid cover the pork or should there just be a little liquid in the bottom?    If the pork isn't fully submerged, will the parts of the meat that are not submerged cook?  If so, how?   \                                         /   \         ********************          /  <-- Should liquid cover the meat?     \        ********************         /     \       ********************        /  <-- Or go half way up the meat?      \      ********************       /       \     ********************      /  <-- Or should I just have a little liquid in the bottom?        \-----------------------------/

My roommate put a hunk of beef roast in the slow-cooker for a good 6 hours.  It's a fairly large sized slow-cooker, at least 8 quarts.  The meat was cooked through but very chewy, and I never remember my mom having that issue with a slow-cooker.  My roommate tends to put only enough water to get halfway up the side of the roast, and always uses a slow-cooker 'bag' (another thing my mom never did).  What advice can I offer them to get a better outcome?


I bet this is somewhere, but I've checked the books and I can't find it.  I'm looking at most of the revelations that say they do something when the person is attuned or fully attuned.  For example, Dark Matter specifies that it takes a move action to get a small DR bonus.  But it then says that if you're attuned or fully attuned, you don't take the move action and, instead, get a DR equal to half your Solarian level.  I assume they mean attuned in the mode that gives it to you (in this case Graviton).  But I do not see that stipulation anywhere.  Can someone point me to that stipulation if it exists?  If not...does this mean I can be Photon attuned and get the attuned bonus from Dark Matter?

I’m having trouble finding an official clarification of this, so I’m wondering if anyone has found a ruling:  Solarians gain powers known as stellar revelations. These are either “photon” or “graviton” revelations. It is specifically mentioned they can be used out of combat, though most include improved effects or separate powers that can only be used “while attuned” - a state a Solarian enters during combat. They may be photon or graviton attuned, at the player’s choice, and are able to increase their level of attunement each round until they become fully attuned to one or the other. However, apart from the very powerful “zenith revelations”, nowhere in the rules mentions whether photon revelations may only be used while photon attuned, or graviton revelations only while graviton attuned. The revelations themselves usually say “while attuned or fully attuned” for the more powerful effects, without mentioning the mode, and there’s no general rule in the class feature that answers this question.  Is there an official ruling on whether the “only while attuned” power of a photon revelation can be used when the character is graviton attuned, or vice versa? I suspect the answer is yes but it’s hard to tell based on the core rules.


I am designing an iOS mobile app in Swift which uses a remote SQL database for its backend. This app has a lot of interactions with the database, due to this I want to ensure it is safe from SQL injection. My first idea was to check in Swift if the text in the UITextView contains any blacklisted words, however after reading this:    I'm not sure if blacklisting is a good idea; although I'm not sure about the degree to which these problems affect mobile apps; as this was written about websites. Another thing I read about was using parametirised queries, although I don't really understand what this means exactly as most examples I read were designed for websites as well; the way I currently connect to my database is through sending a POST request from a NSURLSession to a PHP script on my server. This is a typical example of what I do in my PHP script :    $user_id = $_POST['user_id'];  $second_field = $_POST['second_field'];   $conn=mysqli_connect("localhost", "***", "***","***");   $result = mysqli_query($conn,"INSERT INTO my_table (user_id, second_field) VALUES ('$user_id', '$second_field')");

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


Suppose we know the distribution of a variable $x$ is $g(X)$, and we also know the conditional distribution of a variable $y$ given $x$ is $f(y|x)$. It has been shown that (such as in ) by    Draw $x^*$~$g(x)$ Draw $y^*$~$f(y|x)$   After $n$ draws, the quantities $y_1,...,y_n$ are an iid sample from the marginal density $J(y)$. I understand that the pairs $(x_1,y_1),...,(x_n,y_n)$ are an iid sample from the joint distribution $Q(x,y)$, but I still try to figure out the intuition/theory about why $y_1,...,y_n$ are an iid sample from the marginal density $J(y)$. Can anyone help? Thanks.  p.s. I know the answer to  explains it but I still don't get why ignoring $x$'s equals to integrating out them.

How can I evaluate the marginal cumulative distribution function of a set of random variables for which I do not have the CDF in closed form. I can, however, simulate from a joint distribution involving this set of variables.  To be more specific, assume I want to evaluate the CDF of $(X_1,X_2)$ but I only have a way to simulate from $(X_1,X_2,X_3)$.  Obviously I can approximate the CDF of $(X_1,X_2,X_3)$ by obtaining a large number of simulations and checking how many observations fall below the desired threshold. But how to get the CDF of $(X_1,X_2)$?. Can I just simply throw $X_3$ away and use the same procedure as for the joint PDF?  Obviously I cant get $F_X(x) = P(X \leq x) = \lim_{y \to \infty} P(X \leq x, Y \leq y) = \lim_{y \to \infty} F_{XY} (x, y)$ because no closed form CDF is available. I also do not want to involve the pdf.


Why does "edited" have one "t" and  and "emitted" has two? "Edit" and "emit" are so similar in spelling and pronunciation.  I keep wanting to type "editted" for some reason.

Initially, my question was: is "focussed" or "focused" the correct past tense of "focus", but since this applies to a lot of words, I would like to generalize and ask: is there supposed to be a rule when to double the consonant?


I have a script running continuously, reading tail -f /var/log/daemon.log  The problem is, when the file /var/log/daemon.log gets rotated by logrotate, tail still has "file handle" for the old (rotated) file and no longer displays the contents of the new /var/log/daemon.log file  Is there any way to fix this, so that tail shows the contents of the new file, if the file was rotated ?

On a long running system I usually have a terminal with  $ tail -f /var/log/kern.log   or something like this open.  But from time to time I have to restart such command because no new messages are displayed anymore.  I assume this is because of the log rotating job that has replaced the log file tail -f was 'watching'.  How can I avoid this restarting issues?  Can I invoke tail such that it notices the rotating process and does the right thing?  (I notice this issue on a Ubuntu 11.04 system that uses rsyslogd by default.)


Fairly self explanatory, how do I check to see if a file exists before I write to it in C.

Is there a better way than simply trying to open the file?  int exists(const char *fname) {     FILE *file;     if ((file = fopen(fname, "r")))     {         fclose(file);         return 1;     }     return 0; }


I've bought a computer with Windows 8 pre-installed. I don't want Windows , so I intend to format and install Linux. But I don't have any Windows 8 CD/DVD that I'd like to keep . How can I make a usable copy out of my current system in a CD/DVD ?

I have upgraded to Windows 8 from Win 7. I want to create a recovery disk for Windows 8, just in case something goes wrong. I didn't find the option of creating it from the control panel.  How do I create a Recovery CD/DVD?


I have this simple program that does nothing:  class ShowTheNameOfTheFile{   static public void main(String[] argv){    } }   I compile it as ShowTheNameOfTheFile.jar and configure my Windows machine to open all txt files with it.  Now, when I click a txt file it will open my ShowTheNameOfTheFile.jar program.  In java, how can I know with txt file has opened the ShowTheNameOfTheFile application?

My code runs inside a JAR file, say foo.jar, and I need to know, in the code, in which folder the running foo.jar is.  So, if foo.jar is in C:\FOO\, I want to get that path no matter what my current working directory is.


I was struggling to understand how an op-amp determines its output without a reference point.  The output of an op-amp is A * (Vni - Vi)  Then let's say we have an inverting op-amp with a gain of 1000, that V+ is 9 V, V- is -9 V and Vni is 5 V.  If Vi is 5.002 V, the output is 1000 * (5 - 5.002)  =  -2 V  If Vi is 4.998 V, the output is 1000 * (5 - 4.998)  =  2 V  The output is -2 V or 2 V but with respect to where? With respect to the halfway between 9 V and -9 V or Vni (5 V)?  So how can I set the reference point of the op-amp?  Thanks in advance.  Note: Vi is the inverting input and Vni is the non-inverting input of the op-amp.  Edit: Thanks everyone for helping.

Most op amps can operate in single and split supply configurations. However, I cannot see how this is possible.  If I connect voltages \$V_\text{SY}^+\$ and \$V_\text{SY}^-\$ to the positive and negative supply pins of a op amp, and \$V_+\$ and \$V_-\$ to the non-inverting and inverting inputs, then the output is (if \$A_\text{OL}\$ is the open loop gain of the op amp): $$V_\text{out}=A_\text{OL}(V_+-V_-)+V_\text{SY}^-\tag{Single-supply}~\text{ }~~\text{ }~~\text{ }~~\text{ }~~\text{ }~~\text{ }$$ The above equation is from personal experience using op amps in single supply (i.e. \$V_\text{SY}^- = \text{GND}, V_\text{SY}^+ > \text{GND}\$).  In split supply, we can use the following diagram from MIT's 6.002 introduction to electronics lecture video:  $$V_\text{out}=A_\text{OL}(V_+-V_-)+(V_\text{SY}^+-V_\text{SY}^-)/2\tag{Split-supply}$$  These two equations, however, are mutually inconsistent: If I take an op amp and hook up a single voltage source between its supply pins, how does the op amp know that the resulting voltage is not split between two sources?   It must know - but how does it know?


I am studying the use of GRASS GIS within QGIS and I need a little help with the understanding of the v.kernel module. I didn't find any human help within the manual (very cryptic)  I have a point data vector and I need to study the density of the points distribution in my mapset using a bandwidth of 1000 meters.  How do I set the parameter <stddeviation>, or in other words ... what is this parameter related to? What is the correct use of this parameter in relation with the settings of the bandwidth? Can I simply set the parameter with a value of 1000?

I am flummoxed on how to use GRASS's v.kernel.  I have a vector layer of around 2.5 million points. I want to make a heat map using v.kernel to show concentrations, since I have variable instances with overlapping points, sometimes huge overlaps.  I've already gotten this vector layer in GRASS, and it displays just fine.  I've tried using GRASS's v.kernel command based on what I've seen here and on other forums, and I can't get it to do anything besides output a raster that's just a pink square.  Here's the command I'm using:  v.kernel --verbose input=master_grass7 output=master_grass7a_heatmap stddeviation=.0001   I've varied the stddeviation to all sorts of values from 1000000 to .000001, and it had no effect.  I've read the  repeatedly and don't really understand what it's getting at. At least, the instructions are on esoteric concepts, nothing practical. I've also checked the , and I'm not really understanding it, either. Yes, I can read C. The problem is it depends on a lot of stuff defined elsewhere in GRASS GIS.  I've also done a lot of Google searching, and I can't find a comprehensive guide. All that I'm getting are scattered copies of the v.kernel doc/man page or people who apparently got it to work without a fuss.  I've also checked up on the concept of kernel density estimation (KDE), and even then I don't see how to use the v.kernel command. That command appears to be a specific interpretation of KDE; its switches don't appear to correspond well to generic KDE concepts.  So back to the main question here: how can someone who is not intimate with GRASS product development use the v.kernel command? Is there a plain language translation available?


I'm trying to write an ArrayList class in c++, but run into the linking problem with templates as described in many places. I don't want to copy all my code into the header file. That would just be ugly. And the vector class probably didn't do that either right?   So how would I include my ArrayList implementation to any cpp file?  Here is my header File:   //ArrayList.h #include <stdlib.h>  template <typename T> class ArrayList{     public:         ArrayList<T>(){             array = (T*)calloc(sizeof(T), 1);             length = 1;             elements = 0;         }          T get(int i);         void set(int i, T el);         void add(T el);         int expand(size_t n);         void remove(int i);         int size();         int reserved();         void fix_size();      private:         void copyAll(T arr1[], T arr2[], int len);         T *array;         int length, elements; };   And here is part of my .cpp file:  #include <stdlib.h> #include <stdio.h> #include "ArrayList.h"  template <typename T> T ArrayList<T>::get(int i){     if (i > this->elements || i < 0) return (T)0;     return this->array[i]; }  template <typename T> int ArrayList<T>::size(){     return elements; }  template <typename T> int ArrayList<T>::reserved(){     return length; }  template <typename T> int ArrayList<T>::expand(size_t n){     // implementation }  template <typename T> void ArrayList<T>::set(int i, T el){     // implementation }  template <typename T> void ArrayList<T>::add(T el){     // implementation }  template <typename T> void ArrayList<T>::remove(int i){     // implementation }  template <typename T> void ArrayList<T>::copyAll(T arr1[], T arr2[], int len){     // implementation } template <typename T> void ArrayList<T>::fix_size(){     // implementation }

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


I'm trying to make a Java Gui that print the text on a JTextField into a label. So, on runtime I'll write something in a JTextField then I'll press a button that print the content of JTextField in a label.  But the program give me a java.lang.NullPointerException. Is there something wrong in  ActionListener method?  Could you help me?  Below the code:  import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import java.awt.EventQueue; import java.util.*; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.border.EmptyBorder; import java.awt.Rectangle; import javax.swing.SwingConstants; import java.awt.event.ActionListener; import java.util.EventObject; import java.awt.event.ActionEvent;  public class MastermindGui1 extends JFrame {  public static JTextField insNome; public static JLabel welcomeLbl;  private JPanel contentPane; Container contenuto;  public MastermindGui1() {     JFrame finestra = new JFrame("MASTERMIND");     finestra.setResizable(false);      finestra.setBounds(200,200,300,300);     contenuto = finestra.getContentPane();     contenuto.setBackground(Color.YELLOW);     finestra.getContentPane().setLayout(null);      JTextField insNome = new JTextField();     insNome.setBounds(21, 70, 151, 35);     contenuto.add(insNome);      JLabel welcomeLbl = new JLabel("");     welcomeLbl.setVisible(false);     welcomeLbl.setBounds(58, 138, 180, 74);     welcomeLbl.setBackground(Color.ORANGE);     contenuto.add(welcomeLbl);      JLabel lblNewLabel = new JLabel("INSERISCI IL TUO NOME");     lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);     lblNewLabel.setBounds(75, 11, 142, 23);     finestra.getContentPane().add(lblNewLabel);      JButton stampa = new JButton("STAMPA");     stampa.addActionListener(new stampa());     stampa.setBounds(195, 76, 89, 23);     contenuto.add(stampa);     stampa.addActionListener(new stampa());      finestra.setVisible(true);     finestra.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }  private class stampa implements ActionListener {     @Override     public void actionPerformed(ActionEvent e) {         insNome = (JTextField) e.getSource();          String testo = insNome.getText();          welcomeLbl.setText(testo);     } }  public static void main(String[] args) {             MastermindGui1 finestra = new MastermindGui1();         } }

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?


Towards the ending of Get Out (2017), it is revealed that Grandpa Armitage and his wife had their conciousnesses transferred to Walter and Gerrgina respectively. If so, why are Walter and Georgina still servants of the Armitage family? There is a scene in which Rose's mom is rude towards Georgina. In the video Chris was shown during phase 2 of the Coagula procedure, Grandpa Armitage appears to be the leader of their cult, why would he transfer his consciousness into Walter's body and be the house help?

I just saw Get Out, and there's one thing I don't understand.  Georgina turns out to be controlled by Rose's grandmother; its grandmothers brain in her body. Why then, is Georgina constantly cleaning and being treated like an actual maid.  During the diner scene, we get a glimpse into the kitchen, and we see Georgina holding up a plate in way that suggested that she was made to work and cook. The pose and the fact that she was already standing there holding the plate before Missy enters the kitchen was also quite strange and suggestive.  Also, at the "party" theres a moment that Chris sees Georgina and Missy. For a moment he thinks that Georgina is being involved in the party, but than it turns out the Georgina is just handed empty glasses to take care of.  So this I don't get. If its really grandma inside Georgina, then why is she treated in this way?


There are multiple text files in a folder and the requirement is to write a python code to read all the text files and extract date field after this bit of text "$published_date:" (For example ,published_date: January 02 2020) from each of the text files . All files look like this :-     $Publisher_Name: ABC Corp.                                                                 $Publisher_Date: January 02 2020.                                                                      This copy was authored by xyz.       Files consist of several lines along with "$Publisher_Date:  " printed somewhere on each file . Need help to change the date format from  datestring (e.g "'January 03 2020'" ) to  " 'dd/mm/yyyy' " in below code. Here is the python code , where i am trying to read text files from basepath and extract date value after this bit of text "published_date:"  .     import re       import os     import dateparser          basepath = (r"path\test")     with os.scandir(basepath) as entries:         for entry in entries:             if entry.is_file():                 fn=entry.name          def f(fn):         with open(fn) as f:             for s in f:                 # match text between Publisher_Date: and '.'                 m = re.search('(?<=Publisher_Date: ).[^.]*', s)                 if m:                     return(fn, m.group()) # # tuple (filename, date)             else:                 return None # no match in file          if __name__=="__main__":         folder = (r"path\test/")         _,_,filenames = next(os.walk(basepath))         dates = []         #dateparser.parse(dates = [])                  for i in filenames:             print(f(folder + i) ,dates)                I am getting below output from my code :-     path\tes2.txt', 'January 03 2020'     path\tes3.txt', 'January 23 2021'  Looking to get rid of path location and changed date format in my desired output .     **My Desired output is**           test2.txt    03/01/2020     test3.txt    23/01/2021     test4.txt    15/03/2019

This is my code:  import datetime today = datetime.date.today() print(today)   This prints: 2008-11-22 which is exactly what I want.  But, I have a list I'm appending this to and then suddenly everything goes "wonky". Here is the code:  import datetime mylist = [] today = datetime.date.today() mylist.append(today) print(mylist)   This prints the following:   [datetime.date(2008, 11, 22)]   How can I get just a simple date like 2008-11-22?


I thought it might be cute to introduce notebook lines in my text.  Also it may help readers from straining their eyes.  Let's use the classic filler text:     Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.      Now we are engaged in a great civil war, testing whether that nation, or any nation so conceived and so dedicated, can long endure. We are met on a great battle-field of that war. We have come to dedicate a portion of that field, as a final resting place for those who here gave their lives that that nation might live. It is altogether fitting and proper that we should do this.      But, in a larger sense, we can not dedicate -- we can not consecrate -- we can not hallow -- this ground. The brave men, living and dead, who struggled here, have consecrated it, far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us -- that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion -- that we here highly resolve that these dead shall not have died in vain -- that this nation, under God, shall have a new birth of freedom -- and that government of the people, by the people, for the people, shall not perish from the earth.   Blah blah blah.  I could like this paragraph to appear as a notebook with  a faint line, perhaps - black!20!white underneath each line.   Is this styling possible?  Here is a cute html example on       Is it possible to add these lines without resorting to adding another package like background ?

I would like to print a document with text on lined paper like a notebook like   However, I would like to be able to edit the line colours.  I would like to put the header/title in the blank white space. Is there a way to do the document above without using the background jpg?  The document is also multiple pages.   I have looked at this question too and would like to have lines only and not a grid.   Thanks!


I know there isn't a way to export a map from ArcMap to PDF and keep the hyperlinks, but is there a way to add hyperlinks to the map in Adobe Acrobat? I have a simple map of a few states and I am wanting each state to link to a webpage. I know how to get to seeing the attributes in Adobe Acrobat, but can't figure out if I can add a hyperlink there.  I think this is different to  which instead explains how you would have to go through the model tree to find the link. I am asking how to create a link on the states on the pdf, so that you wouldn't have to search through the pdf to find the links.

I'm using ArcGIS 10.1 and would like to export a map to a pdf, preserving feature's attributes. I would like to be able to identify, for example, a point feature from the map on pdf with its underlying features (essentially hyperlink to a document or URL). I know one can export to such a pdf in ArcMap, with an advanced option of exporting features with attributes. I use Adobe Acrobat Pro v.10, and cannot seem to be able to find a way to bring these attributes up.   Is this possible?


Good day  I'm new to blender and the forum, I hope someone will be able to help me. I want to make something like the picture attached, but only the ball part, not the face and the brain, only the ball wires, where the white wires must be visible, one color and the points between the wires another color, and the black background transparent. Is there somewhere that I can find a texture like this, or how would I create my own texture? Any help would be appreciated.

How to create the outer nodes effect in Blender Cycles, including the lines? I know this is achieved using a particle system, but don't know how.   Also can anybody suggest any plugins for blender that does the same?


I have an invitation letter from the client based in the UK. I have a NOC from my employer stating my passport number, annual remuneration, job description, duration of visit and assurance of taking care of my expenses.  I own a house that I bought 4 months back, I have a wife and 4-month-old baby (they are not traveling with me) as dependents.  I have company's bank statements, taxation details, pan card details, my salary slips, my bank statements etc.  Am I missing anything? Do I need to carry a translated copy of my birth certificate? Do I need to carry my son's birth certificate as well?  Any other documents that I might be missing? I am seeking a 2-year multiple entries visa because I might need to make more trips in the future. Also, the conference is in just 3 weeks so I have chosen the express option that delivers in 5 working days.

I'm from the Philippines, and 've been granted a (visitor) visa to UK. I will stay there for a month. My relative, who lives there, will sponsor my travel expenses and accommodation.   Are there any documents needed to provide at the UK Border, aside from passport (e.g travel insurance, medical insurance, the documents provided during visa application)? Do I need to show money? I'll bring money, but most of my travel expenses will be shouldered by my relative. I've read some posts that some were refused entry at UK Border due to insufficient funds to cover trip.They were paying for themselves, and I have a different case so I can't compare my situation to theirs. I'm planning to bring the financial documents my relative gave me during my visa application, and show return booked ticket (just in case they ask!).


I manage to use graphical images in both text and tables as if they were letters: \documentclass{article} \usepackage{graphicx} \newcommand{\inspictext}{  \includegraphics[width=0.04\textwidth]{example-image-b}}  \begin{document}  Some text \inspictext \begin{table}   \newcommand{\inspic}{  \includegraphics[width=0.04\textwidth]{example-image-a}}   \begin{tabular}{llc}     A &\inspic \\     B &\inspic \\   \end{tabular}   %  \caption{the symbol \inspictext is ..}                                                                                \end{table} \end{document}  This is confirmed in the output:  I would like to use an image also in the table caption. Therefore, I uncomment the line    %  \caption{the symbol \inspictext is ..}     I get an error: ! Argument of \@caption has an extra }. <inserted text>                  \par  l.14     \caption{the symbol \inspictext is ..}  How to fix?

I need to place a small image in the caption of an image, but I don't know how, please help.  \begin{figure}[H]    \begin{center}        \includegraphics[width=9.5cm]{figure.eps}\\ \caption{Some text [SMALL IMAGE HERE].}\label{figure} \end{center} \end{figure}


A lot of games I've been in have had either enemies with player levels or straight up PvP. How should XP be awarded when facing enemies like that? Should you attempt to calculate the CR of the enemies based on the DMG tables or is there a guideline on how XP should be awarded based on the class levels?

As part of an early quest, my PCs are likely to face off against a wizard.  The problem here is that the stat block for Mage NPCs listed in the Basic Rules has a Challenge Rating of 6, while the PCs are going to be five Level 1s. So, instead of messing with the stat block and risk weakening it too much/too little, I'm choosing to create a Level 1 Wizard PC and use it as an NPC for this quest.  The problem with that is that, as far as I can tell, there aren't any designated rules for assigning either Challenge Ratings or XP values to a PC. So, should I just give the wizard a Challenge Rating equal to his level (and thus have him give 200 xp when killed), or is there a better way to do this?  (This is different from , because he's asking for a way to assign a level to an NPC, while I'm asking for a way to assign an XP value/Challenge Rating to a PC (for use as an NPC). Similar questions, but different.)


arr = [  {    id:1  },  {    id:2  } ]   This is an example object structure. I want to delete first object in this array.    delete arr[0];   Resulting structure is  [ {   undefined * 1 }, {   id:2 } ]   I have searched a lot and found that deleting an entire object will lead to dangling pointer problems. But i want resulting array to have only one object after deletion. Is there any other way to achieve this?       EDIT    How to do if the object is neither first nor last?

I have an array:  data.Dealer.car[0] data.Dealer.car[1] data.Dealer.car[2]   If I do this:  alert(data.Dealer.car.length); delete data.Dealer.car[1]; alert(data.Dealer.car.length);   It gives me the same count each time. Does the removed element still exist?


I am happy to see you.   It is grammaticaly correct sentence, ok. I want to make little alterations to the sentence as below.     I am happy, seeing you.   Note that I intend to use "seeing you" as a present participle phrase. I want to be informed whether this is correct usage of participle phrase.    Secondly what is the difference between two sentences in terms of meaning? What different meaning could participle phrase impose, replacing "to see you"?

I am happy seeing you succeed.   I am happy to see you succeed.   I want you to succeed.   I want you succeeding. I want your succeeding.  Could you please explain the differences between them, and the first and second examples independently of each other?


I am using Blender as the basic 3d tool to design the paper craft (like origami, but with die-cut).  My question is that is it possible for me to flatten the mesh with the polygon undistorted? So that I can print it out on paper and reconstruct the 3d model.

Is there a way to take a mesh, cut it with seams or sharp edges and flatten it, so that the faces stay the same shape and size?  Making paper models is one aspect, where you could use that technique.  No, I'm afraid SZ0Return is not going to do it properly.  And misusing the UV-unwrap is only a last option.    Note, while it's an option to revert to Blender 2.49 which had a script to do this, I'd like a solution that I can use inside the current workspace.


I'm trying to make a simple Piano sheet compiler/player, where the user feeds the program a string of piano code ex "G E F D D G...etc", which is then broken by the stringtokenizer method and stored individually in a String array called code. I've built a sheetPlayer method, which reads the array and based on multiple if statements would generate different sounds. everything seems ok but when I run the program no sound is played? and I accidentally found that if I was to directly initialize the code array ie code={"G","F"} the sound plays just find and im wondering if it's the stringtokenizer that is causing the problem?   public class PianoCompiler {  //public static Scanner reader=new Scanner(System.in); //using input user should be able to feed the program sheet code ex"G G D E" with space in between //and it should be store into sheetCode String public static String sheetCode="G E G G E G A G F E D E F "; //code Array should be able to read sheetCode String and break and store it into single letter components public static String[] code=sheetCode.split(" ");  public static void sheetPlayer() {     for(String key:code)     {         if(key=="G"){             try             {                 String gongFile = "/Users/Raed/Music/PianoSounds/g.wav";                 InputStream in = new FileInputStream(gongFile);                 AudioStream audioStream = new AudioStream(in);                 AudioPlayer.player.start(audioStream);             } catch(Exception e ){              }          }         if(key=="F"){             try             {                 String gongFile = "/Users/Raed/Music/PianoSounds/f.wav";                 InputStream in = new FileInputStream(gongFile);                 AudioStream audioStream = new AudioStream(in);                 AudioPlayer.player.start(audioStream);             } catch(Exception e ){              }          }          if(key=="E"){             try             {                 String gongFile = "/Users/Raed/Music/PianoSounds/e.wav";                 InputStream in = new FileInputStream(gongFile);                 AudioStream audioStream = new AudioStream(in);                 AudioPlayer.player.start(audioStream);             } catch(Exception e ){              }          }          if(key=="D"){             try             {                 String gongFile = "/Users/Raed/Music/PianoSounds/d.wav";                 InputStream in = new FileInputStream(gongFile);                 AudioStream audioStream = new AudioStream(in);                 AudioPlayer.player.start(audioStream);             } catch(Exception e ){              }          }           if(key=="C"){             try             {                 String gongFile = "/Users/Raed/Music/PianoSounds/c.wav";                 InputStream in = new FileInputStream(gongFile);                 AudioStream audioStream = new AudioStream(in);                 AudioPlayer.player.start(audioStream);             } catch(Exception e ){              }          }         if(key=="B"){             try             {                 String gongFile = "/Users/Raed/Music/PianoSounds/b.wav";                 InputStream in = new FileInputStream(gongFile);                 AudioStream audioStream = new AudioStream(in);                 AudioPlayer.player.start(audioStream);             } catch(Exception e ){              }          }          if(key=="A"){             try             {                 String gongFile = "/Users/Raed/Music/PianoSounds/a.wav";                 InputStream in = new FileInputStream(gongFile);                 AudioStream audioStream = new AudioStream(in);                 AudioPlayer.player.start(audioStream);             } catch(Exception e ){              }          }          try {             Thread.sleep(3000);                 //1000 milliseconds is one second.         } catch (InterruptedException ex) {             Thread.currentThread().interrupt();         }      } }

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


One of my best friends always makes....interesting characters. For example, in anyone else’s campaign he always uses home brew.  He takes his homebrew from d and d wiki and likes them because they’re different. All the time, he says it’s official because someone else made it and I always say it’s too op. I’ve talked to my friends and they all agree that him wanting to do these unbalanced homebrew is a problem.    Sometimes, he makes stuff up about what the race can do. For example, he played a bee forged in my friends campaign and he said he could memorize a map on the wall with his “photographic memory.” I said it wasn’t something in the race description but he started to say it was obvious that he had that ability since he’s a robot. The DM let it slide and he memorized it.    In another case, he wanted to pick a dragon race. I said he should just use Dragonborn but he wanted to fly. This race basically traded dragon breath for a flying speed of 60 ft.  I don’t think he's making these odd characters for the power, he’s doesn’t seem like the type of person to do that, he just wants to be creative. He can be creative, but he doesn’t need to be the odd one out.  Even in the GURPS game I ran, I wanted a realistic campaign. So he made a kid raised by wolves who had a stick in his mouth and he has a wolf brother that does whatever he says. I need help telling him that he needs to make, to put it bluntly, better characters. I want to tell this to him without him becoming mad/sad.  I have told him I don’t allow homebrew in my campaigns, but he keeps pitching odd characters and I had to cave.

I have an issue with two players in my very large gaming group that I would like some advice from people who have perhaps dealt with players like these. In terms of age and experience, we're all between the ages of 18 to 21, and we've variously been playing the game for 2 to 10 years. This particular instance there were only 4 players, but our extended group is near 20.  To put it simply, they will only play weird characters that break the immersion for my self and the other players. An example being a recent pathfinder game where the party consisted of a human gunslinger, human fighter, elf wizard, and a flail snail. It was a one of these things is not like the others situation. No one could really get into the game because of having to imagine this fairly typical group, plus a snail.  There was one instance where one of the players demanded to play an aquatic elf in a land locked campaign. It slowed the group down mechanically when they had to keep finding water. Another example is when the GM was adamant that the campaign he was running was human only, the player still went on to nag the GM to let him play anything from various pixies, plants, and even a swarm. The arguing wound up delaying the campaign from starting for several hours.  I've asked the players why they play these types of characters and they say things along the lines of:   Its too hard to play a humanoid character because there is too much to think about when playing a neurotypical standard humanoid I want to play characters that no one can relate too I like playing with self imposed restrictions in terms of how I act.   We have asked them as a group to play more normal characters and there have been mixed responses from the two. One will keep asking whoever is the DM until they break down and allow something. The other will play a more normal character but is clearly not having fun.  If anyone has had experience with a situation like this, how did you resolve it?


The point of UFD is that element can be factored finitely and uniquely. One non-example is $Z[\sqrt{-5}]$ where there may be non-unique factorization. I wonder if there is any simple example that violates the finiteness requirement, i.e. there is some element that can be factored again and again into non-unit elements.

Exhibit an integral domain $R$ and a non-zero non-unit element of $R$ that is not a product of irreducibles.   My thoughts so far: I don't really have a clue. Could anyone direct me on how to think about this? I'm struggling to get my head round irreducibles.  Thanks.


I am into finding a convincing formula, or at least a rule of thumb, about when to use "to" and when to use "for" after adjectives - such as easy, difficult, important, interesting, and useful - and before personal pronouns and nouns.  I have gone through numerous and different advice by English-speaking people on the "to vs. for" problem for non-English speakers.  There were some cases in which they seemed interchangeable while there were others where they did not. Many people said the issue could be more about a preference or tendency than a rule, thus leaving English learners no choice but to learn them case by case. I came across some advisers who came up with a few rules, some of which I found very helpful while others seemed to contradict one another.   In the following examples, "to" and "for" seem to be interchangeable, and yet slightly different in meaning.   I reason that a marked difference between "to me" and "for me" would be found in whether "me", the narrator, has experienced it, the subject of the sentence, or not.   (A) English is not easy "to me".   This implies that English is not easy "in my view (in the view of the narrator)".  (B) English is not easy "for me".   This implies that English is not easy "in my experience (in the experience of the narrator)".  How does my reasoning sound to you? Any comments will be greatly appreciated.

Which one should be used?      To me, it makes no difference, but I'm not really sure why.   vs     For me, it makes no difference, but I'm not really sure why.


So, I'm writing a mathematics paper, and let's say I have the following:  \begin{equation*} 2+2=4 \end{equation*}   Is this the proper way to do an unnumbered equation, or is it preferred to do the following:  \[ 2+2=4 \]   My question really is: what's the difference between doing \begin{equation*} and \begin{equation*} versus doing \[ \]? Is there a setting in which one may be preferred over the other?  Thanks in advance.

I once learnt, that it is uncool to use $$, but why is that? Why does \[ not act as a abbreviation to \begin{align}? I noticed, that there is a difference, since one cannot use & and \\ inside a block started with \[.


In question :  there is a response :  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  Perhaps a simple example is called for.  Example. In 2D consider a point mass $m$ with position ${\bf r}=(x,y)$ that is constrained to move on a frictionless vertical rod, which in turn has pre-determined horizontal position $$x=f(t),\tag{1}$$ where $f$ is a given function of time $t$. In other words, eq. (1) is a holonomic constraint, and there is one  $q\equiv y$, i.e. one degree of freedom. The constraint force ${\bf F}^{(c)}$ is horizontal. The  $\delta q \equiv\delta y$ are by definition vertical with $\delta t=0$, leading to that the constraint force ${\bf F}^{(c)}$ does no virtual work$^1$  $$ {\bf F}^{(c)} \cdot \delta {\bf r}~=~0.\tag{2} $$ However if we allow $\delta t\neq 0$, then eq. (2) will no longer hold, and this implies that we can no longer derive  from Newton's 2nd law.  --  $^1$It is tempting to call eq. (2) the , but strictly speaking, the principle of virtual work is just d'Alembert's principle for a static system. For d'Alembert's principle, see also  and  related Phys.SE posts.  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  $\boldsymbol {My}$ $\boldsymbol {question}$ is if $\delta t\neq 0$ why will eq. (2) no longer hold?

Why is the  formulated in terms of virtual displacements rather than real displacements in time?  EDIT In other words, which step of the derivation of D'Alembert's principle (or Largrange's equation) will not work if one uses real displacements and why?


In .NET the object type declares a method named GetHashCode() described here:  The article is full of gotchas about where not to use it. And my question isn't really about that. I understand that an Int32 hash code is a destructive algorithm that will quickly run into collisions with a large data set. And furthermore the calculation can change from platform to platform (and in some runtimes from process to process). I assume it is a core part of .NET since it is a member of the object class. What is this method used for? What would break if it went away? Why does it return an Int32 instead of an Int64?

Given the following class  public class Foo {     public int FooId { get; set; }     public string FooName { get; set; }      public override bool Equals(object obj)     {         Foo fooItem = obj as Foo;          if (fooItem == null)          {            return false;         }          return fooItem.FooId == this.FooId;     }      public override int GetHashCode()     {         // Which is preferred?          return base.GetHashCode();          //return this.FooId.GetHashCode();     } }   I have overridden the Equals method because Foo represent a row for the Foos table.  Which is the preferred method for overriding the GetHashCode?  Why is it important to override GetHashCode?


This question has an accepted answer at        I have a PHP file named as otp.php.  When URL in the URL bar is   http://localhost/college/otp/MTA=/teacher   It should be treated as   http://localhost/college/otp.php?user=MTA=&role=teacher   For this, I created .htaccess file in :  RewriteEngine On    # Turn on the rewriting engine RewriteCond %{HTTP_HOST} localhost  [NC] RewriteRule    (.*otp)\/([A-Za-z0-9-]+=)\/([A-Za-z0-9-]+)  $1.php?user=$2&role=$3  [NC,L]   But, otp.php file says:     Notice: Undefined index: role in C:\wamp\www\college\otp.php on line   11      Notice: Undefined index: user in C:\wamp\www\college\otp.php on line   11       Created question here after  Comment.  Two Different Results:

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.


Let $\beta\in[-1,1]$ and let $a_n$ defined by $ \begin{cases} a_1=\beta,  \\ a_{n+1}=\cos(a_n) \end{cases}$      Let $c\in \mathbb{R}$, s.a $\cos(c)=c$.   Prove that: $\lim\limits_{n\to\infty}a_n=c$   My work so far: I know that $c\in(0,1)$.  $|\cos(a_n)-c|=|\cos(a_n)-\cos(c)|=|-2\sin(\frac{a_n+c}{2})\sin(\frac{a_n-c}{2})|\le\frac{1}{2}|a_n+c||a_n-c|$  But I don't know how to continue from here.

Possible Duplicate:         Does the following limit exist?  $$\lim_{n\to\infty}\underset{n}{\underbrace{\cos(\cos(...\cos x))}}$$  If yes, find the limit.  If no, please explain why the limit doesn't exist.  I think, the limit exists.  So, I tried to use Squeeze theorem but didn't work.


I have the following construction with a long list of around 100 if .. elif. Is there a way do handle this more elegantly in python?     if isinstance(scen_dep, Class1):         scen_deps[someEnum.class2].append('1')    elif isinstance(scen_dep, Class2):         scen_deps[someEnum.class2].append('1')    elif isinstance(scen_dep, Class3):         scen_deps[someEnum.class3].append('1')

I want to write a function in Python that returns different fixed values based on the value of an input index.    In other languages I would use a switch or case statement, but Python does not appear to have a switch statement.  What are the recommended Python solutions in this scenario?


I have a confusing regarding the assumption test for the data, in some theory were said that there are three assumption of data as we called as "good" data:   Independent  Normally distributed Homogeneity    my question are: Referring to point (2) and (3),    We said the data is normally distributed, based on the raw data or residual? I have a case when i was conducting the ANOVA analysis, the assumption for ANOVA is normal and homogeneity, what i did until now is to check this through the residual (after i got the model ANOVA), is it true? if those assumption come from raw data not residual, how I can check the homogeneity? bartlett is using residual that I know to check the homogeneity..   thanks..for your input.!

This issue seems to rear its ugly head all the time, and I'm trying to decapitate it for my own understanding of statistics (and sanity!).   The assumptions of general linear models (t-test, ANOVA, regression etc.) include the "assumption of normality", but I have found this is rarely described clearly.   I often come across statistics textbooks / manuals / etc. simply stating that the "assumption of normality" applies to each group (i.e., categorical X variables), and we should we examining departures from normality for each group.   Questions:     does the assumption refer to the values of Y or the residuals of Y?  for a particular group, is it possible to have a strongly non-normal distribution of Y values (e.g., skewed) BUT an approximately (or at least more normal) distribution of residuals of Y?   Other sources describe that the assumption pertains to the residuals of the model (in cases where there are groups, e.g. t-tests / ANOVA), and we should be examining departures of normality of these residuals (i.e., only one Q-Q plot/test to run).  does normality of residuals for the model imply normality of residuals for the groups? In other words, should we just examine the model residuals (contrary to instructions in many texts)?  To put this in a context, consider this hypothetical example:   I want to compare tree height (Y) between two populations (X).   In one population the distribution of Y is strongly right-skewed (i.e., most trees short, very few tall), while the other is virtually normal  Height is higher overall in the normally distributed population (suggesting there may be a 'real' difference). Transformation of the data does not substantially improve the distribution of the first    population.  Firstly, is it valid to compare the groups given the radically different height distributions? How do I approach the "assumption of normality" here? Recall height in one population is not normally distributed. Do I examine residuals for both populations separately OR residuals for the model (t-test)?     Please refer to questions by number in replies, experience has shown me people get lost or sidetracked easily (especially me!). Keep in mind I am not a statistician; though I have a reasonably conceptual (i.e., not technical!) understanding of statistics.  P.S., I have searched the archives and read the following threads which have not cemented my understanding:


Similar to   But still not quite the same as it's not just for small values.  >> a = 1234; b = 1234; id(a); id(b); a is b 9447736 9447736 True >>> a = 1234 >>> id(a) 9447616 >>> b = 1234 >>> id(b) 9447688 >>> a is b False >>> a = "abcd"; b = "abcd"; id(a); id(b); a is b 140282436530560 140282436530560 True >>> a = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; b = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; id(a); id(b); a is b 140282436951600 140282436951600 True >>> a = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; b = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; id(a); id(b); len(a); a is b 140282436951600 140282436951600 74 True >>> a = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; b = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; id(a); id(b); len(a); a is b 140282436951600 140282436951600 74 True >>>

Why does the following behave unexpectedly in Python?  >>> a = 256 >>> b = 256 >>> a is b True           # This is an expected result >>> a = 257 >>> b = 257 >>> a is b False          # What happened here? Why is this False? >>> 257 is 257 True           # Yet the literal numbers compare properly   I am using Python 2.5.2. Trying some different versions of Python, it appears that Python 2.3.3 shows the above behaviour between 99 and 100.  Based on the above, I can hypothesize that Python is internally implemented such that "small" integers are stored in a different way than larger integers and the is operator can tell the difference. Why the leaky abstraction? What is a better way of comparing two arbitrary objects to see whether they are the same when I don't know in advance whether they are numbers or not?


Elite U.S. universities are known to have affirmative action policies based on race and sex (and maybe religion?), in an effort to promote diversity.  I wonder how they can classify applicants based on race, given that it is sometimes difficult to clearly identify or prove one's race.  Is there a checkbox dedicated to race on an application form? For example, can a child of an Asian mother and a black farther choose to be categorized as black so as to improve the chance of admission?  I am asking these questions purely out of curiosity because I was born, raised and educated in Japan, a rather homogeneous society where no official records on race are kept.  I wonder the U.S. registry keeps residents' races, so it is relatively easy for Americans to obtain official documents proving their races.  As for religion, I guess it is even more difficult to obtain official documents. So, do applicants discretionally select their religions without the need to prove it, or does the U.S. government have religious records on its citizens? If applicants are free to choose, some unscrupulous individuals can choose a minority religion that gives a better chance, regardless of their true faith?  I have no idea about international applicants. Outside the U.S., it is very difficult and sometime impossible to officially prove one's race or religion, so the U.S. college admissions committee considers nationality only in the screening process?  I have no plan to apply for a U.S. university or have no interest in ideological stuff. But I would like to know practical aspects of affirmative action in American universities.

As an example, let's say someone with 1/16 of African American heritage applies for a minority scholarship and claims themselves as African American. Would they be rejected, all other factors being equal? If so, do universities generally publish a guideline of what constitutes a particular race in the context of scholarship applications or college admissions?  Note that this question is of practical value as there are presumably millions of people of mixed heritage living in the US at the moment.


How I can remove an account in my Thunderbird? I have Thunderbird 17.0.8.

I was unable to find the "Delete account" button in Thunderbird on Ubuntu 12.04. Saw posts saying that I can find it at the bottom left side, but could not find it. Please help me find that button.


I do have some piece of code, I find unfathomable to comprehend. I save a longer string in a variable and then try to find a specific piece of string inside of it. The clue is that I can output the various substrings, but it will not find the specific string and stop the process...  The code goes like this:  import java.io.*; import java.util.*;  public class Readin {      public static void main(String[] args) {          String specChar = "DISD";         String gen = "MLRVFILYAENVHTPDTDISDAYCSAVFAGVKKRTKVIKNSVNP";          for (int i = 0; i < gen.length() - 3; i++) {             char char1 = gen.charAt(i);             char char2 = gen.charAt(i + 1);             char char3 = gen.charAt(i + 2);             char char4 = gen.charAt(i + 3);              String concatChar = new StringBuilder().append(char1).append(char2).append(char3).append(char4).toString();             System.out.println(concatChar);              if (specChar == concatChar) {                 System.out.println(specChar);                 break;             } else {                 System.out.println("Error");             }         }     } }

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