this is the first time I ask question here. I'm working on an rather small project that implement web chat using jsp and servlet. But I encounter a problem. I set an attribute in servletcontext using this   if(sc.getAttribute("queue")==null)  //sc is servletcontext     {           sc.setAttribute("queue", new       TreeMap&lt;String,LinkedList&lt;TreeMap&lt;String,String&gt;&gt;&gt;());     }   then I create a map in the attribute by this  if(sn.getAttribute(sn.getId())==null) //sn is a HttpSession object     {         //store nickname         sn.setAttribute(sn.getId(),request.getParameter("nickname"));          //store the new entry in Context         sc.setAttribute("queue",((TreeMap&lt;String,LinkedList&lt;TreeMap&lt;String,String&gt;&gt;&gt;)sc.getAttribute("queue")).put(sn.getId(),new LinkedList&lt;TreeMap&lt;String,String&gt;&gt;()));     }   I know the code isn't so elegant. It's my first time to really work on a project. The important thing now is that it can work.  All above is in my servlet file. Next I want to call a function which has the format as this “public static TreeMap>> messagePut(ServletContext sc)”     public static TreeMap>> messagePut(ServletContext sc)   Sorry there is some problem in the dispaly of the TreeMap, please see the concrete code above.  The discreet implementation is   public static TreeMap&lt;String,LinkedList&lt;TreeMap&lt;String,String&gt;&gt;&gt; messagePut(ServletContext sc) {     //obtain message queue             TreeMap&lt;String, LinkedList&lt;TreeMap&lt;String,String&gt;&gt;&gt; temp=(TreeMap&lt;String, LinkedList&lt;TreeMap&lt;String, String&gt;&gt;&gt;)(sc.getAttribute("queue"));              //iterate             Set&lt;String&gt; keset=temp.keySet();             Iterator&lt;String&gt; it=keset.iterator();                TreeMap&lt;String,LinkedList&lt;TreeMap&lt;String,String&gt;&gt;&gt; mm=((TreeMap&lt;String,LinkedList&lt;TreeMap&lt;String,String&gt;&gt;&gt;)sc.getAttribute("queue"));              //object store stores a reproduce of the whole message queue             TreeMap&lt;String,LinkedList&lt;TreeMap&lt;String,String&gt;&gt;&gt; store=(TreeMap&lt;String,LinkedList&lt;TreeMap&lt;String,String&gt;&gt;&gt;)sc.getAttribute("queue");             while(it.hasNext())             {                  //put the message into queue                 //temp2 is user nickname                 String temp2=(String)it.next();                 if(temp2.equals(name))                     continue;                 else                 {                     TreeMap&lt;String,String&gt; c2=new TreeMap&lt;String,String&gt;();                     c2.put(name,message);                     LinkedList&lt;TreeMap&lt;String,String&gt;&gt; c3=store.get(temp2);                     c3.add(c2);                     store.put(temp2,c3);                 }              }              return store; }   I got a NullPointer exception in the above, this statement:  Set&lt;String&gt; keset=temp.keySet();   throw a nullpointer exception, I don't know why. But I have some doubt about this statement :  sc.setAttribute("queue",((TreeMap&lt;String,LinkedList&lt;TreeMap&lt;String,String&gt;&gt;&gt;)sc.getAttribute("queue")).put(sn.getId(),new LinkedList&lt;TreeMap&lt;String,String&gt;&gt;()));   TreeMap&gt;&gt; is TreeMap&lt;String,LinkedList&lt;TreeMap&lt;String,String&gt;&gt;&gt;. I don't know whether this statement is correct.
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?
$\operatorname{arsinh}$ vs $\operatorname{arcsinh}$ I note that some people like to write the inverse hyperbolic functions not with the prefix "arc" (like regular inverse trigonometric functions), but rather "ar".  This is because the prefix "arc" (for arcus) is misleading, because unlike regular trigonometric functions, they are not used to find lengths (inverse trigonometric functions can be used to find arc length of ellipses like $x^2+y^2=1$) but rather find area of a sector of the unit hyperbola.  Which version should be preferred?  $\operatorname{arsinh}$ initially confused me as I did not know why "ar" was used.  However, some seem to prefer this notation as it is more of an accurate description of the function. I need a regular expression to select all the text between two outer brackets.  Example: some text(text here(possible text)text(possible text(more text)))end text  Result: (text here(possible text)text(possible text(more text))) I have encountered a statement in Lang's Algebra (Revised Third Edition, page 53) concerning morphisms of objects that seems strange to me: "In practice, in this book we shall see that most of our morphisms are actually mappings, or closely related to mappings."  I have always been under the impression that the terms 'mapping' and 'morphism' are synonymous in the context of categories. Perhaps it is just the case that Lang defines the two in a way that they disagree, but I can't find such an instance. Are they in fact different? If so, what is an example of a morphism that is not a mapping? What is the correct way to get a pgfkey value? How to select more layers with GIMP? In Adobe Photoshop I am able to select multiple layers at once with Shift+Click.  How can I do that in GIMP? A site URL changed and now its icon in SEDE is broken Stopping resetting of linked locators in manipulate Can photons be detected without being absorbed? I am thinking about a detector that would beep if light passes through it. Is it possible? Traffic (views, visits) is not correctly registered on Site Analytics or Area 51 How to know the usage of undocumented function like LinearAlgebra`BLAS? Are there idioms or expressions in English that describe going from one bad situation to one that's even worse?  I heard "between a rock and hard place" but this describes a dilemma not really a transition. I am looking for an expression that describes someone trying to get out of a bad situation but after much effort, the situation only got worse. Filter bibliography by author? I would like to create a template for a publication list that can then be used by several people. The idea is that there is one bib-file which contains all of the publications. Peer-reviewed entries are marked with the keyword = pr. Then there is the master-file of the type scriptreport in which everyone can integrate their chapter-file in order to merge the publication lists of everybody into one file. The chapter file is the core of everything and should be reusable. It should filter out the entries for the respective author from the bib file and print them out in two lists (peer-reviewed and non-peer-reviewed). My problem is that I don't really know how to filter by author in this case. Here are the rough codes of the two files: Master: \documentclass[a4paper]{scrreprt}  \usepackage{biblatex}  \title{Publication list}  \addbibresource{sample.bib}  \begin{document}     \maketitle          \tableofcontents     \newpage          \include{Researcher}     \newpage \end{document}  chapter: \chapter*{Researcher} \addcontentsline{toc}{chapter}{Researcher}          \nocite{*}     \printbibliography[keyword={pr}, title={Peer-reviewed}]          \nocite{*}     \printbibliography[notkeyword={pr}, title={Non-peer-reviewed}] Opt in "mentor" privilege at 7.5k I am suggesting a Mentor privilege at 7.5k. It would be on a per-user per-site opt in basis.  At some reputation level (perhaps 7.5k) there could be an opt in "mentor" privilege.  If someone opts in then when a new user signs up, they become their Mentor. The new user is the Mentee.  They will get notified of any posts or suggested edits they make, and can help and support them.  While this would by no means help everyone (I'm sure there are more new people signing up than there are 7.5k people willing to help them), it could help mitigate the "new user's bad posts" and such like.  By no means would being someone's mentor mean you are the only person who can edit and help them, and you aren't obliged to do so - but if you have opted in then you should help.  How would this work?   Any Mentor would have no more than 5 active Mentees at once. Once the Mentee gets to 125 rep, the downvote privilege (or any other level deemed sensible) they are no longer a Mentee. If they aren't active for a month, they are no longer a Mentee. If the Mentor has 5 Mentees (i.e. cannot mentor anyone else) then any Mentee not active for 2 weeks is no longer a Mentee. The Mentee can opt out at any time, the Mentor can opt out, but if they opt out a lot (say 5 people in 2 months) they are blocked from the privilege for 2 weeks. The Mentor gets no extra rep. They can still get rep from answering their Mentee's questions and similar. Once the new user gets 20 rep on the site, a chat room is created for them to talk. No user with the association bonus will become a Mentee. This would (maybe) be opt in for sites. For example, this might not be at all useful for this site, or for , but on  or  I imagine this could be quite good.    appears to be asking the same thing, based on the title, but that is asking about people who know each other offline mentoring each other.    Every single one of these suggestions (especially the numbers) is open to discussion. Maybe 125 is to low to stop being mentored, or maybe it's too high. What do you think? The site still thinks it's attached to Stack Overflow Convert a character digit to the corresponding integer in C function customization_form_user_register_form_alter(&amp;$form, &amp;$form_state, $form_id) {  $form['account']['pass']['#attributes']['placeholder'] = t('Password'); }   I am trying to set placeholder on password field in registration form.  I seted placeholder on username and email, but on password field won't work...  Any help? Thank you! In the biblatex doc, it says ( Version 1.7, p.11):     thesis      A thesis written for an educational institution to satisfy the   requirements for a degree. Use the type field to specify the type of   thesis.      Required fields: author, title, type, institution, year/date      Optional fields: subtitle, titleaddon, language, note, location,   month, isbn, chapter, pages, pagetotal, addendum, pubstate, doi,   eprint, eprintclass, eprinttype, url, urldate   I would like to know if there is any "canonical" way to add the name of the supervisor(s) in a field of the .bib file (no .bbl manipulation please, I want my bibliography to be usable "as it" in several documents).  The expect result could be something like  :     Meand Myself. “A brilliant result, explained”. PhD thesis**, under the   joint supervision of Pr. Toto and Pr. Tata**. Université Paris 24,   Nov. 2013.   The "under the (joint) supervision" could be a string that would be declined in four ways:   under the supervision of  under the joint supervision of and the abridged forms I am from Nigeria and I'm doing a one year Internship program with The Marriott hotel in Wisconsin, I applied for the UK visitor visa two weeks ago to visit my fiance who lives and work in the UK, but I was refused the visa because the letter of my workplace that I provided was back dated of 2014 which they say they are not satisfy it accurately reflects my current employment circumstance. I also provided my pay slips, but they said they were not satisfied with it demonstrating the terms and conditions of my employment, and they also said I did not present any evidence to satisfy me having sufficiently strong ties and commitments in my country of habitual residence or elsewhere to motivate my timely departure from the UK. They said the documents my fiance presented were OK.  How soon can I re-apply for a UK visa after getting a refusal? resizing a BUTTON through CSS How does a wavefunction collapse into one state? More specifically, what conditions cause a wavefunction for a quantum particle to collapse?    Does this have to do with density matrices?    Please try to give a mathematical explanation that is simple and concise...