Need to insert 'end of line' while writing to a file
I am writing strings to a file using FileWriter, but have a problem writing each string on a new line.
Here is a sample of my Code
FileWriter MyFileWriter = new FileWriter(ToFile);
while (NotDone){
MyFileWriter.write(MyListModel.getElementAt(OrderListIndex) +"\n");
OrderFileWriter.close();
As the result, in my new file all strings appear on the same line with a weird character at the end representing new line.
Any suggestions on how to write each string on a new line?
I am sorry.. what i gave was not the line seperator charecter....
You can use either
String sep=System.getProperty("line.separator");
MyFileWriter.write(MyListModel.getElementAt(OrderListIndex) +sep);or use a PrintWriter
PrintWriter MyFileWriter = new PrintWriter(new BufferedWriter(new FileWriter(ToFile)));
//FileWriter MyFileWriter = new FileWriter(ToFile);
while (NotDone){
MyFileWriter.write(MyListModel.getElementAt(OrderListIndex));
MyFileWriter.newLine()
}Hope it helped
Similar Messages
-
Hi,
I am getting an error while writing to a file.Here is the sample code in which I am getting error.The STDERR is getting printed to console but the same is not getting written to a file.
package Sample;
import java.util.*;
import java.io.*;
public class MediocreExecJavac
public static void main(String args[])
try
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("perl ic_start");
InputStream stderr = proc.getErrorStream();
InputStreamReader isr = new InputStreamReader(stderr);
BufferedReader br = new BufferedReader(isr);
FileWriter fw=new FileWriter("result.txt");
String line = null;
System.out.println("<ERROR>");
while ( (line = br.readLine()) != null)
System.out.println(line);
fw.write(line);
System.out.println("</ERROR>");
int exitVal = proc.waitFor();
System.out.println("Process exitValue: " + exitVal);
fw.close();
} catch (Throwable t)
t.printStackTrace();
}Below is the output -
<ERROR>
Can't open perl script "ic_start": No such file or directory
java.lang.NullPointerException
at java.io.Writer.write(Unknown Source)
at Sample.MediocreExecJavac.main(MediocreExecJavac.java:21)
Please tell where the program is going wrong.i think it is just the path of file that u r missing
-
API5317: Error occured while writing to archive file
We have been making daily archives for weeks and then one morning started getting this error:
API5317: Error occured while writing to archive file f:\OWB\Archives\Daily\backups\Friday\projects\erm_phase1\project.mdl
We have checked space on the disc, and running the archive from different PCs. Is possible that there is a limit on the archive file? The archive file is in the order of 21M. I am worried about the upgrade to the new version if we cannot make archives. Any suggestions?Marlene,
Which OWB version are you using and what is the database version?
Regards:
Igor -
Code for JProgressbar for monitoring while writing into a files
Could anybody help me in sample code to implement a JProgressbar while writing into a file.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.lang.reflect.*; // for InvocationTargetException
public class Test extends JApplet {
private JProgressBar pb = new JProgressBar();
public void init() {
Container contentPane = getContentPane();
final JButton startButton = new JButton("start");
contentPane.setLayout(new FlowLayout());
contentPane.add(startButton);
contentPane.add(pb);
startButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GetInfoThread t = new GetInfoThread(Test.this);
t.start();
// this is okay because actionPerformed
// is called on the event dispatch thread
startButton.setEnabled(false);
public JProgressBar getProgressBar() {
return pb;
class GetInfoThread extends Thread {
Runnable getValue, setValue;
int value, currentValue;
public GetInfoThread(final Test applet) {
getValue = new Runnable() {
public void run() {
JProgressBar pb = applet.getProgressBar();
currentValue = pb.getValue();
setValue = new Runnable() {
public void run() {
JProgressBar pb = applet.getProgressBar();
pb.setValue(value);
public void run() {
while(true) {
try {
Thread.currentThread().sleep(500);
// This is okay because the getValue's run()
// is invoked on the event dispatch thread
value = (int)(Math.random() * 100);
try {
SwingUtilities.invokeAndWait(getValue);
catch(InvocationTargetException ite) {
ite.printStackTrace();
catch(InterruptedException ie) {
ie.printStackTrace();
if(currentValue != value) {
SwingUtilities.invokeLater(setValue);
catch(InterruptedException e) {
e.printStackTrace();
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.lang.reflect.*; // for InvocationTargetException
public class Test extends JApplet {
private JProgressBar pb = new JProgressBar();
public void init() {
Container contentPane = getContentPane();
final JButton startButton = new JButton("start");
contentPane.setLayout(new FlowLayout());
contentPane.add(startButton);
contentPane.add(pb);
startButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GetInfoThread t = new GetInfoThread(Test.this);
t.start();
// this is okay because actionPerformed
// is called on the event dispatch thread
startButton.setEnabled(false);
public JProgressBar getProgressBar() {
return pb;
class GetInfoThread extends Thread {
Runnable getValue, setValue;
int value, currentValue;
public GetInfoThread(final Test applet) {
getValue = new Runnable() {
public void run() {
JProgressBar pb = applet.getProgressBar();
currentValue = pb.getValue();
setValue = new Runnable() {
public void run() {
JProgressBar pb = applet.getProgressBar();
pb.setValue(value);
public void run() {
while(true) {
try {
Thread.currentThread().sleep(500);
// This is okay because the getValue's run()
// is invoked on the event dispatch thread
value = (int)(Math.random() * 100);
try {
SwingUtilities.invokeAndWait(getValue);
catch(InvocationTargetException ite) {
ite.printStackTrace();
catch(InterruptedException ie) {
ie.printStackTrace();
if(currentValue != value) {
SwingUtilities.invokeLater(setValue);
catch(InterruptedException e) {
e.printStackTrace(); -
How to insert new line char while writing bytes into file
Hello Sir,
Is it possible to insert the new line character in set of String variables and stored them into bytearray ,then finally write into File?
This is the sample code which i tried:
File f = new File(messagesDir,"msg" + msgnum + ".txt");
FileOutputStream fout = new FileOutputStream(f);
String fromString = "From: "+msg.getFrom()+"\n";
String toString = "To: "+msg.getTo()+"\n";
String dateString = "Sent: "+msg.getDate()+"\n";
String msgString =msg.getBody()+"\n";
String finalString=fromString+toString+dateString+msgString;
byte[] msgBytes = finalString.getBytes();
fout.write(msgBytes);
fout.close();in the above code , i tried to add the new line as "\n" in end of each string. but when i look into the generated files msg1.txt , it contains some junk char [] .
please provide me the help
regards
venkibut it has still shown the the junk char, its not able
to create the new line in the created file i am afraid
how am i going to get the solution?:(Do not be afraid dear sir. You are obviously using a windows operating system or a mac operating system. On windows a newline is "\r\n" not '\n', and on a mac a newline is '\r', not '\n'. If you make that correction, dear sir, your program will work.
However, there is a better way. First, you probably want to buffer your output if you are going to write more than one time to the file, which will make writing to the file more efficient. In addition, when you buffer your output, you can use the newLine() method of the BufferedWriter object to insert a newline. The newline will be appropriate for the operating system that the program is running on. Here is an example:
File f = new File("C:/TestData/atest.txt");
BufferedWriter out = new BufferedWriter(new FileWriter(f) );
String fromString = "From: Jane";
out.write(fromString);
//Not written to the file until enough data accumulates.
//The data is stored in a buffer until then.
out.newLine();
String toString = "To: Dick";
out.write(toString);
out.newLine();
String dateString = "Sent: October 27, 2006";
out.write(dateString);
out.newLine();
out.close();
//Causes any unwritten data to be flushed from
//the buffer and written to the file. -
At the end of line # is coming in output file at application directory
Hi experts,
I am doing a file to file tunneling in which from a file server I am picking the file and putting it into SAP application server nothing is done in IR .However when the file is reaching in application server its end seprator is coming as # .I am surprised from where the #is coming at the end of every line.When i am dowloading the same file to my local directory in that file # is not there.
Please help me as my client is not accepting the file with endsepeartor as # .
Might be # is coming as the apllication server is in uniq env . But how to get rid of it .Please guide me with whatever input you have in this regard.
Regards,
NehaHi Neha,
I think you do not have to do anything because see you said on saving the file locally, you are not able to see the # character at the end of line..........but when you are seeing in SAP window, then this # character is displayed..............so your SAP server can be a UNIX server and it is displaying the End of Line and Carriage Return ASCII characters as # because these are non-displayable characters.....
But still if you do not want this # character to be displayed, then you can try Binary and no character encoding........then see if your file is displayed without # character.
Regards,
Rajeev Gupta -
Need to insert values into a table from a XML file
Hi,
I'm an Oracle 9i/10g DBA with quite a few years experience, but I'm new to XML and dealing with it in database terms. I've been given a project that entails pulling XML values out of a file (or 100's of them) and storing them in the database so that they are searchable by end-users. The project is classified as secret so I'm unable to upload the specific XML or any info relating to the structire of the XML or the table I will use to insert the values into - sorry!! So, I've created an XML file with a similar structure to help people understand my predicament.
The end-users only need to search on a subset of the total amount of columns from the table I'll insert data into, although the XML file has a lot more, so I dont need to store the other values - but I will need to store the name of the XML file (or a pointer to it so I know what XML file a particular set of values belong to) in another column of the table along with its associated values.
I've been using the XMLTABLE function with some degree of success, although I had better succes using the XMLSEQUENCE function. However, I found out this is deprecated in 10g and replaced with XMLTABLE, so I guess it's better if I use this in case we ever need to upgrade to 11g.
The main problem I've been having is that some elements in the XML files have multiple values for the one record when all the other records are the same. In terms of storing this in the database, I guess it would mean inserting multiple rows in the table for each element where the value differs. Here is a dumbed down XML file similar to what I've got along with the other SQL I've used:
+<?xml version="1.0" encoding="UTF-8"?>+
+<House>+
+<Warehouse>+
+<WarehouseId>1</WarehouseId>+
+<WarehouseName>+
+<Town>Southlake</Town>+
+<State>Texas</State>+
+</WarehouseName>+
+<Building>Owned</Building>+
+<Area>25000</Area>+
+<Docks>2</Docks>+
+<DockType>Rear load</DockType>+
+<WaterAccess>true</WaterAccess>+
+<RailAccess>N</RailAccess>+
+<Parking>Street</Parking>+
+<VClearance>10</VClearance>+
+</Warehouse>+
+<Warehouse>+
+<WarehouseId>2</WarehouseId>+
+<WarehouseName>+
+<Town>Poole</Town>+
+<State>Dorset</State>+
+</WarehouseName>+
+<WarehouseName>+
+<Town>Solihull</Town>+
+<County>West Midlands</State>+
+</WarehouseName>+
+<Building>Owned</Building>+
+<Area>40000</Area>+
+<Docks>5</Docks>+
+<DockType>Rear load</DockType>+
+<WaterAccess>true</WaterAccess>+
+<RailAccess>N</RailAccess>+
+<Parking>Bay</Parking>+
+<VClearance>10</VClearance>+
+</Warehouse>+
+<Warehouse>+
+<WarehouseId>3</WarehouseId>+
+<WarehouseName>+
+<Town>Fleet</Town>+
+<County>Hampshire</County>+
+</WarehouseName>+
+<Building>Owned</Building>+
+<Area>10000</Area>+
+<Docks>1</Docks>+
+<DockType>Side load</DockType>+
+<WaterAccess>false</WaterAccess>+
+<RailAccess>N</RailAccess>+
+<Parking>Bay</Parking>+
+<VClearance>20</VClearance>+
+</Warehouse>+
+</House>+
CREATE TABLE xmltest OF XMLTYPE;
INSERT INTO xmltest
VALUES(xmltype(bfilename('XML_DIR', 'test.xml'), nls_charset_id('AL32UTF8')));
Consequently, I need to...
1) Retrieve the results from the XML file for all 3 warehouses where multiple values for the same sub-element are shown as 2 rowsthe result set. (I am guessing there will be 4 rows returned as warehouse sub-2 has 2 different elements for <WarehouseName>.
2) Build a case statement into the query so that regardless of the sub-element name (i.e State or County), it is returned into the 1 column, for instance County.
So, if I run a query similar to the following...
select y.WarehouseId, y.Town, y.County, y.Area
from xmltest x, xmltable('/House/Warehouse' .......
I would like to get results back like this...
ID Town County Area
1 Southlake Texas 25000
2 Poole Dorset 40000
2 Solihull West Midlands 40000
3 Fleet hampshire 10000
Sorry for the non-formatting but I hope this all makessense to someone out there with what I'm trying to do.
I appreciate any help whatsoever because, as i said before, I'm totally new to XML and trying to read the vast amount of information there is out there on XML is all a bit daunting.
Many thanks in advance,
Shaun.Hi again,
Thanks for keeping the post open for me. I've had a look at the post illustrating the XFileHandler package, and tried to alter it to make it fit with my XML files. To help explain things, my XML file looks like this:
<?xml version="1.0"?>
<!DOCTYPE CMF_Doc SYSTEM "CMF_Doc.dtd">
<House>
<Warehouse>
<WarehouseId>1</WarehouseId>
<WarehouseName>
<Town>Southlake</Town>
<State>Texas</State>
</WarehouseName>
<Building>Owned</Building>
<Area>25000</Area>
<Docks>2</Docks>
<DockType>Rear load</DockType>
<WaterAccess>true</WaterAccess>
<RailAccess>N</RailAccess>
<Parking>Street</Parking>
<VClearance>10</VClearance>
</Warehouse>
<Warehouse>House
<WarehouseId>2</WarehouseId>
<WarehouseName>
<Town>Poole</Town>
<State>Dorset</State>
</WarehouseName>
<WarehouseName>
<Town>Solihull</Town>
<County>West Midlands</County>
</WarehouseName>
<Building>Owned</Building>
<Area>40000</Area>
<Docks>5</Docks>
<DockType>Rear load</DockType>
<WaterAccess>true</WaterAccess>
<RailAccess>N</RailAccess>
<Parking>Bay</Parking>
<VClearance>10</VClearance>
</Warehouse>
<Warehouse>
<WarehouseId>3</WarehouseId>
<WarehouseName>
<Town>Fleet</Town>
<County>Hampshire</County>
</WarehouseName>
<Building>Owned</Building>
<Area>10000</Area>
<Docks>1</Docks>
<DockType>Side load</DockType>
<WaterAccess>false</WaterAccess>
<RailAccess>N</RailAccess>
<Parking>Bay</Parking>
<VClearance>20</VClearance>
</Warehouse>
</House>
<?xml version="1.0" encoding="UTF-8"?>
<House>
<Warehouse>
<WarehouseId>4</WarehouseId>
<WarehouseName>
<Town>Dallas</Town>
<State>Texas</State>
</WarehouseName>
<Building>Owned</Building>
<Area>25000</Area>
<Docks>2</Docks>
<DockType>Rear load</DockType>
<WaterAccess>true</WaterAccess>
<RailAccess>N</RailAccess>
<Parking>Street</Parking>
<VClearance>10</VClearance>
</Warehouse>
<Warehouse>
<WarehouseId>5</WarehouseId>
<WarehouseName>
<Town>Dorchester</Town>
<State>Dorset</State>
</WarehouseName>
<WarehouseName>
<Town>Solihull</Town>
<County>West Midlands</County>
</WarehouseName>
<Building>Owned</Building>
<Area>40000</Area>
<Docks>5</Docks>
<DockType>Rear load</DockType>
<WaterAccess>true</WaterAccess>
<RailAccess>N</RailAccess>
<Parking>Bay</Parking>
<VClearance>10</VClearance>
</Warehouse>
<Warehouse>
<WarehouseId>6</WarehouseId>
<WarehouseName>
<Town>Farnborough</Town>
<County>Hampshire</County>
</WarehouseName>
<Building>Owned</Building>
<Area>10000</Area>
<Docks>1</Docks>
<DockType>Side load</DockType>
<WaterAccess>false</WaterAccess>
<RailAccess>N</RailAccess>
<Parking>Bay</Parking>
<VClearance>20</VClearance>
</Warehouse>
</House>
<?xml version="1.0" encoding="UTF-8"?>
<House>
<Warehouse>
<WarehouseId>7</WarehouseId>
<WarehouseName>
<Town>Southlake</Town>
<State>Texas</State>
</WarehouseName>
<Building>Owned</Building>
<Area>25000</Area>
<Docks>2</Docks>
<DockType>Rear load</DockType>
<WaterAccess>true</WaterAccess>
<RailAccess>N</RailAccess>
<Parking>Street</Parking>
<VClearance>10</VClearance>
</Warehouse>
<Warehouse>
<WarehouseId>8</WarehouseId>
<WarehouseName>
<Town>Bournemouth</Town>
<State>Dorset</State>
</WarehouseName>
<WarehouseName>
<Town>Shirley</Town>
<County>West Midlands</County>
</WarehouseName>
<Building>Owned</Building>
<Area>30000</Area>
<Docks>5</Docks>
<DockType>Rear load</DockType>
<WaterAccess>true</WaterAccess>
<RailAccess>N</RailAccess>
<Parking>Bay</Parking>
<VClearance>10</VClearance>
</Warehouse>
<Warehouse>
<WarehouseId>9</WarehouseId>
<WarehouseName>
<Town>Clapham</Town>
<County>London</County>
</WarehouseName>
<Building>Owned</Building>
<Area>10000</Area>
<Docks>1</Docks>
<DockType>Side load</DockType>
<WaterAccess>false</WaterAccess>
<RailAccess>N</RailAccess>
<Parking>Bay</Parking>
<VClearance>20</VClearance>
</Warehouse>
</House>And the XFilehandler package looks like this (I'm just trying to do a simple select only on WarehouseId & WaterAccess for the time being to keep things simple):
create or replace package XFileHandler as
TYPE TRECORD IS RECORD (
WID NUMBER(2)
, WACCESS VARCHAR2(5)
type TRecordTable is table of TRecord;
function getRows (p_directory in varchar2, p_filename in varchar2) return TRecordTable pipelined;
end;
create or replace package body XFileHandler is
function getRows (p_directory in varchar2, p_filename in varchar2)
return TRecordTable pipelined
is
nb_rec number := 1;
tmp_xml clob;
tmp_file clob;
rec TRecord;
begin
DBMS_LOB.CREATETEMPORARY(TMP_FILE, TRUE);
tmp_file := dbms_xslprocessor.read2clob(p_directory, p_filename);
LOOP
tmp_xml := regexp_substr(tmp_file, '<\?xml[^?]+\?>\s*<([^>]+)>.*?</\1>', 1, nb_rec, 'n');
exit when length(tmp_xml) = 0;
--dbms_output.put_line(tmp_rec);
nb_rec := nb_rec + 1;
select y.WID, y.WACCESS
into rec.WID, rec.WACCESS
from xmltable('/House' passing xmltype(tmp_xml)
columns WID NUMBER(2) PATH 'Warehouse/WarehouseId',
WACCESS VARCHAR2(5) PATH 'WaterAccess') y;
pipe row ( rec );
end loop;
dbms_lob.freetemporary(tmp_file);
return;
end;
end;Now, when I run the query:
select * from table(XFileHandler.getRows('XML_DIR', 'XFileHandler_test.xml'));I get the error: ORA-00600: internal error code, arguments: [17285], [0x5CFE8DC8], [4], [0x45ABE1C8], [], [], [], []
I had a look in the dump file for anything obvious, but nothing really stands out. Is there anything obvious in my code that I'm missing or something else which you may think could be causing this error, e.g in the regular expression regexp_substr?
Many thanks,
Shaun. -
Error While Writing to Target FIle
Hi
I am executing an interface which reads data from a delimited file and writes into another delimited file.
But while executing the interface i am getting the following error
ODI-1227: Task I_FILE_TO_FILE (Integration) fails on the source ORACLE connection DWH_TARGET.
Caused By: java.sql.SQLSyntaxErrorException: ORA-00923: FROM keyword not found where expected
To let u know te background i am using Staging Area Different Than Target
LKM is LKM File to SQL
IKM: IKM SQL to file Append
Kindly let me know where am i doing wrong??
regards
GSSource Code
select
C1_ORD_NO ORDER,
C2_QTY1 QUANTITY1,
C3_QTY2 QUANTITY2,
C4_QTY3 QUANTITY3
from ODI_TARGET.C$_0FILE_ORDER
where
(1=1)
Target Code
insert into "D:/GSANKAR/FILE_ORDER.txt"
ORDER,
QUANTITY1,
QUANTITY2,
QUANTITY3
values
:ORDER,
:QUANTITY1,
:QUANTITY2,
:QUANTITY3
/*$$SNPS_START_KEYSNP$CRDWG_TABLESNP$CRTABLE_NAME=FILE_ORDERSNP$CRLOAD_FILE=D:/GSANKAR/FILE_ORDER.txtSNP$CRFILE_FORMAT=DSNP$CRFILE_SEP_FIELD=0x007cSNP$CRFILE_SEP_LINE=0x000D0x000ASNP$CRFILE_FIRST_ROW=1SNP$CRFILE_ENC_FIELD=SNP$CRFILE_DEC_SEP=SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=ORDERSNP$CRTYPE_NAME=STRINGSNP$CRORDER=1SNP$CRLENGTH=50SNP$CRPRECISION=50SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=QUANTITY1SNP$CRTYPE_NAME=STRINGSNP$CRORDER=2SNP$CRLENGTH=10SNP$CRPRECISION=10SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=QUANTITY2SNP$CRTYPE_NAME=STRINGSNP$CRORDER=3SNP$CRLENGTH=10SNP$CRPRECISION=10SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=QUANTITY3SNP$CRTYPE_NAME=STRINGSNP$CRORDER=4SNP$CRLENGTH=10SNP$CRPRECISION=10SNP$CR$$SNPS_END_KEY*/
regards
GS -
Error while writing to a file from pl/sql
Hi,
I am trying to execute the following script but i get the following error ;
declare
emp_rec emp%ROWTYPE;
file_id UTL_FILE.FILE_TYPE;
BEGIN
file_id := utl_file.FOPEN ('C:\test','test.txt','w');
FOR emp IN (SELECT employee_id FROM employees)
LOOP
utl_file.PUT_LINE( file_id, emp.employee_id );
END LOOP;
utl_file.fCLOSE(file_id);
END;
ORA-04068: e[b]xisting state of packages has been discarded
ORA-04067: not executed, package body "SCOTT.UTL_FILE" does not exist
ORA-06508: PL/SQL: could not find program unit being called
ORA-06512: at line 5
What is the reason for this error ??
I have given execute privilge to SCOTT on the package utl_file.UTL_FILE comes as part of the database, you shouldn't have to install it, and you most certainly shouldn't install it as SCOTT. System packages should be installed using a system user such as sys.
Firstly, I would suggest dropping the UTL_FILE package from your scott schema and then logging on as sys and granting execute permission on UTL_FILE to the scott user.
Secondly...
The UTL_FILE_DIR parameter has been deprecated by oracle in favour of direcory objects because of it's security problems.
The correct thing to do is to create a directory object e.g.:
CREATE OR REPLACE DIRECTORY mydir AS 'c:\myfiles';Note: This does not create the directory on the file system. You have to do that yourself and ensure that oracle has permission to read/write to that file system directory.
Then, grant permission to the users who require access e.g....
GRANT READ,WRITE ON DIRECTORY mydir TO myuser;Then use that directory object inside your FOPEN statement e.g.
fh := UTL_FILE.FOPEN('MYDIR', 'myfile.txt', 'r');Note: You MUST specify the directory object name in quotes and in UPPER case for this to work as it is a string that is referring to a database object name which will have been stored in uppercase by default. -
Is is possible to read a file while writing the same file at time in java?
Hi ,
I am reading a MSAccess file (mdb) from one location to another location .but the source file is an online database which will chage regularly .so while reading that file i am getting error like
FileNotFoundException.
java.io.FileNotFoundException: c:\Msaccess\db2.mdb (The process cannot access the file because it is being used by another
s)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at read.main(read.java:16)alphabet soup,
Yes, windows helpfully prevents two processes from accessing a file simultaneously. Operating Systems on the other hand uniformly support it.
Which probably doesn't help you very much, as I imagine that you can't just up and change the source machine over to *nix, but there you have it.
You'll just have to close the program which has the database open, copy the database, and restart the program which uses the database.
keith.
Message was edited by: corlettk -
Problem while writing in a file
Hi,
i want to write some bytes in a file but it is producing an error
error:
====
java.io.FileNotFoundException: C:\Documents and Settings\rrus\My Documents\data.pkcs7data (The system cannot find the path specified)
code:
====
File obj_file = new File(System.getProperty("user.home")+"/My Documents/Signature.sig");
if(!obj_file.exists())
obj_file.createNewFile();
FileOutputStream obj_fout = new FileOutputStream(obj_file);
obj_fout.write(m_bData); // m_bData is byte array
obj_fout.flush();
obj_fout.close();And:
C:\Documents and Settings\rrus\My Documents\data.pkcs7data
File obj_file = new File(System.getProperty("user.home")+"/My Documents/Signature.sig");Something doesn't quite match here. Your eror message does not match your code. -
Flash Pro CS6 BUG - inconsistent end of line for xml files in library saved in xfl - MESSES UP SVN
When saving in XFL with Flash CS6 on Mac (it also happened in CS5.5), the generated xml files in library often have inconsistend end of line, which blocks SVN commits and I have to manually go in the files and make them consistent.
The XML nodes themselves all have \r\l as end of line, while, within <[CDATA[]]>, they only have \r.
We think this happens only when creating new library items on mac, on windows it doesn't happen.
This slows us down incredibly when working on a team using svn.
SVN doesn't upload files with inconsistend line ending.
Line ending shoul be consistent within the same xml file to make svn operations smooth.
Check an image of the bug:
http://www.pippoflash.com/_test/flash_bug_eof.png
you can see clearly the differences.
thank you
FilippoThanks Filippo, I could see that now!
While I was investigating this, I found that this is even happening on a file created and saved on just Windows. I was able to reproduce this using the following steps
- Create a new AS3 file on Windows
- Drag out a component to the stage say a Button component from the User Interface section of the Components panel
- Convert the button component to a Movie Clip Symbol
- Save the file as XFL and examine the Library XML files (the End of Line is just 'LF' in CDATA section whereas it is 'CR LF' everywhere else)
Since you were saying 'Items created in windows have no problem', does that means, SVN can commit those without any issues for you? And do you face problem only when the file is Created and Saved on Mac(where the end of line is just LF every where) but Modified and Re-saved on Windows(where the end of line is inconsistent)?
Thanks!
Mohan -
Wanna skip exact number lines while reading a file file
Hi all,
I would like to skip exact number of lines while reading a text file.
Let's say I wanna read this text file starting from line no N.
And so I need to skip from fist line to N-1th line.
Does anyone give me a way to do?
Pls with a sample code if possible coz I am not familiar much to java. :PLineNumberReader class keeps track on line number for you. Sample that skip arg3 lines while copy arg1 file to arg2. Just sample no check, no cleanup.
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.LineNumberReader;
public class Main {
public static void main(String... args) throws Exception {
if (args.length != 3)
throw new IllegalArgumentException("Arguments: infile outfile line_from");
LineNumberReader reader = new LineNumberReader(
new FileReader(new File(args[0])) );
BufferedWriter writer = new BufferedWriter(
new FileWriter(new File(args[1])) );
int readFrom = Integer.valueOf(args[2]);
// skip first lines
while(reader.getLineNumber() < readFrom) {
if (reader.readLine() == null)
throw new IllegalArgumentException("Too few lines");
// write tail
String line = null;
while((line = reader.readLine()) != null) {
writer.write(line);
writer.newLine();
writer.flush();
} -
ORA-48913: Writing into trace file failed
Hi
my OS: OUL5x64
DB: 11.1.0.7
receive this error in alert.log but could not figure out which parameter to increase.
Can someone please help.
Non critical error ORA-48913 caught while writing to trace file
Error message: ORA-48913: Writing into trace file failed, file size limit [10485760] reached
the suggestion:
ORA-48913: Writing into trace file failed
*Cause:An attempt was made to write into a trace file that exceeds the trace's file size limit
*Action:increase the trace's file size limit.
Thanks in advance.Hi ,
I have one more doubt :
ORACLE_SID=XXXX
/XXXX/XX/ofaroot/XXXX/diag/rdbms/xxxx/XXXXX/trace
Non critical error ORA-48913 caught while writing to file "trace /XXXX/XX/ofaroot/XXXX/diag/rdbms/xxxx/XXXXX/trace/XXXX_ora_8218.trc"
Error message: ORA-48913: Writing into trace file failed, file size limit [10485760]everywhere its written to increase the parameter max_dump_file_size or to relocate the alert log, but as far as i understand ,
is this because a trace file with the name XXXX_ora_8218.trc was getting generated with a greater size than the one defined in max_dump_file_size. Is this what happened ?
Also , I am not able to find what directory does this parameter points to ? is it the trace directory or diag directory ?
i checked select * from v$diag_info ,but i could not find any conclusion.
Probably , on getting the above info , i will be able to decide where to move the alert.log to create space. -
BAPI to upload line items from a flat file to VA01
Hi guys,
I have a requirement wherein i need to upload data containing line items from a flat file to VA01.Please tell me how do i go about this.
Thanks and regards,
Frank.Hi
Frank this code might help u and this is the BAPI to create sales document BAPI_SALESDOCU_CREATEFROMDATA1 if i am helpful to u in any way plzz reward and dont forget to reward me plzzz
for any further quiries my mail id [email protected]
Include YCL_CREATE_SALES_DOCU *
Form salesdocu
This Subroutine is used to create Sales Order
-->P_HEADER Document Header Data
-->P_HEADERX Checkbox for Header Data
-->P_ITEM Item Data
-->P_ITEMX Item Data Checkboxes
-->P_LT_SCHEDULES_IN Schedule Line Data
-->P_LT_SCHEDULES_INX Checkbox Schedule Line Data
-->P_PARTNER text Document Partner
<--P_w_vbeln text Sales Document Number
DATA:
lfs_return like line of t_return.
FORM create_sales_document changing P_HEADER like fs_header
P_HEADERX like fs_headerx
Pt_ITEM like t_item[]
Pt_ITEMX like t_itemx[]
P_LT_SCHEDULES_IN like t_schedules_in[]
P_LT_SCHEDULES_INX like t_schedules_inx[]
Pt_PARTNER like t_partner[]
P_w_vbeln like w_vbeln.
This Perform is used to fill required data for Sales order creation
perform sales_fill_data changing p_header
p_headerx
pt_item
pt_itemx
p_lt_schedules_in
p_lt_schedules_inx
pt_partner.
Function Module to Create Sales and Distribution Document
perform sales_order_creation using p_header
p_headerx
pt_item
pt_itemx
p_lt_schedules_in
p_lt_schedules_inx
pt_partner.
perform return_check using p_w_vbeln .
ENDFORM. " salesdocu
Form commit_work
To execute external commit *
FORM commit_work .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = c_x
ENDFORM. " Commit_work
Include ycl_sales_order_header " To Fill Header data and Item data
Include ycl_sales_order_header.
Form return_check
To validate the sales order creation
FORM return_check using pr_vbeln type vbeln.
if pr_vbeln is initial.
LOOP AT t_return into lfs_return .
WRITE / lfs_return-message.
clear lfs_return.
ENDLOOP. " Loop at return
else.
perform commit_work. " External Commit
Refresh t_return.
fs_disp-text = text-003.
fs_disp-number = pr_vbeln.
append fs_disp to it_disp.
if p_del eq c_x or p_torder eq c_x or
p_pgi eq c_x or p_bill eq c_x.
perform delivery_creation. " Delivery order creation
endif. " If p_del eq 'X'......
endif. " If p_w_vbeln is initial
ENDFORM. " Return_check
*& Form sales_order_creation
text
-->P_P_HEADER text
-->P_P_HEADERX text
-->P_PT_ITEM text
-->P_PT_ITEMX text
-->P_P_LT_SCHEDULES_IN text
-->P_P_LT_SCHEDULES_INX text
-->P_PT_PARTNER text
FORM sales_order_creation USING P_P_HEADER like fs_header
P_P_HEADERX like fs_headerx
P_PT_ITEM like t_item[]
P_PT_ITEMX like t_itemx[]
P_P_LT_SCHEDULES_IN like t_schedules_in[]
P_P_LT_SCHEDULES_INX like t_schedules_inx[]
P_PT_PARTNER like t_partner[].
CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
EXPORTING
sales_header_in = p_p_header
sales_header_inx = p_p_headerx
IMPORTING
salesdocument_ex = w_vbeln
TABLES
return = t_return
sales_items_in = p_pt_item
sales_items_inx = p_pt_itemx
sales_schedules_in = p_p_lt_schedules_in
sales_schedules_inx = p_p_lt_schedules_inx
sales_partners = p_pt_partner.
ENDFORM. " sales_order_creation
Maybe you are looking for
-
Verizon GT704-WG-B modem. Sudden, frequent disconnects.
Hi, I've been searching on Google and reading forums everywhere for a solution yet I can't seem to find one anywhere. The closest to my issue was this post http://forums.verizon.com/t5/High-Speed-Internet-DSL-and-Dial/Connection-keeps-dropping/td-p/2
-
Customize content search web part results (CSWP)
Hi, How to change the date format in content search results (CSWP)? Now I get the results in below format , Tuesday,24 2014 I need to change the date like mm/dd/yyyy Thanks, Kaviya (Please remember to click "Mark as Answer" on the post that helps you
-
Unable to open Windows installer file sql_rs.msi
Hi all, I'm installing SQL Server 2008 r2 Enterprise edition in Windows server 2008 R2 for TFS setup. Previously i have tried Express Edition of SQl server. Later it was all uninstalled. I'm facing an issue during the installation, Unable to open the
-
Why can't i scroll down when viewing info on itunes
I currently trying to update my ipad with itunes, but when i try to update my calendars and emails itunes won't allow me to scroll down the bottom options. Is there a way to scroll down???
-
Hi gurus, Please tell is that possible to migrate 9.3 to 11.1.2.3 using migration wizard ? Thanks in advance...