BFS method show nullpointerexception repeatly in my homework i must embody Bfs and Edge method in BFS method  i must use queue to memory visited edge in Edge method i must store arraymatrix if i input , it shows nullpointerexception void Bfs(int v) {      Queue&lt;Integer&gt; q = new LinkedList&lt;&gt;();          q.add(v);     for(int i=0;i&lt;numofnodes;i++) {         visited[i]=false;     }     visited[v] = true;           while(!q.isEmpty()){             int temp = q.poll();             System.out.print(temp + &quot; &quot;);                          for(int j = 0; j &lt;numofnodes; j++){                 if(AdjMatrix[temp][j] == 1 &amp;&amp; visited[j]==false){                                        q.add(j);                                            visited[j]= true;                                 }                 }                            } }     void Edge(int n1, int n2) {      AdjMatrix[n1][n2]=1;     AdjMatrix[n2][n1]=1; }  java.lang.NullPointerException  i 5 e 0 1 e 0 3 e 1 2 e 1 4 e 2 3 e 3 4 bfs 0 0 1 3 2 4
What is a NullPointerException, and how do I fix it? 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?
How to only substitute lines that match several patterns in sed? $ echo -e 'CH12\nCH23au' | sed '/^CH/s=^=&lt;b&gt;=' &lt;b&gt;CH12 &lt;b&gt;CH23au   I know I can match lines starting with CH by ^CH but how can I match multiple patterns?   Example:  Input:  CH12 CH23au   Output:  CH12 &lt;b&gt;CH23au   How to only put &lt;b&gt; where there is ^CH and au in the line? What is an example of pairwise independent random variables which are not independent? I've just read in a stochastics textbook:     Let $(\Omega, P)$ be a discrete probability space.      (a) The events $A_i \subseteq \Omega, i=1,2, \dots$ are called independent, if   $$P(A_{i_1} \cap A_{i_2} \cap \dots \cap A_{i_k}) = P(A_{i_1}) \cdot \dots \cdot A_{i_k}$$   for all finite sets $\{i_1, \dots, i_k\} \subsetneq \{1,2, \dots\}$ and all $k \geq 2$.      (b) The events $A_i \subseteq \Omega, i=1,2,\dots$ are called pairwise independent, if   $$P(A_{i_1} \cap A_{i_2}) = P(A_{i_1}) \cdot P(A_{i_2})$$   for all pairs $\{i_1, i_2\} \subsetneq \{1,2,\dots\}$.   After these two definitions it states that pairwise independent events are not always independent.  Do you have an example? At the end of every day you will be required to write a review.   At the end of each day you will be required to write a review.   Which one of those sentences is better if this action will repeat itself every day for longer period of time, several weeks for example, maybe even months? Why is it "description" but "describe" (b and p)? I've just wondered by it is "description", but "to describe". It looks as if "to descripe" would be a more consistant choice. Is there any other explanation besides "this is how it is written for years"?  edit: Or alternatively "to describe" and "describtion". I have a quick question. Looking at the next GIF that I made, what is the quickier way you can come up with to delete the excess material that goes beyond the wall? It is basically the attachment of the handrail to the wall what is giving me this "problem".    My solution would be using the boolean modifier with a cube or something, so obviously I know how to do it. But I'm looking for the best solution, i.e., does Blender let me select the excess material in any way? For example, is there a quick way to intersect those planes? I read about intersecting planes in Blender and seems like a difficult task (not worth it in this case). So I discarded that solution.  Thanks. Cropping Shapefiles in QGIS? Was Louis stalked days in advance too? Is it shell portable to run a command on the same line after variable assignment? Is there any standard that covers the portability of running a command after variable assignment on the same line?  APPLE="cider" echo hi   How portable is something like that? Where will it work and where won't it?   Also: my shell scripts start with #!/bin/sh if that makes any difference. Proving the so-called "Well Ordering Principle" What are the pros and cons of adding a vapor barrier behind shower backer board? After much research, I have a lot of conflicting advise about the need to add a vapor barrier before installing the backer (hardy / cement) board for my bathroom shower. The &quot;expert&quot; at Home Depot, and  seem to think this is a very good idea, and even suggest sealing it with roofing tape.  (The guy on Youtube tapes it directly to the sill of tub.) However, when I asked about the tape and how far down I should go at Lowes, they told me they'd never hear of anyone doing that, and that it didn't seem like a good idea.   Likewise,  putting down caulking on the sill before applying the backer board, and then again after before adding tile, and then caulking a 3rd time under the tiles before grouting. Should I add a vapor barrier between the frame and the cement board?  Why or why not? Can I reduce the MAC size in TLS? The MAC size is reduced to 80 bits in  , which says "forging of MAC values cannot be done off-line: in TLS, a single failed MAC guess will cause the immediate termination of the TLS session."  Question 1 (main question): So can I reduce MAC size to something even smaller, say 32 bits?  Question 2: The truncated_hmac extension does not effect AEAD. Can I reduce the tag's size in AEAD, e.g. GCM or CHACHA-POLY? Adding Multiple Maps in QGIS Composer? I have a desktop (Ubuntu 13.04 &amp; Win 7 Home Premium) and a Laptop (Ubuntu 12.04), both having WiFi adapters. I also have a WiFi router connected to internet which both my computers can access.  I want to share files between my desktop and my laptop using WiFi (similar to Homegroup on Windows 7 but without using Ethernet cables).  How do I set-up that?  I want to share files using both OSs, if anyone have have information about sharing files with any of the OS please answer! Any idea why the piece of code below does not add the script element to the DOM?  var code = "&lt;script&gt;&lt;/script&gt;"; $("#someElement").append(code); Suppose $ \alpha, \beta&gt;0 $. Compute:   $$ \int_{0}^{\infty}\frac{\cos (\alpha x)-\cos (\beta x)}{x}dx $$   Here is what I do: $$\begin{align} \int_{0}^{\infty}\frac{\cos (\alpha x)-\cos (\beta x)}{x}dx &amp;= \int_{0}^{\infty}dx\int_{\alpha}^{\beta}\sin (yx)dy\\ &amp;=\int_{\alpha}^{\beta}dy\int_{0}^{\infty}\sin(yx)dx\\ &amp; \\ &amp;   \qquad\text{let $ yx=u $}\\ &amp; \\ &amp;=\int_{\alpha}^{\beta}\frac{1}{y}dy\int_0^{\infty}\sin u du\\ &amp;=\int_{\alpha}^{\beta}\frac{1}{y}dy\left( -\cos u|_{\infty}+\cos u|_0 \right)\\ &amp;=\log\frac{\beta}{\alpha}(-\cos(\infty)+1)\\ &amp;=\log\frac{\beta}{\alpha}-\cos(\infty)\log\frac{\beta}{\alpha} \end{align}$$  But $ \cos(\infty) $ does not exist right? Does it mean the integral actually diverse?  Edit: The question comes from   Who can point out my mistake in the above deduction? I've got Ubuntu 10.10 installed to use my whole hard-disk, but would like to use the 130GB of free space I've got to create a new partition and do some development on Unity and Natty.  Can I use gparted to do this?  If so how? There is no fruit jet pack. I can't get it. How do I get it? I looked at the jetpacks many times. There are none. What is a deterministic method for evaluating a sensible buffer pool size? I'm trying to come up with a sane way to understand if the max server memory (mb) setting is appropriate (either should be lower, or higher, or stay the way it is).  I am aware that max server memory (mb) should always be low enough to leave room for the operating system itself, etc.    The environment I'm looking at has several hundred servers; I need a reliable formula I can use to determine if the present size of the buffer pool is appropriate since RAM is costed per GB allocated to each server.  The entire environment is virtualized, and "physical" RAM allocated to a VM can easily be changed up or down.  I have a particular SQL Server Instance I'm looking at now with a PLE of 1,100,052 seconds, which equates to 12.7 days (the amount of time the server has been up).  The server has a max server memory setting of 2560MB (2.5GB), of which only 1380MB (1.3GB) is actually committed.    I've read several items including one by Jonathan Keheyias () and another by Paul Randal (), and several others.  Jonathan advocates monitoring for a PLE below 300 per 4GB of buffer pool as being too low.  For the SQL Server Instance above, 300 * (2.5 / 4) = 187 results in a really really low target PLE below 300.  This instance has 290GB of SQL Server data (not including log files), and is only used for integration testing.  Assuming the last 12 days is representative of typical usage for this server, I'd say the max server memory (mb) setting could be lowered.  At the other end of the scale, I have another integration-test server with a PLE of 294, that has a max server memory (mb) setting of only 1GB.  This server has only 224MB of SQL Server data not including logs, and is running some BizFlow databases.  This server might benefit from a higher max server memory (mb) setting.  I'm thinking a good starting place for targets that might be assigned too much memory could include looking at:  SELECT      RamMB = physical_memory_in_bytes / 1048576     , BufferPoolCommittedMB = bpool_committed * 8192E0 / 1048576     , BufferPoolCommitTargetMB = bpool_commit_target * 8192E0 / 1048576     , PercentOfDesiredSizeMB = CONVERT(INT,(CONVERT(DECIMAL(18,2),bpool_committed)                              / bpool_commit_target) * 100) FROM sys.dm_os_sys_info;   If BufferPoolCommitTargetMB / BufferPoolCommittedMB is greater than 1, the server is not using the entire buffer pool.  If the machine in question also has a PLE of greater than "x" then it might be a good candidate for a decrease in max server memory (mb).  Since the Buffer Manager:Lazy writes/sec performance counter tracks the number of times SQLOS has written pages out to disk between checkpoints due to memory pressure, this might be another good thing to look at.  DECLARE @WaitTime DATETIME; SET @WaitTime = '00:00:15'; DECLARE @NumSeconds INT; SET @NumSeconds = DATEDIFF(SECOND, 0, @WaitTime); DECLARE @LazyWrites1 BIGINT; DECLARE @LazyWrites2 BIGINT;  SELECT @LazyWrites1 = cntr_value  FROM sys.dm_os_performance_counters dopc WHERE (         dopc.counter_name LIKE 'Lazy writes/sec%' COLLATE SQL_Latin1_General_CP1_CI_AS     )     AND dopc.object_name = 'MSSQL$' + CONVERT(VARCHAR(255),                SERVERPROPERTY('InstanceName')) + ':Buffer Manager';  WAITFOR DELAY @WaitTime;  SELECT @LazyWrites2 = cntr_value  FROM sys.dm_os_performance_counters dopc WHERE (         dopc.counter_name LIKE 'Lazy writes/sec%' COLLATE SQL_Latin1_General_CP1_CI_AS     )     AND dopc.object_name = 'MSSQL$' + CONVERT(VARCHAR(255),                SERVERPROPERTY('InstanceName')) + ':Buffer Manager';  SELECT LazyWritesPerSecond = (@LazyWrites2 - @LazyWrites1) / @NumSeconds;   The above code assumes the server is under load during the 15 seconds it takes to run, otherwise it will report 0; which might be a misleading false-negative.  Should I also look at PAGELATCHIO_* wait stats or some other wait type as an indicator of memory pressure, or lack thereof?   My question is, how can I reliably determine a "good" target value for PLE and max server memory (mb)? Let $\alpha(t)$ be a regular curve. Suppose there is a point $a$ in $R^3$ such that $\alpha(t)-a$ is orthogonal to $T(t)$ for all t. Prove that $\alpha(t)$ lies on a sphere.  So, I let $\alpha(t)=(x(t), y(t),z(t))$ and $a=(a,b,c)$.  Since, $\alpha(t)-a$ is orthogonal to $T(t)$,  $&lt;\alpha(t)-a,T(t)&gt;=0$.  But I don't know how to solve this.. Show that if terms of a series have ratio less than the ratio of convergent series, then the series converges We have two infinite series $\sum a_n $ and $\sum b_n$, such that $a_n &gt; 0,\ b_n &gt; 0$ and $a_{n + 1}/a_n \leq b_{n + 1}/b_n$ for all $n$. Show that if $\sum b_n$ converges, then $\sum a_n$ also converges.   Any hints on how to prove this? I can sort of picture why this must be true, but I'm not sure how to prove this rigorously. I'm not sure using the ratio test would help here..