I am trying to fetch some data on my android validation using Facebook API. I am able to login into my facebook account. This is the permission I have set to fetch data from Facebook account  loginButton.setReadPermissions(Arrays.asList( "public_profile", "email", "user_birthday", "user_friends"));   using the above permissions I am trying to fetch profile name and other data I am getting a null pointer exception with the below code snippet  public void getFacebookData(AccessToken accessToken, Profile profile) {         System.out.println("---------------------");         System.out.println("--Facebook Login Successful!");         System.out.println("--Logged in user Details : ");         System.out.println("---------------------");         System.out.println("--User ID : " + accessToken.getUserId());         System.out.println("--Authentication Token : " + accessToken.getToken());         System.out.println("---------------------");         System.out.println("--First Name : " + profile.getFirstName());         System.out.println("--Last Name : " + profile.getLastName());         System.out.println("--URL Perfil: " + profile.getLinkUri());         System.out.println("--URL Imagem: " + profile.getProfilePictureUri(500, 500));         System.out.println("---------------------");         System.out.println("--ID : " + profile.getId());         System.out.println("--Name : " + profile.getName());         System.out.println("---------------------");          TextView profile_name = (TextView)findViewById(R.id.profile);         profile_name.setText(profile.getName());   Please, what be wrong with the approach I am using.
What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?
I would like site specific magic links. Currently you can write [so] in a comment, and it links like this: . I would like to be able to have site specific ones, so for example: English Language &amp; Usage  [dictionary] would go to http://dictionary.com and shows as   Ubuntu  [launchpad] would go to https://launchpad.net/ubuntu and shows as   [launchpad#bugnum] would go to https://bugs.launchpad.net/bugs/bugnum and shows as   [forums] would go to http://ubuntuforums.org/ and sows as   [discourse] would go to http://discourse.ubuntu.com and shows as   [paste] or [pastebinit] would go to http://paste.ubuntu.com and shows as   [install-d] would go to http://ubuntu.com/download/desktop/install-ubuntu-desktop and shows as   [install-s] would go to http://ubuntu.com/download/server/install-ubuntu-server and shows as   ppa:peterlevi/ppa would go to https://launchpad.net/~peterlevi and shows as   There is    Ask Different  [applesup] would go to http://www.apple.com/support and shows as   Christianity  [bible] would go to http://biblegateway.com and shows as   Currently, they are all the same, for all sites. I would like devs (mods maybe) to be able to add them on a per site basis. This is just a selection of examples. People can comment or answer with ones they would like and I'll edit them into this question. I asked this because  on Ask Ubuntu Meta wasn't possible right now - because it wasn't a feature.  [The devs] said right now it isn't possible because magic links are network wide, and they weren't sure it was high enough priority to really get done anytime soon, but if you want you can post a feature-request on Meta Stack Exchange requesting site specific magic links and see if you can garner more support for the feature and maybe get a dev to champion it.  So that's what I've done! I posted this at  and got redirected here. This does indeed look like a better place to ask.  I would like to decorate my headlines (section, subsection, etc.) by adding a background color. I would like this box filled with a single solid color to span across the entire typearea.  This picture is a screenshot of an OpenOffice document where the headline has the formating, layout and color I want.    Requirements on a solution   The resulting style is supposed to be used by others, meaning an equivalent latex output to the picture above shall be created by this code:  Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text   \subsubsection{This is a headline}  Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text Some Text  If the section is supposed to be unnumbered one should be using \subsubsection*. LaTeX still needs to be in charge of the whitespace between paragraphs and the blue box.   What I have tried so far  As far as I can google the headline together with the section numbering are a simple paragraph. Latex adds some skips before and after and squeezes in a few commands that modify the font(s).  My ideas revolve around locking this paragraph in a \colorbox. The colorbox macro works like this: \colorbox{color}{the content around which to draw a box filled with the specified color}. My problem is I can't get a grasp on this paragraph.  The easy 80%  My work is based on koma-script and by redefining \othersectionlevelsformat and \(sub)*section. I can draw two boxes, one surrounding the section numbering and another surrounding the section title. However this has 3 open issues:   the upper edges of the boxes are unaligned and the box with the title is slightly larger than the line with the numbering The box around the title does not strech to the right end of the typearea the box around the numbering doesn't grow if the title spans multiple lines (no surprise here)   The hard 20%  I tried to make latex put the section numbering into a \savebox I could access later and put as part of the title. That would eliminate the need for two boxes and solve all three of my problems at once, but that doesn't work. I only get to modify the title before the actual numbering is done. So while I can put the numbering into a savebox, I can't do anything with it until it's too late.  I tried putting the \section ... statement into a colorbox, but it doesn't like that and the document fails to compile with ! LaTeX Error: Something's wrong--perhaps a missing \item. The same holds for saveboxes. I guess colorbox uses those.  I tried putting the \section ... statement in a minipage and put a box around that. This has two issues. 1st: latex doesn't put any empty space above a section. 2nd: not only the section numbering and title have the background but also the empty space between section title and first paragraph.  So how can one hack latex to do a section title formating as shown in the screenshot above? Is a hash a zero-knowledge proof? I’m trying to wrap my head around zero knowledge proofs, but I’m having trouble understanding it.  In my current understanding, zero-knowledge proofs prove to the recipient that the sender has a certain knowledge without disclosing it. Like trying to say your password without actually giving it.  Many sources go at it with a convoluted method like a tunnel where there’s a hidden gate, and Bob is trying to know if Alice can go through the hidden gate. But then it starts saying that Bob should not see Alice enter. Wouldn’t it be easier for Bob to just see Alice go in one tunnel and come out the other? That would not disclose the secret way of opening the tunnel, right?  In that line of thinking, given a one-way function like a hash, couldn’t the other person just hash their secret and let the other see that the hashes compare?  I must be missing something (as there’s a lot of research going into it and hashes are well-known), but I can’t wrap my head around it.  Can someone tell me what’s wrong with my understanding of zero knowledge proofs? Why does the natural ring homomorphism induce a surjective group homomorphism of units? I'm trying an old problem here:   Suppose $n\mid m$, and I have a natural ring homomorphism $\varphi\colon \mathbb{Z}/m\mathbb{Z}\to\mathbb{Z}/n\mathbb{Z}$ defined by $\varphi(j)=j\mod{n}$. I can verify that this is a ring homomorphism, but why does it induce a surjective group homomorphism on the unit groups $(\mathbb{Z}/m\mathbb{Z})^\times\to(\mathbb{Z}/n\mathbb{Z})^\times$?  My question in particular is why is it surjective? I take $k\in(\mathbb{Z}/n\mathbb{Z})^\times$. Then there exist integers $s,t$ such that $sn+tk=1$. Since $n\mid m$, I can also write $m=na$. So multiplying through I get $sm+tka=a$. I'm lost here. How can I find a unit in $(\mathbb{Z}/m\mathbb{Z})^\times$ which maps to $k$ to show surjectivity? When does Bleeding Attack effect apply? I've designed for a campaign a duo of rogues. My character is as , and his follower is a Knife Mistress. Couple of question about them. Our party is about to ambush several . My Sniper will hide near their camp, and shoot the weakest one when fight begins. His follower will then rush the troll and slice him in several pieces. My Sniper has the Bleeding attack feat:  Bleeding Attack (Ex) Benefit: A rogue with this ability can cause living opponents to  by hitting them with a sneak attack. This attack causes the target to take 1 additional point of damage each round for each die of the rogue's sneak attack (e.g., 4d6 equals 4 points of bleed). Bleeding creatures take that amount of damage every round at the start of each of their turns. The bleeding can be stopped by a DC 15 Heal check or the application of any effect that heals hit point damage.  Emphasis mine. Thus, a normal enemy would bleed every turn, until he get cleaned of the bleeding effect. However, troll have a special ability, which is  5 (acid/fire)  Regeneration (Ex) A creature with this ability is difficult to kill. Creatures with regeneration heal damage at a fixed rate, as with , but they cannot die as long as their regeneration is still functioning (although creatures with regeneration still fall unconscious when their hit points are below 0). Certain attack forms, typically fire and acid, cause a creature’s regeneration to stop functioning on the round following the attack. During this round, the creature does not heal any damage and can die normally. The creature's descriptive text describes the types of damage that cause the regeneration to cease functioning.  So, the troll will automatically get rid of the bleeding effect during his first turn. My question is: Does the bleeding effect apply before the regeneration, or get neglected, because the troll will heal during his turn? Am I right to assume that, Bleeding attack effect getting triggered at the beginning of the troll turn, it will deal him the damages before the wounds heals? Considering the irreducible (by condition) polynomial $f=X^4-2aX^2+b\in\mathbb Q[X]$ and the field extension $K=\mathbb Q(\sqrt{a^2-b})$ of $\mathbb Q$, I want to show the following result:    For $[L:\mathbb Q]=4$ we have $\sqrt b\in K$ where $L$ is the splitting field of $f$.   My thoughts so far: The four roots of $f$ are $\pm\sqrt{a\pm\sqrt{a^2-b}}$. If $L$ is of degree $4$ it must be primitive since $f$ is irreducible, so $L=\mathbb Q\left(\sqrt{a+\sqrt{a^2-b}}\right)$. Then, by multiplying the two roots $\sqrt{a+\sqrt{a^{2}-b}}\cdot\sqrt{a-\sqrt{a^{2}-b}}=\sqrt{b}$ we have that $\sqrt{b}\in L$. Now I want to look at $$\mathbb Q\subset K\subset K(\sqrt b)\subset L$$ and differentiate some cases. The case where $[L:K]=1$ is trivial and the case $[L:K]=4$ can't happen because if we square any root and subtract $a$, we get $\pm\sqrt{a^2-b}\in K$ which means $[L:K]\leq 2$. So let's look at the case where $[L:K]=2$. As I see it, we get two subcases:   For $[L:K(\sqrt b)]=2$ we have $K(\sqrt b)=K$ which finishes the proof. For $[L:K(\sqrt b)]=1$ we have $K(\sqrt b)=L$. This means that $L$ is also the splitting field of $(x^2-b)(x^2-(a^2-b))$. Is this a contradiction? How do I finish this case? Limit of $2^{1/n}$ as $n\to\infty$ is 1 How do I prove that:   $\lim \limits_{n\to \infty}2^{1/n}=1$  Thank you very much. sed fails with "unknown option to `s'" error I have been wondering why anyone ever thought that we could find an expansion for eigenstates of some perturbed Hamiltonian in terms fo those for the basis Hamiltonian. My lecturer insisted that this was because the eigenstates of the Hamiltonian are complete', however from my (limited) understanding of the mathematical basis of QM:   When you are given a Hamiltonian, it comes with the Hilbert space of functions of which it acts (subject to some conditions we impose, such as the Lebesgue square-integrability of functions) When you are given another Hamiltonian, there is no guarantee that it will act on the same Hilbert space Therefore, that the zeroth order Hamiltonian has eigenstates forming a complete basis for the space on which ti acts does not guarantee that these same eignestates form a complete basis for the Hilbert space on which the purturbed Hamiltonian acts.   As a simple example. I can imagine adding a small perturbing magnetic field to a Hamiltonian in which there initially is none, such that we lose the degeneracy in the eigenstates accounting for different spins of a particle. One could say that we have the same Hilbert space before and after but we lose degeneracy; or I would have been tempted to say that our initial Hilbert space did not have these extra dimensions corresponding to the spin states. So rather than the eigenstates of the basis Hamiltonian also forming a complete basis for the purtubed Hamiltonian, but having eigenvalue degeneracy which is lifted on the purtubration, I would have said that our Hilbert space has changed. After all, if we take the former view (i.e. a basis accouting for spin but with degeneracy) then it seems like for any problem we would need to know and account for EVERY possible system property that can be discerned. This doesn't seem reasonable to me....  NOTE:  1) My question was asked here previously:   although there is only a discussion and no conclusive answer given. I see that the distinction is important in relativistic QM, and the case of adding a potential onto a free particle Hamiltonian seems to be a special one. Although I am still not sure what the answer is for general purturbations.  2) Similar question here:   but it seems to completely avoid answering the question. Determine the exact value of equations involving more two trig variables $2\cos^2x=1+\sin x$.  Determine the exact values of $x$ such that $0 \leq x \leq 2\pi$.    I am experiencing problems with factoring this question.  First I started by getting everything on to the left side so: $2\cos^2x-\sin x-1=0$.  Then seeing as there are two trig variable here ($\cos$ and $\sin$), I used the pythagorean identity and replaced $2\cos^2x$ with $1-2\sin^2x$ to make it into a one variable question: $1-1-2\sin^2x-\sin x-1=0$.   By collecting like terms it then becomes $-\sin^2x-\sin x=0$.  Now you could factor these with $0$ and $-1$, but then it creates uneven brackets so this musn't work.  I don't think the quadratic formula is necessary, but I am wondering if this could be treated as a difference of squares question.    If you replace the $\sin x$ and make the question into $-x^2-x=0$ it is a little easier to look at, however I am not sure if this is the right approach.  If someone could please clarify my answer, that would be appreciated! Can the Help action be used to give advantage to a specific ally's attack (rather than just the next ally who attacks the target)? The Order of Modification in English Nouns, Preceding or Succeeding? As I don't know the exact linguistic terms, what I mean my "preceding" and "succeeding" in modifying nouns is as follows.  Preceding : delicious food, long way, kind person, et cetera Succeeding : faculty of science, land of despair, a book that changed my mind, et cetera  English seems to accept both ways of modification.  Sometimes, either way will not make a difference. department of science == science department a burning book == a book burning  At other times, changing the order will still make sense but be somewhat awkward or bizarre. Kentucky Fried Chicken ?= Chicken Fried in Kentucky free as in free speech ?= as-in-free-speech free  When writing English, I tend to use more the preceding modification style because my native language Korean is quite strictly precedingly modifying. "빠른 판단을 바탕으로 한 재치있는 응수" directly translates to "a quick-decision-based clever response" rather than "a clever response based on a quick decision"  French as well as other Latin-originated languages seems to be succeedingly modifying. Académie Française, Poulet Frit du Kentucky  while German and Dutch more often use preceding modification.  Well, this mixture in English allows rich style with various ways of expression, but it does often make a non-native English speaker be a little confused. Is there any subtle but general difference between these 2 ways? Or is it just simply case-by-case. Any guidance will help. In the previous version the logout button is under your username, which it can be found by clicking the down arrow. However, in the new version, after a couple minutes of searching, it is under the "site-switcher" button:        This is really illogical since the logout button is usually under your username, including Google and Yahoo! services.  I suggest bringing back the  which will definitely benefit new users and even old users. Why do we use Root Mean Square (RMS) values when talking about AC voltage What makes it a good idea to use RMS rather than peak values of current and voltage when we talk about or compute with AC signals. Correct way of mounting a Windows share I mounted a Windows share to my Ubuntu 11.10 system via adding the following line to the /etc/fstab:  //serveraddr/sharedfolder /mnt/foldername/ smbfs credentials=/home/myname/.smbpasswd 0 0  using the .  But there's a problem with the permissions. The owner of the mount folder is root. I can not create any folders or files in the mounted point is I don't become the root. Even I can not change the ownership to my default user via   sudo chown -R myname .  I googled and saw that it might stem from the fact that Windows file formats (fat32/ntfs) can not save ownership. But when I connect to the same location via samba as   smb://serveraddr/sharedfolder  by providing my credentials, I have the privileges to write without being the root.  How can I make it to let me write to the mounted folder? Cat 5/6 in same conduit as power: is NM-B required, or is THHN acceptable? Preface: I'd like to avoid the question of whether one should run data and power together; my question is focused on Code compliance.  I'm trying to ensure I interpret Code correctly when running Cat 5/6 cabling and power together in the same conduit.  For starters, I understand that nothing in Code prohibits one from doing this; I'm trying to ensure I understand how to do it properly.  I'm wiring a basement office for power and data, and I'll be running the electrical in EMT.  My plan was to pull THHN for the power rather than pull NM-B, but then 800.133(2) Exception 1 made me scratch my head.  Is my understanding of the Article that if I want to run both data (Cat6) and power in the same conduit, that the power needs to be sheathed (i.e. NM-B).  Is it unacceptable to pull individual THHN conductors and the Cat6 together in the same conduit?     800.133 2) Other Applications. Communications wires and cables shall be separated at least 50 mm (2 in.) from conductors of any electric   light, power, Class 1, non–power-limited fire alarm, or medium-power   network-powered broadband communications circuits.      Exception No. 1: Where either (1) all of the conductors of the   electric light, power, Class 1, non–power-limited fire alarm, and   medium-power network-powered broadband communications circuits are in   a raceway or in metal-sheathed, metal-clad, nonmetallic-sheathed, Type   AC, or Type UF cables, or (2) all of the conductors of communications   circuits are encased in raceway. How do snaps work exactly and why are they mounted? Recently I started learning more about snap packages and what intrigued me was that snap packages are mounted together with their own file system and dependencies (correct me if I'm wrong). Now, with all the great things that snaps bring to the table, what I'd like to know is:  Are snap packages always going to be mounted? This seems kind of awkward, since they appear in places like lsblk and give the impression of not being well integrated into my system.   Also, could they ever replace .deb and .rpm packages completely, or are they a different type of animal and are only complementary to .deb and.rpm packages?  As a side-note, I noticed that some applications are so self-contained that they don't respect any of my desktop settings like the mouse cursor theme or icon and menu themes. What is the difference between "thee" and "thou"? Rules of thumb for divisibility Given a number presented in decimal form $n=\sum_{k=0} d_k10^k$ there are some nice thumb rules to decide whether it is divisible with a prime number  $p\in\{7,11,13,17,19,23,29\}$.   For each of this numbers there is a number  $a_p$ such that $p|n\iff p|(a_p\cdot d_0+\sum_{k=0} d_{k+1}10^k)$.  $a_7=-2,\;a_{11}=-1,\;a_{13}=4,\;a_{17}=-5,\;a_{19}=2,\;a_{23}=7,\;a_{29}=3$  E.g. $\;19\cdot 17=323$ and $32+2\cdot 3=38=2\cdot 19$ and $32-5\cdot 3=17$.  Is there a number $a_{31}$ that works the same way? Or $a_p,\;p\ge37$? Does JavaScript have the interface type (such as Java's 'interface')?