What's the error in this snippet? very urgent!
import java.io.*;
import java.net.*;
public class HttpClient {
private String msg =null;
private int gsm =0;
private DataOutputStream out = null;
private Socket HttpSocket = null;
private String message = new String("Hello Socket");
public HttpClient(String msg,int gsm) {
this.msg = msg;
this.gsm = gsm;
try {
HttpSocket = new Socket("127.0.0.1",3333);
out = new DataOutputStream(HttpSocket.getOutputStream());
} catch(UnknownHostException e) {
System.out.println("Don't know about host:127.0.0.1");
System.exit(1);
} catch(IOException e) {
System.out.println("Couldn't get I/o connection for 127.0.0.1");
System.exit(1);
out.writeChars(message);
out.close();
HttpSocket.close();
/*When i compile the following errors are detected:
C:\Work\sms\HttpClient.java:29: <identifier> expected
out.writeChars(message);
^
C:\Work\sms\HttpClient.java:30: <identifier> expected
out.close();
^
C:\Work\sms\HttpClient.java:31: <identifier> expected
HttpSocket.close();
^
Its just some declaration errors...
just do as follow:
public HttpClient(String msg,int gsm)
this.msg = msg;
this.gsm = gsm;
try
HttpSocket = new Socket("127.0.0.1",3333);
out = new DataOutputStream(HttpSocket.getOutputStream());
// guess you shall change this with out.writeChars(msg)
out.writeChars(message);
out.close();
HttpSocket.close();
catch(UnknownHostException e)
System.out.println("Don't know about host:127.0.0.1");
System.exit(1);
catch(IOException e)
System.out.println("Couldn't get I/o connection for 127.0.0.1");
System.exit(1);
}good luck!
Similar Messages
-
What's the error in this package
dear all,
can you plz tell me what's the erro in this package plz
SQL> CREATE OR REPLACE PACKAGE discounts
2 IS
3 g_id NUMBER := 7839;
4 discount_rate NUMBER := 0.00;
5 PROCEDURE display_price (p_price NUMBER);
6 END discounts;
7 /
Package created.
SQL>
SQL>
SQL> CREATE OR REPLACE PACKAGE BODY discounts
2 IS
3 PROCEDURE display_price (p_price NUMBER)
4 IS
5 BEGIN
6 DBMS_OUTPUT.PUT_LINE ( 'Discounted '
7 ||TO_CHAR(p_price*NVL(discount_rate, 1)));
8 END ;
9 discount_rate:= 0.10;
10 END ;
11 /
Warning: Package Body created with compilation errors.
SQL>
SQL> show errors;
Errors for PACKAGE BODY DISCOUNTS:
LINE/COL ERROR
9/1 PLS-00103: Encountered the symbol "DISCOUNT_RATE" when expecting
one of the following:
begin end function package pragma procedure form
The symbol "begin" was substituted for "DISCOUNT_RATE" to
continue.
SQL>if you want declare a private variable you need to declare at package body and remove from the package specification
something like this
@10g> CREATE OR REPLACE PACKAGE discounts
2 IS
3 g_id NUMBER := 7839;
4 PROCEDURE display_price (p_price NUMBER);
5 END discounts;
6 /
Package created.
@10g>
@10g> CREATE OR REPLACE PACKAGE BODY discounts
2 IS
3 discount_rate NUMBER := 0.10; /* Private declaration */
4
5 PROCEDURE display_price (p_price NUMBER)
6 IS
7 BEGIN
8 DBMS_OUTPUT.PUT_LINE ( 'Discounted '
9 ||TO_CHAR(p_price*NVL(discount_rate, 1)));
10 END ;
11 END ;
12 /
Package body created.You can't assign values to variables out of procedure unless you declare and assign a initial value.
Edited by: dask99 on Oct 26, 2009 8:23 AM -
What is the error with this code ??
i'm trying to execute the following AS3 code:
var itemsArr:Array = new Array ();
var i:int;
var loaderAds:URLLoader = new URLLoader();
loaderAds.load(new URLRequest("ads.txt"));
loaderAds.addEventListener(Event.COMPLETE, completeHandlerAds);
function completeHandlerAds(eventAds:Event):void {
var loaderAds:URLLoader = URLLoader(eventAds.target);
var varsAds:URLVariables = new URLVariables(loaderAds.data);
itemsArr = varsAds.names.split(";");
for (i = 0; i < (itemsArr.length); i++) {
trace("itemsArr, Processing: " + itemsArr[i]);
var loaderProps:URLLoader = new URLLoader();
loaderProps.load(new URLRequest(itemsArr[i]+".txt"));
loaderProps.addEventListener(Event.COMPLETE, completeHandlerProps);
trace("one: " + itemsArr[i]);
function completeHandlerProps(eventProps:Event):void {
trace("two: " + itemsArr[i]);
}// end of fn for props
}//end of "for" loop of ads names
}//end of fn for ads names
But i get the following output:
adsNames Array: ad0,ad1
adsNames, Processing: ad0
ad0
adsNames, Processing: ad1
ad1
null
TypeError: Error #2007: Parameter name must be non-null.
at flash.display::DisplayObject/set name()
at MethodInfo-279()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunctio n()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/flash.net:URLLoader::onComplete()
null
TypeError: Error #2007: Parameter name must be non-null.
at flash.display::DisplayObject/set name()
at MethodInfo-279()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunctio n()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/flash.net:URLLoader::onComplete()
As you see, the "red text" is errors, Can you tell me the reason for it ?
And also, tracing "itemsArr[i]" in the second time, always give "null", also in the first time, it give the correct value, Why ?the red text not appear after i posted the topic, but you can see the errors on the output
and, you've to create to text files, first called "ads.txt" and put in it "names=ad0;ad1"
second one called "ad0.txt" and put anything in it, and another called "ad1.txt" and put anything in it
all these files should be in the same dir of flash file -
What's the error of this file-upload code?
hi,
I have written following code for file selection:
<form action="display.jsp" method="POST" enctype="multipart/form-data">
<input type="file" name="File1">
<input type="submit" name = "button" value="Submit">
</form>And my project another file display.jsp which code is:
<%@ page import="org.apache.commons.fileupload.*"%>
<%@page import="java.io.*" %>
<%@page import="java.util.*" %>
<%
out.println("Content Type: "+request.getContentType());
boolean isMultipart=FileUpload.isMultipartContent(request);
DiskFileUpload upload=new DiskFileUpload();
List items=upload.parseRequest(request);
Iterator iter=items.iterator();
while(iter.hasNext()){
FileItem item=(FileItem)iter.next();
if(item.isFormField()){
out.println("SIZE: "+item.getSize());
File fNew= new File(application.getRealPath("/"), item.getName());
out.println(fNew.getAbsolutePath());
item.write(fNew);
else
out.println("Field ="+item.getFieldName());
%>After that, i put on common-fileupload-1.1..jar on the project's /WebConcontent/WEB-INF/lib/ directory. And i have also add the common--fileupload-1.1.1. jar in the project build path. Further that i have got following error:
Error is:
exception
org.apache.jasper.JasperException: org/apache/commons/io/output/DeferredFileOutputStream
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
javax.servlet.ServletException: org/apache/commons/io/output/DeferredFileOutputStream
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp.display_jsp._jspService(display_jsp.java:78)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream
org.apache.commons.fileupload.DefaultFileItemFactory.createItem(DefaultFileItemFactory.java:102)
org.apache.commons.fileupload.FileUploadBase.createItem(FileUploadBase.java:500)
org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:367)
org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:268)
org.apache.jsp.display_jsp._jspService(display_jsp.java:53)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)Why i have got this error? IS there anybody can help me? What will be the solution?Please Help me?
With regards
Binajava.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream
Means you are missing a class file from the class path. Most likely cause is a missing jar file. The Apache Commons utilities often have dependancies on other Commons projects. This looks like it is looking for the Apache Commons IO jar file. Download the jar file and add it to the WEB-INF/lib directory. -
What's the error in this code?
I keep getting an error message at "line 1 column 97" which is the letter "i" in the second "if."
begin if :P23_START_DATE is null or :P23_START_DATE = ' ' then :P23_START_DATE:= '01-JAN-2001';
if :P23_END_DATE = is null or :P23_END_DATE = ' ' then
:P23_END_DATE = '31-DEC-2099';
select 'http://apexdevapp1.ci.raleigh.nc.us:7777',
user_name, count(ID) total
FROM eba_ver2_cust_activity
where ACTIVITY_DATE <= to_char(to_date(:P23_END_DATE,'dd-mon-yyyy'),'dd-mon-yyyy')
and ACTIVITY_DATE >= to_char(to_date(:P23_START_DATE,'dd-mon-yyyy'),'dd-mon-yyyy')
group by
user_name,
'http://apexdevapp1.ci.raleigh.nc.us:7777'
end;
Honestly, I don't see where the problem is. Help me please.
Steve "the n00b" in Raleigh NCackness wrote:
You could forgo the IF statements altogether by doing using NVL and TRIM this:
begin
select
'http://apexdevapp1.ci.raleigh.nc.us:7777',
user_name, count(ID) total
FROM eba_ver2_cust_activity
where ACTIVITY_DATE BETWEEN NVL(TRIM(:P23_START_DATE), '01-JAN-2001') AND NVL(TRIM(:P23_END_DATE), '31-DEC-2099');
group by
user_name,
'http://apexdevapp1.ci.raleigh.nc.us:7777';
end;
also you can simplify the GROUP BY by
begin
select
MAXX('http://apexdevapp1.ci.raleigh.nc.us:7777') URL,
user_name, count(ID) total
FROM eba_ver2_cust_activity
where ACTIVITY_DATE BETWEEN NVL(TRIM((:P23_START_DATE), '01-JAN-2001') AND NVL(TRIM((:P23_END_DATE), '31-DEC-2099');
group by
user_name;
end;Ackness, I tried your first suggestion, and got this when I applied the changes.
1 error has occurred
Failed to parse SQL query:
BEGIN SELECT 'http://apexdevapp1.ci.raleigh.nc.us:7777', user_name, count(ID) total FROM eba_ver2_cust_activity where ACTIVITY_DATE BETWEEN NVL(TRIM(:P23_START_DATE), '01-JAN-2001') AND NVL(TRIM(:P23_END_DATE), '31-DEC-2099'); group by user_name, 'http://apexdevapp1.ci.raleigh.nc.us:7777'; end
ORA-06550: line 5, column 115: PLS-00103: Encountered the symbol "" when expecting one of the following: begin case declare end exception exit for goto if loop mod null pragma raise return select update while with << close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe
Certain queries can only be executed when running your application, if your query appears syntactically correct, you can save your query without validation (see options below query source).
I can't for the life of me figure out where the invalid character is after "begin." All I can see is a blank character. Thanks for your help.
Steve "the n00b" -
What is the error in this one line of code!
s=s-(s/28)*[1-(s/28)*(29/s+1)*(21-q/11)];
I am using this line of code in my programe but i am getting the following error.
C:\shahzad\Easter.java:28: illegal start of expression
s=s-(s/28)*[1-(s/28)*(29/s+1)*(21-q/11)];
Please help me solvingg this problem
thanks.s=s-(s/28)*[1-(s/28)*(29/s+1)*(21-q/11)];
[] brakets ae used to index arrays, are you using an array somewhere????
arr=5; for example....
in either event youl need to make changes.
assuming no array is involved simply change [] to ()
if still causing problems try adding extara()
s= (s-(s/28))*( (1-(s/28)) * ( (29/s)+1) * (21-(q/11)) ); -
What is the error in this program??????
class FindArea
public static void main(String args[])
float radius=7.0f;
float area=(22/7)*(radius)*(radius);
System.out.println(area);
When i execute the above program i am getting output as 147.0 why it is happening???? I dont understand.....
Actually it should come...154!!!!!!!!When you divide one int by another the result is "truncated" (the decimal part is
thrown away). If you don't want this to happen you have to tell the compiler to
treat your integer as a double (or float). This is done in the first two cases, but not
the third.public class IntOrDouble {
public static void main(String[] args) {
// prints 15.0
double answer1 = ((double)3 / 2) * 10;
System.out.println("answer 1 = " + answer1);
// prints 15.0
double answer2 = (3.0 / 2) * 10;
System.out.println("answer 2 = " + answer2);
// prints 10.0 because 3/2 is 1
double answer3 = (3 / 2) * 10;
System.out.println("answer 3 = " + answer3);
}Test: so, what will (double)(3/2)*10 print? -
When I tried to create a movie, I got this message: "This item cannot be shared while it is still referencing media on the camera". What does it mean?
How do I resolve it?eDude.com wrote: ... What does it mean? ....
It means that you cannot share something unless it resides on your computer.
eDude.com wrote:... How do I resolve it?
Import all clips that you plan to use in your finished project to your Mac before you edit and share your finished work.
For help see iMovie '11: Overview: Importing video and iMovie ’11: Import Video. -
What' s the error in this procedure
set serveroutput on
create or replace PROCEDURE p1
(v_quote IN number,
v_stock IN Number,
v_approval OUT number)
IS
BEGIN
V_approval:=v_quote + v_stock;
dbms_output.put_line(v_approval);
END;
call p1(7,8);But your procedure has 3 arguments, not 2. You must specify all of them, the last being a variable where the result can go. Perhaps you want something like this:
SQL> create or replace PROCEDURE p1 (v_quote IN number,
2 v_stock IN Number,
3 v_approval OUT number) IS
4 BEGIN
5 V_approval:=v_quote + v_stock;
6 END;
7 /
Procedure created.
SQL> var approval number
SQL> exec p1(7, 8, :approval);
PL/SQL procedure successfully completed.
SQL> print approval
APPROVAL
15(by the way, you shouldn't double post. Especially 6 minutes apart) -
What is the error in this code
hi everone
I write this code in push button
declare
x varchar2(222);
begin
x:=get_application_property(:system.mode);
message(x);
end;
to know the system mode
but the resullt was exeception ora-06502simple write
x := :system.mode;
or
message(:system.mode);
message(:system.mode);Best way to resolve the issue is always check Forms online help first -
What is the error in this trigger
create or replace trigger tt1
after insert on EXERCISE2_T
referencing new as new
for each row
declare
v_excd EXERCISE2_T.EX_CD%type:=(CASE EX_CD
WHEN 'X' THEN 'Extracted';
WHEN 'F' THEN 'Failed';
WHEN 'S' THEN 'Skipped';
WHEN 'C' THEN 'Cancelled';
ELSE 'no');
begin
insert into DWH_DEX2_RD_T(DK_EX2,
EX2_CD,
EX2_NM) values(:new.EX_ID,:new.EX_CD,v_excd);
end;error
3/30 PLS-00103: Encountered the symbol ";" when expecting one of the following:
* & = - + < / > at else end in is mod remainder not rem when
<an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_
LIKE4_ LIKEC_ between || multiset member SUBMULTISET_create or replace trigger tt1
after insert
on exercise2_t
referencing new as new
for each row
declare
v_excd exercise2_t.ex_cd%type
:= case ex_cd
when 'X'
then 'Extracted'
when 'F'
then 'Failed'
when 'S'
then 'Skipped'
when 'C'
then 'Cancelled'
else 'no'
end;
begin
insert into dwh_dex2_rd_t
dk_ex2, ex2_cd, ex2_nm )
values (
:new.ex_id, :new.ex_cd, v_excd );
end;
/In other words: the semi-columns and the case-END. -
What is the error in this?
SQL> declare
2 vcount number:=0;
3 begin
4 select count(*) into vcount
5 from emp;
6 if vcount>1 then
7 raise_application_error(-20100,'error');
8 end if;
9 end;
10 /
declare
ERROR at line 1:
ORA-20100: error
ORA-06512: at line 7There is no error your block has executed successfully.
Thanks,
Karthick -
What's the error??
Hello All,
Could some one tell me what is the error in this procedure?
CREATE OR REPLACE PROCEDURE STUDENTS_COUNT AS
TOT NUMBER;
BEGIN
TOT:=0;
SELECT COUNT(*) INTO TOT FROM STUDENTS;
CASE
WHEN TOT = 0 THEN RAISE_APPLICATION_ERROR(-20001,'SORRY!NO STUDENTS FOUND');
WHEN TOT >= 1 AND TOT <= 5 THEN RAISE APPLICATION ERROR(-20001,'ONLY FEW STUDENTS');
WHEN TOT >6 THEN RAISE APPLICATION ERROR(-20001,'GOOD NO OF STUDENTS');
END CASE;
END ;
Thanks
BalajiHi,
First of all there in nothing much wrong in your procedure, Except the "When" clause should not be end up by line terminator ( i.e. ";" )
So the correct syntax is :-
CASE
WHEN TOT = 0 THEN RAISE_APPLICATION_ERROR(-20001,'SORRY!NO STUDENTS FOUND')
WHEN TOT >= 1 AND TOT <= 5 THEN RAISE APPLICATION ERROR(-20001,'ONLY FEW STUDENTS')
WHEN TOT >6 THEN RAISE APPLICATION ERROR(-20001,'GOOD NO OF STUDENTS')
END CASE;
More over if you are Using Oracle 8i then oracle does not support Case Expressions in PLSQL. Even SQLs with CASE expression can not be used in PLSQL. But Oracle 9i version do support the usage of CASE Expression in PLSQL.
Sp program your business logic which is supported by you current oracle version.
Regards
Ripudaman -
My ipod 60gb classic is showing as fully charged until I connect it to my pc when it comes up with the error message, 'please wait very low battery' and the little wheel goes round and nothing happens, can anyone explain why this is and what i can do?
I have worked my way through the assistant and nothing works. I have tried connecting in disc mode but although the screen on the ipod is showing that the device is charged and that it is in disc mode as soon as I connect it to the computer it comes up with the error message 'please wait very low battery' and stays like that until I disconnect when it appears to be OK again. I have tried on both pc and mac.
BTW the ipod is an ipod video not classic if that makes any difference.
Thanks -
Ever since I downloaded this latest version, my browser is not loading the page. Says can't find the server error. This is very frustrating and slow. What should I do.
That file might have moved to a different location on the server. I think you'll need to check with RefWorks support or your local IT department on why the install page links do not work.
Maybe you are looking for
-
Macbook pro no longer automatically connects to network upon waking up
Since yesterday - for no apparent reason, i have to manually choose my network when i open my macbook. This is not a new computer or a new wireless setup. All has been working fine (with occasional hiccups with new hardware here and there, but mostly
-
Installing flash player and sticks on step 2 help
i am trying to install flash player and it sticks on step 2 and also it doesnt show the run dialogue box what is going wrong
-
How to write internal table data vertically . Records vertically.
Hi pals, How to write internal table records vertically . suppose the records are a1 a2 a3 b1 b2 b3 we need to display a1 b1 a2 b2 a3 b3 Thanks in advance. balaji.T
-
Quicktime file info missing in Finder column view???
In the Finder column view my PowerMac G4 running OS X 10.3.9 shows all QuickTime audio and video file info along with the playable thumbnail video or music bar, including duration/running time and (for movies) dimension/aspect ratio in pixels. Howeve
-
Has anybody got Arduino to Work in ArchLinux?
I've tried via the aur and yaourt but it spits a load of errors out for me. I've also tried http://www.nongnu.org/avr-libc/user-man - r_binutils but when trying to make gcc i get libgcc/./_eprintf.o cc1: error: unrecognized command line option "-marc