Question about Operating Systems

1 Answer

Null pointer exception

Im getting nullpointer exception when i use resultset ..plz..tell me the code to avoid this

Posted by on

×

1 Answer

  • Level 3:

    An expert who has achieved level 3 by getting 1000 points

    All-Star:

    An expert that got 10 achievements.

    MVP:

    An expert that got 5 achievements.

    Brigadier General:

    An expert that has over 10,000 points.

  • Master
  • 10,406 Answers

Check your code -- the value of one of your "pointers" has not been set.
So, the pointer is NOT pointing to the "expected" location of your data.

Posted on Dec 03, 2009

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

1 Answer

Source code for implementation of linked list using opengl in vc++


Source code:

#include
using namespace std;
class linklist
{
private:
struct node
{
int data;
node *link;
}*p;
public:
linklist();
void append( int num );
void add_as_first( int num );
void addafter( int c, int num );
void del( int num );
void display();
int count();
~linklist();
};
linklist::linklist()
{
p=NULL;
}
void linklist::append(int num)
{
node *q,*t;
if( p == NULL )
{
p = new node;
p->data = num;
p->link = NULL;
}
else
{
q = p;
while( q->link != NULL )
q = q->link;
t = new node;
t->data = num;
t->link = NULL;
q->link = t;
}
}
void linklist::add_as_first(int num)
{
node *q;
q = new node;
q->data = num;
q->link = p;
p = q;
}
void linklist::addafter( int c, int num)
{
node *q,*t;
int i;
for(i=0,q=p;i {
q = q->link;
if( q == NULL )
{
cout return;
}
}
t = new node;
t->data = num;
t->link = q->link;
q->link = t;
}
void linklist::del( int num )
{
node *q,*r;
q = p;
if( q->data == num )
{
p = q->link;
delete q;
return;
}
r = q;
while( q!=NULL )
{
if( q->data == num )
{
r->link = q->link;
delete q;
return;
}
r = q;
q = q->link;
}
cout}
void linklist::display()
{
node *q;
cout for( q = p ; q != NULL ; q = q->link )
coutdata;
}
int linklist::count()
{
node *q;
int c=0;
for( q=p ; q != NULL ; q = q->link )
c++;
return c;
}
linklist::~linklist()
{
node *q;
if( p == NULL )
return;
while( p != NULL )
{
q = p->link;
delete p;
p = q;
}
}
int main()
{
linklist ll;
cout ll.append(12);
ll.append(13);
ll.append(23);
ll.append(43);
ll.append(44);
ll.append(50);
ll.add_as_first(2);
ll.add_as_first(1);
ll.addafter(3,333);
ll.addafter(6,666);
ll.display();
cout ll.del(333);
ll.del(12);
ll.del(98);
cout return 0;
}

May 19, 2011 | Operating Systems

1 Answer

I've done everything I know to do to get rid of the dinosaur cursor or pointer whichever you want to call it. Can you please tell me how to disable that darn thing? Thanks, Barbara


I believe you go to controll panel, click on the option "Mouse" (or something like that) click on the tab labeled "Pointers", and set it as so

Sep 17, 2010 | Microsoft Windows 2000 Professional for PC

1 Answer

Sst programing on saitek X52pro , ones install I clik on the place that Im suppost to setup , then got messge error : Problem signature: Problem Event Name: APPCRASH Application Name: ProfileU.exe ...


sst programing on saitek X52pro , ones install I clik on the place that Im suppost to setup , then got messge error : Problem signature: Problem Event Name: APPCRASH Application Name: ProfileU.exe Application Version: 4.3.4.17 Application Timestamp: 44fd31e8 Fault Module Name: ProfileU.exe Fault Module Version: 4.3.4.17 Fault Module Timestamp: 44fd31e8 Exception Code: c0000005 Exception Offset: 00001fda OS Version: 6.0.6002.2.2.0.768.3 Locale ID: 1033 Additional Information 1: 253c Additional Information 2: 287b034b0bef0590cba0ccef4c4b4b77 Additional Information 3: 7de0 Additional Information 4: bfe79fb32a74e3eb99cc45f1169d5e8b

Aug 07, 2009 | Operating Systems

1 Answer

I need the code for the mind quiz


sst programing on saitek X52pro , ones install I clik on the place that Im suppost to setup , then got messge error : Problem signature: Problem Event Name: APPCRASH Application Name: ProfileU.exe Application Version: 4.3.4.17 Application Timestamp: 44fd31e8 Fault Module Name: ProfileU.exe Fault Module Version: 4.3.4.17 Fault Module Timestamp: 44fd31e8 Exception Code: c0000005 Exception Offset: 00001fda OS Version: 6.0.6002.2.2.0.768.3 Locale ID: 1033 Additional Information 1: 253c Additional Information 2: 287b034b0bef0590cba0ccef4c4b4b77 Additional Information 3: 7de0 Additional Information 4: bfe79fb32a74e3eb99cc45f1169d5e8b

Aug 05, 2009 | Microsoft Windows Vista Ultimate Edition

1 Answer

I want circularlinklist program in c++


This C++ program is to perform the following operations
on a circular linked list
1)insertion
2)forward traversal
3)reverse traversal
4)search
->node structure :
a node contains
1) integer data
2) pointer to next node
-> This program works in microsoft VC++ environment
in windows xp
-> This program uses the following header files
1)iostream.h
********************************************************/
#include<iostream.h>
class cll
{
private:
int data;
cll *next;
public:
cll* insert_one(int,cll*);
cll* delete_one(int,cll*);
void ftraverse(cll*);
void rtraverse(cll*);
void search(int,cll*);
void function();
};
cll*hd;
void cll::function()
{
cout<<”******************************************\n”;
cout<<”program to implement a circular linked list \n”;
cout<<”******************************************\n”;
cll * head;
head=NULL;
cout<<”\n\nMENU :\n”;
cout<<”1)insertion\n”
<<”2forward traversal\n”
<<”3)reverse traversal\n”
<<”4)search\n”
<<”5)exit\n\n”;
cout<<”Enter your option :”;
int opt;
cin>>opt;
int d;
while(opt!=5)
{
switch(opt)
{
case 1:
cout<<”Enter data to the node :”;
cin>>d;
head=insert_one(d,head);
cout<<”inserted\n”;
break;
case 2:
cout<<”The forward traversal is :\n”;
ftraverse(head);
break;
case 3:
cout<<”The reverse traversal is :\n”;
hd=head;
rtraverse(head);
cout<<”NULL\n”;
break;
case 4:
cout<<”Enter the element to be searched :”;
int d;
cin>>d;
search(d,head);
break;
case 5:
break;
default:
cout<<”invalid option”;
break;
}
cout<<”\n\nMENU :\n”;
cout<<”1)insertion\n”
<<”2)forward traversal\n”
<<”3)reverse traversal\n”
<<”4)search\n”
<<”5)exit\n\n”;
cout<<”Enter your option :”;
cin>>opt;
}
}
cll* cll::insert_one(int d,cll* c)
{
cll*NEW;
NEW=new cll;
NEW->data=d;
NEW->next=NULL;
if(c==NULL)
{
c=NEW;
c->next=c;
}
else
{
cll*c1=c;
while(c1->next!=c)
c1=c1->next;
c1->next=NEW;
NEW->next=c;
}
return c;
}
void cll::ftraverse(cll* c)
{
if(c==NULL)
{
cout<<”\nlist empty\n”;
return;
}
else
{
cll *c1=c;
cout<<c1->data<<”->”;
c1=c1->next;
while(c1!=c)
{
cout<<c1->data<<”->”;
c1=c1->next;
}
cout<<”NULL\n”;
}
}
void cll::rtraverse(cll* c)
{
if(c->next==hd)
{
cout<<c->data<<”->”;
return;
}
else
rtraverse(c->next);
cout<<c->data<<”->”;
}
void cll::search(int d,cll* c)
{
cll*c1=c;
if(c==NULL)
{
cout<<”\nlist empty\n”;
return;
}
else
{
if(c->data == d)
{
cout<<”found\n”;
return ;
}
while(c->next !=c1)
{
if(c->data==d)
{
cout<<”found\n”;
return ;
}
c=c->next;
}
if(c->data ==d)
{
cout<<”found\n”;
return ;
}
cout<<” search unsuccess ful \n”;
}
}
void main()
{
cll list;
list.function();
}

Mar 05, 2009 | Operating Systems

2 Answers

How to connect from jsp login page to database


hey try this code......just found it on the net... Put the code in tomcat and test the application through browser. The browser should display the display the data stored in the table.

Here is the code of our JSP file
<%@ page language="java" import="java.sql.*"%>
<html>
<head><title>Read from mySQL Database</title>
</head>
<body>

<p align="center"><b>Following records are selected from the 'jakartaproject' table.</b><br>&nbsp;</p>

<div align="center" width="85%">
<center>
<table border="1" borderColor="#ffe9bf" cellPadding="0" cellSpacing="0" width="658" height="63">
<tbody>
<td bgColor="#008080" width="47" align="center" height="19"><font color="#ffffff"><b>Sr.
No.</b></font></td>
<td bgColor="#008080" width="107" height="19"><font color="#ffffff"><b>Project</b></font></td>
<td bgColor="#008080" width="224" height="19"><font color="#ffffff"><b>Url
Address</b></font></td>
<td bgColor="#008080" width="270" height="19"><font color="#ffffff"><b>Description
of the project</b></font></td>

<%
String DRIVER = "org.gjt.mm.mysql.Driver";
Class.forName(DRIVER).newInstance();


Connection con=null;
ResultSet rst=null;
Statement stmt=null;

try{
String url="jdbc:mysql://192.168.10.2/tutorial?user=tutorial&password=tutorial";

int i=1;
con=DriverManager.getConnection(url);
stmt=con.createStatement();
rst=stmt.executeQuery("select * from jakartaproject ");
while(rst.next()){

if (i==(i/2)*2){
%>
<tr>
<td bgColor="#ffff98" vAlign="top" width="47" align="center" height="19"><%=i%>.</td>
<td bgColor="#ffff98" vAlign="top" width="107" height="19"><%=rst.getString(2)%></td>
<td bgColor="#ffff98" vAlign="top" width="224" height="19"><a href="<%=rst.getString(3)%>"><%=rst.getString(3)%></a>&nbsp;</td>
<td bgColor="#ffff98" vAlign="top" width="270" height="19"><%=rst.getString(4)%></td>
</tr>
<%
}else{
%>
<tr>
<td bgColor="#ffcc68" vAlign="top" width="47" align="center" height="19"><%=i%>.</td>
<td bgColor="#ffcc68" vAlign="top" width="107" height="19"><%=rst.getString(2)%></td>
<td bgColor="#ffcc68" vAlign="top" width="224" height="19"><a href="<%=rst.getString(3)%>"><%=rst.getString(3)%></a>&nbsp;</td>
<td bgColor="#ffcc68" vAlign="top" width="270" height="19"><%=rst.getString(4)%></td>
</tr>
<% }

i++;
}
rst.close();
stmt.close();
con.close();
}catch(Exception e){
System.out.println(e.getMessage());
}
%>

</tbody>
</table>
</center>
</div>


</body>
</html>

Feb 27, 2009 | Compaq Operating Systems

1 Answer

Mouse pointer on vista


Go into control panel and select mouse..there are some settings you can change that will slow it down so it does not activate so fast.

Don't forget to rate this solution.

Feb 12, 2009 | Microsoft Windows Vista Ultimate Edition

1 Answer

Windows32


pls plz update ur antivirus...now u have to get the updates of ur antivirus....use mcafee 5200engine of 8.5i version...its an free download...from mcafee website...n download superdat update files...n after getting new antivirus....re install windows...then install mcafee then its updates...tats it..

virus entries wil come due to use of pen drives...so b alert..

ne other prob's do tell me..N plz plz do rate me
cya

Apr 15, 2008 | Microsoft Windows XP Professional for PC

1 Answer

C++ PROGRAMMING


Dear Mr. Thephu,
here is the solution:
first, declare a structure
struct workers
{
char name[20],job[10],surname[20];
int age;
workers *next; // this is the pointer to the next node of
//type worker.
};
in the main program, declare a pointer to first worker node called head as :
workers *head;
head = new workers;
or (head =( workers *) malloc (sizeof(workers));
Then in the main program, whenever the user wishes to create a worker and join it to the list, u can include the following code:
head ->next = new workers;
cin >> head -> name >>job>>surname >> age;
if the user finishes the input include,
head -> next = NULL.

Feb 05, 2008 | Operating Systems

Not finding what you are looking for?
Operating Systems Logo

Related Topics:

28 people viewed this question

Ask a Question

Usually answered in minutes!

Top Operating Systems Experts

Les Dickinson
Les Dickinson

Level 3 Expert

18299 Answers

Brian Sullivan
Brian Sullivan

Level 3 Expert

27725 Answers

Prashant  Sharma
Prashant Sharma

Level 3 Expert

1127 Answers

Are you an Operating System Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...