Help!! writeUTF is writing some junk chars to my file
hi guys,
I am breaking my head with this. please help me out
I wrote a servlet which reads the input sent by an applet
the applet sends a hashmap object called manifest to the servlet
i am reading the contents of this manifest object into a file using writeUTF
but when i open the file to check the contents
every line has some erroneous characters at the beggining of the line
i am not understanding why these junk characters are writted, when i am making sure that i am writing correctly
i am appending the code also to this, please verify:
File lmin = new File(userFile.getPath()+"/"+"Lmin.txt");
FileOutputStream tolmin = new FileOutputStream(lmin);
DataOutputStream dos = new DataOutputStream(tolmin);
out.writeUTF("s&f"+(String)manifest.get("s&f")); //manifest is Hashmap object
dos.writeUTF(manifest.get("-s").toString().trim()+"\n");
when i am printing manifest.get("-s").toString().trim() to the outputstream it doesn't show any additional characters, but the file Lmin.txt has these junk characters.
why is this so??
thanks
pre_pra
I've simplified your code.
import java.io.*;
public class Test {
public static void main(String[] args) throws Exception {
DataOutputStream dos = new DataOutputStream (new FileOutputStream (new File ("test.bin")));
dos.writeUTF ("123456");
dos.close();
}The output is written to a file named test.bin. I've printed the hex dump of the file.
C>hd test.bin
0000 00 06 61 62 63 64 65 66 ..abcdefYou can see from the dump that writeUTF writes the length of the string (00 06) and then the bytes, encoded in UTF-8 (just ASCII in my case). The junk that you can see in your file is the length of the string that writeUTF wrote to the output file.
Similar Messages
-
Junk chars in the file posted on application server
HI All,
I am posting a file on the application server using the OPEN DATASET, TRANSFER, CLOSE DATASET commands.
The file is posted successfully but it contains junk characters like # and some box kind of character. The file that has the data doesnot have these junk characters.
Help me resolve this problem.
Thanks in advance.this is my code...
Open the file in the application server
OPEN DATASET l_filename FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc = 0.
Convert workarea to string type
CALL METHOD CL_ABAP_CONTAINER_UTILITIES=>FILL_CONTAINER_C
EXPORTING
IM_VALUE = ls_jhak
IMPORTING
EX_CONTAINER = l_file
EXCEPTIONS
ILLEGAL_PARAMETER_TYPE = 1
OTHERS = 2.
Transfer the data fetched into the file
TRANSFER l_file TO l_filename.
ELSE.
RETURN.
ENDIF.
Close the file in the application server
CLOSE DATASET l_filename. -
JMS, Help needed in writing a client code with .bindings file
Some one is keeping a message in MQSeries in their environment. We need to develop a client code, probably a JMSClient, which will consume the messages from the MQSeries. They have given us a ".bindings" file. The following lines of code is used and we are not able to connect to it. Can somebody help us in completing this task?
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory");
env.put(Context.PROVIDER_URL, "file:///c:/Temp");
String QCF = "CPS.ECOMM.QCF";
String TEST_QUEUE_S = "SYSTEM.JMS.D.CPSI.ECOMM";
initialContext = new InitialContext(env);
queueConnectionFactory = (QueueConnectionFactory)initialContext.lookup(QCF);
queueConnection = queueConnectionFactory.createQueueConnection();
queueConnection.start();
queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
queue = (Queue)initialContext.lookup(TEST_QUEUE_S);
QueueReceiver receiver = queueSession.createReceiver(queue);
Message msg = receiver.receive();
TextMessage txtMsg = (TextMessage)msg;
String result1 = txtMsg.getText();
....The .bindings file is part of the structure expected by the RefFSContextFactory in the directory that provider.utl points to.
Create a directory containing only the .bindings file and point the PROVIDER_URL at the directory. -
i am upgrading my 2008 macbook to an ssd drive and want to save my settings. how do i save then? I have my files backed up with time machine ,but dont want to restore all files ,as there might be some junk backed up too. Help will be appretiated
When you restore from a Time Machine back up you can pick and chose what is restored. It is not an all or nothing process. Nor do you have to do the partial restores all at the same time. If days after the first partial restore you find something else you want you can restore just that.
-
after ios 5.0.1 update my iphone 3gs stopped writing some letters (t, f, c) and some "5" number. please help. !
and the unlock slider is not working properly, i have to slide many times to open the phone.Same problem.
-
Help using scanner class to count chars in file
Hi all, I am learning Java right now and ran into a problem. I need to use the Scanner class to accurately count the number of chars in a file including the line feed chars 10&13.
This what I have and it currently reports a 201 byte file as having 194 chars:
File file = new File(plainFile);
Scanner inputFile = new Scanner(file);
numberOfChars = 0;
String line;
//count characters in file
while (inputFile.hasNextLine())
line = inputFile.nextLine();
numberOfChars += line.length();
I know there are other ways using BufferedReader, etc but I have to use Scanner class to do this.
Thanks in advance!raichle wrote:
Wow guys, thanks for the help! I've got a RTFMWell, what's wrong to have a look at the API docs for the Scanner class?
and directions that go against the specs I said.Is that so strange to suggest a better option? What if I ask a carpenter "how do I build a table with a my stapler?". Should I give the man an attitude if he tells me I'd better use a saw and hammer?
I'm also aware that it "eats" those chars and obviously looking for a way around that.
I've looked through the java docs, but as I said, I'm new to this and they're difficult to understand. The class I am auditing req's that this be done using Scanner, but I don't see why you demand an explanation.
Can anybody give me some constructive help?Get lost? -
Hi,
Could anyone help me in writing below query without syntax errors.
I tried but no luck
select xmlelement("g", XMLATTRIBUTES(g.contentgroup_id as "id",g.groupname as "label",
(select xmlagg(xmlelement ("c",XMLATTRIBUTES(c.title as "title",c.content_id as "id")))) as "A"))
as "A" from
(SELECT g.contentgroup_id AS id, g.groupname AS label, c.title AS label, c.content_id AS id
FROM content_ec c FULL OUTER JOIN contentgroup_ec g ON c.group_id = g.contentgroup_id
oRDER BY g.groupname ,c.title ASC );
Any help really appreciated.
ThanksFew tips to get your question answered here
1. Give your database version. Some thing that does not work in one version works fine in the next. And 8i,9i or 10g is not version. best way to give the version is to query your v$version table like this.
SQL> select * from v$version where rownum = 1
2 /
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod2. You should understand we don't have what you have, meaning you should provide your data structure and some sample data for us to help.
3. "I got an error"... "Its not working"... and the list goes on. Sentences like this does not help. If you got a error past the entire error. If stuff does not work, tell us the details.
4. Just don't throw some output and say i want it. Please explain to every one how you derive it.
5. And the most important thing. Use \...\ tag to format. Please.. Please.. Please.. use it. It helps every one a lot. When you use it your SQL looks some thing like this.
SELECT xmlelement("g", XMLATTRIBUTES(g.contentgroup_id as "id",g.groupname as "label",
(select xmlagg(xmlelement ("c",XMLATTRIBUTES(c.title as "title",c.content_id as "id")))) as "A")) as "A"
FROM (SELECT g.contentgroup_id AS id,
g.groupname AS label,
c.title AS label,
c.content_id AS id
FROM content_ec c
FULL OUTER JOIN contentgroup_ec g
ON c.group_id = g.contentgroup_id
ORDER BY g.groupname ,c.title ASC );6. And also do search this forum. Most of your my queries are answered by simple search.
Thanks,
Karthick. -
Help needed in writing a function.
I am using Oracle 11g and SQL plus. I am a complete newbie, so I need some help here in writing a function. I guess my question is more about writing the trigonometric functions within the function.
latA, longA latB, longB // these are the four input parameters,
theta = longA - longB
distX = sin( latA * PI / 180) * sin ( latB * PI /180) + cos ( latA * PI/180) * cos ( latB * PI/180) * cos ( theta * PI / 180)
distY = acos(distX) // this is arc cosine
distZ = distY * 180 / PI // PI refers to the mathematical PI
distP = distZ * 60 * 1.1515; // this value should be returned. Of course the intermediate variable names don't matter.
Please help. Thanks.CREATE OR REPLACE FUNCTION fucntion_name(latA IN NUMBER, longA IN NUMBER, latB IN NUMBER, longB IN NUMBER) RETURN NUMBER
IS
pi CONSTANT NUMBER:=3.14159;
theta NUMBER;
distX NUMBER;
distY NUMBER;
distZ NUMBER;
distP NUMBER;
BEGIN
theta :=longA - longB;
distX :=sin( latA * PI /180) * sin ( latB * PI /180) + cos ( latA * PI/180) * cos ( latB * PI/180) * cos ( theta * PI / 180);
distY :=acos(distX); --this is arc cosine
distZ :=distY * 180/PI; --PI refers to the mathematical PI
distP :=distZ * 60 * 1.1515; --this value should be returned. Of course the intermediate variable names don't matter.
RETURN distP;
END;Edited by: Ora on May 3, 2011 11:46 PM -
Help required in writing an sql to fetch the the difference of the data.
Hi Gurus,
Could some one help me in writing an sql to pull data the difference between two same structured tables from two different database and to store that data in an temperory table.
many many thanks in advanceLets say you have two db SOURCE and DEST
SOURCE is the DB that you have Logged in into. Now you do the following.
1. Createa DBLink to DEST database.
2. Check if the DBLink works properly.
3. Then execute the following sql.
select <column_list> from <table_name>
minus
select <column_list> from <table_name>@<dblink>
union all
select <column_list> from <table_name>@<dblink>
minus
select <column_list> from <table_name> -
Korean text displayed as junk char in xls attachmnt sent thru email frm SAP
Hi All,
I am sending a report output to users as an xls attachment through email from SAP.
I am facing problem with languages other than English. For ex a customer name is in korean lang and when I display the name in ALV it is fine also when I download from ALV it is fine only problem when I send that report through email.
Excel is having all junk char instead of Korean text.
I am using function modules SCMS_STRING_TO_XSTRING,SCMS_XSTRING_TO_BINARY and SO_NEW_DOCUMENT_ATT_SEND_API1 to send email.
I am using above FM because the data is more than 255 char.
Please help me to send other lang texts in XLS attachment through email.
Regards,
Suresh.Hi All,
I am sending a report output to users as an xls attachment through email from SAP.
I am facing problem with languages other than English. For ex a customer name is in korean lang and when I display the name in ALV it is fine also when I download from ALV it is fine only problem when I send that report through email.
Excel is having all junk char instead of Korean text.
I am using function modules SCMS_STRING_TO_XSTRING,SCMS_XSTRING_TO_BINARY and SO_NEW_DOCUMENT_ATT_SEND_API1 to send email.
I am using above FM because the data is more than 255 char.
Please help me to send other lang texts in XLS attachment through email.
Regards,
Suresh. -
Some junk files created in my shared folder
hi
i have a server 2012 r2 and I shared a folder for network access.
my clients are xp and seven.
after 1 week some junk files apeared in my folder.
I deleted them but another files apear after some days.
files name like :
2fv34
df542Hi Reza,
Sorry for my delay.
Based on your description, I understand that some odd files are created automatically in the shared folder.
If anything I misunderstand, please don’t hesitate to let me know.
Please run anti-virus software to scan the Windows Server 2012 R2 firstly.
Please let me know the type of those odd files. Or provide a screenshot of this file (please hide all protected
and private information). Meanwhile, please right click that file and select Properties. Navigate to General tab, Security tab and check if find some exceptions.
In addition, please open Control Panel on the server, select Folder Options, select View tab. There will be
two options under Hidden files and folders: Don’t show hidden files, folders, or drives and
Show hidden files, folders and drives. Please check if there has differences in those odd files when you check each option.
If any update, please feel free to let me know.
Hope this helps.
Best regards,
Justin Gu -
[SOLVED] php output produce some confusing chars?
Hi,
i use the arm version of archlinux on a sheeva plug
The plug runs as a local web and file server.
I follow the wiki for apache and php.
It runs for a long time but now i get some chines chars?
Example:
a short php script like:
<?php
echo "some test";
?>
produce:
獯浥⁴敳
access_log for this page:
192.168.0.11 - - [16/Oct/2011:17:13:45 +0200] "GET /t.php HTTP/1.1" 200 9
the error_log say nothing.
But what me totally confuse me is that a simple
<?php phpinfo();?>
Works as it have to work.
I give some days to find the problem with no result :-/ .
Any help a realy welcome.
Thanks a lot
Wolfgang.
Ok problem changed.... (argh)
It was a frustration that let me use my wifes laptop (with win 7)
All php pages a correct under windows so it must be something special with my archlinunx laptop system.
So admin can close this thread.
SOLVED BECOUSE IT IS A DIFFERENT PROBLEM
Last edited by mow (2011-10-16 17:48:01)mow,
we usually do not close a thread unless it is mandatory that no more traffic occurs there.
Just mark this thread [SOLVED] by editing the title of your post (use the "Edit" button and prepend "[SOLVED]" to the title). -
How doest jdk docs help as in writing java code?
hi i wonder how does jdk docs help as in writing java code because if i google a java code the jdk docs always becomes the result of my search but in my experience jdk docs never helps me.
is there any one know how to use jdk docs? and how to get the code from there.
im telling about jdk docs from here http://download.oracle.com/javase/1.4.2/docs/api/
cross posted from http://www.thenewboston.com/forum/viewtopic.php?f=119&t=13778
Edited by: 871484 on Jul 18, 2011 4:18 PM871484 wrote:
ok can any one give me example how to use jdk docs? for example this code
Your question still does not make any sense, and you still haven't clarified what you're not understanding.
However, if you think that just by reading the API docs, with no other training or study, that you will be able to write that code, then you are seriously misunderstanding the purpose of the docs.
Obviously English is not your native language. You grew up speaking some other language at home and with your friends, and at some point in school or as private study, you started to learn English. You learned about the grammar and the alphabet and pronunciation, sentence structure, word order, etc. Now you have the basics of how the language works, and you know some words. When you want to learn new words to fit into the structure you have learned, you use a dictionary.
If you didn't study the grammar, sentence structure, etc., and just said, "I want to learn English. I will look at a dicationary," clearly that would not work.
Right?
So, since you now understand and agree with the English example, let me state something that I hope is obvious to you by now: The API docs are your dictionary. They are not a substitute for learning the language basics.
Furthermore, once you know the language basics in English and have your dictionary, you still won't know how to write a resume (which you may know as a CV). You will look at examples and perhaps take a course on resume (CV) writing. Just reading a dictionary won't help you write a resume(CV). Similarly, if you know some Java basics, you can't learn how to write a Swing app just by reading the Javadocs. You'll look at tutorials and examples. Then, once you know the basic structure of a Swing app, you'll look to the javadocs for more details about more kinds of GUI classes--different buttons and windows and panes and panels and layout managers, etc. -
help needed for writing query
i have the following tables(with data) as mentioned below
FK*-foregin key (SUBJECTS)
FK**-foregin key (COMBINATION)
1)SUBJECTS(table name)
SUB_ID(NUMBER) SUB_CODE(VARCHAR2) SUB_NAME (VARCHAR2)
2 02 Computer Science
3 03 Physics
4 04 Chemistry
5 05 Mathematics
7 07 Commerce
8 08 Computer Applications
9 09 Biology
2)COMBINATION
COMB_ID(NUMBER) COMB_NAME(VARCHAR2) SUB_ID1(NUMBER(FK*)) SUB_ID2(NUMBER(FK*)) SUB_ID3(NUMBER(FK*)) SUBJ_ID4(NUMBER(FK*))
383 S1 9 4 2 3
384 S2 4 2 5 3
---------I actually designed the ABOVE table also like this
3) a)COMBINATION
COMB_ID(NUMBER) COMB_NAME(VARCHAR2)
383 S1
384 S2
b)COMBINATION_DET
COMBDET_ID(NUMBER) COMB_ID(FK**) SUB_ID(FK*)
1 383 9
2 383 4
3 383 2
4 383 3
5 384 4
6 384 2
7 384 5
8 384 3
Business rule: a combination consists of a maximum of 4 subjects (must contain)
and the user is less relevant to a COMB_NAME(name of combinations) but user need
the subjects contained in combinations
i need the following output
COMB_ID COMB_NAME SUBJECT1 SUBJECT2 SUBJECT3 SUBJECT4
383 S1 Biology Chemistry Computer Science Physics
384 S2 Chemistry Computer Science Mathematics Physics
or even this is enough(what i actually needed)
COMB_ID subjects
383 Biology,Chemistry,Computer Science,Physics
384 Chemistry,Computer Science,Mathematics,Physics
you can use any of the COMBINATION table(either (2) or (3))
and i want to know
1)which design is good in this case
(i think SUB_ID1,SUB_ID2,SUB_ID3,SUB_ID4 is not a
good method to link with same table but if 4 subjects only(and must) comes
detail table is not neccessary )
now i am achieving the result by program-coding in C# after getting the rows from oracle
i am using oracle 9i (also ODP.NET)
i want to know how can i get the result in the stored procedure itsef.
2)how it could be designed in any other way.
any help/suggestion is welcome
thanks for your time --PradeeshWell I forgot the table-alias, here now with:
SELECT C.COMB_ID
, C.COMB_NAME
, (SELECT SUB_NAME
FROM SUBJECTS
WHERE SUB_ID = C.SUB_ID1) AS SUBJECT_NAME1
, (SELECT SUB_NAME
FROM SUBJECTS
WHERE SUB_ID = C.SUB_ID2) AS SUBJECT_NAME2
, (SELECT SUB_NAME
FROM SUBJECTS
WHERE SUB_ID = C.SUB_ID3) AS SUBJECT_NAME3
, (SELECT SUB_NAME
FROM SUBJECTS
WHERE SUB_ID = C.SUB_ID4) AS SUBJECT_NAME4
FROM COMBINATION C;
As you need exactly 4 subjects, the columns-solution is just fine I would say. -
Urgent help needed with un-removable junk mail that froze Mail!!
Urgent help needed with un-removable junk mail that froze Mail?
I had 7 junk mails come in this morning, 5 went straight to junk and 2 more I junked.
When I clicked on the Junk folder to empty it, it froze Mail and I can't click on anything, I had to force quit Mail and re-open it. When it re-opens the Junk folder is selected and it is froze, I can't do anything.
I repaired permissions, it did nothing.
I re-booted my computer, on opening Mail the In folder was selected, when I selected Junk, again, it locks up Mail and I can't select them to delete them?
Anyone know how I can delete these Junk mails from my Junk folder without having to open Mail to do it as it would appear this will be the only solution to the problem.Hi Nigel
If you hold the Shift key when opening the mail app, it will start up without any folders selected & no emails showing. Hopefully this will enable you to start Mail ok.
Then from the Mail menus - choose Mailbox-Erase Junk Mail . The problem mail should now be in the trash. If there's nothing you want to retain from the Trash, you should now choose Mailbox- Erase Deleted Messages....
If you need to double-check the Trash for anything you might want to retain, then view the Trash folder first, before using Erase Junk Mail & move anything you wish to keep to another folder.
The shift key starts Mail in a sort of Safe mode.
Maybe you are looking for
-
Payment advice through E mail or Fax
Dear Gurus, My client wants to send the payment advice generated by the automatic payment program (F110) to his vendors through Email and/or Fax ie at the end of the APP run, the payment advice should be sent through Fax or mail by the system. Pl le
-
I notice date and time settings on some of my iBooks do not hold,but some do...Is there a difference in say the 300 vs the 366/466 or is it just whether or not their battery is good or not, or if they have airport cards and 'set date/time automatical
-
Changing Billing Schedule Level for OM originated Service Contracts
Hi, When we create a Service Contract from Order Management, the Billing Schedule Level is always set to Top Level and only one Billing Stream gets created. Can we get the Billing Schedule Level changed to other Levels viz., Equal Amount or Covered L
-
Ive downloaded a TV programme on itunes and when I click to view it I get an error message "itunes has stopped working" and it shuts down Please help
-
Hi, I have started developing with iPhone less than one month ago. Im still following tutorials and guide books and in one of them I learnt how to open in Safari an URL with openURL. I was just wondering if it is possible to open a local HTML file wi