Uploaded text file has a new line added at the top using BSP MVC applicatio
I have a BSP MVC application that uploads data on to the application server. When I open the uploaded text file, the very first line on the file looks like the line below. ->
htmlb:button:click:nullhtmlb_form_1UploadUpload0htmlbdfsdf
But the rest of the file looks okay. This is causing other than .txt files to get corrupted.
Here is the code from my DO_HANDLE_EVENT.
data: entity type ref to if_http_entity,
name type string,
content type xstring,
content_type type string,
idx type i value 1,
v_root(26) value '
houappl131\SRM_Download\',
v_unxfile(100),
v_transfer type xstring,
v_type(6),
v_len type i,
v_dirfile type zfileinfo,
v_ofile(80),
v_guid type guid_32.
class cl_htmlb_manager definition load.
data: v_asn(10) type n.
data: fu type ref to cl_htmlb_fileupload,
file_id type string value 'batchfile'.
data: o_page_context type ref to if_bsp_page_context.
data: parent type ref to cl_bsp_controller2,
lo_model type ref to cl_sus_m_asn_detail.
o_page_context = me->get_page_context( ).
cl_htmlb_manager=>dispatch_event_ex( request = request
page_context = o_page_context
event_handler = me ).
refresh z_batch->message.
if htmlb_event->server_event = 'Upload'.
fu ?= cl_htmlb_manager=>get_data( request = request id = file_id name
= 'fileUpload' ).
if fu->file_name gt space.
z_batch->parameters-fpath = fu->file_name.
v_len = strlen( z_batch->parameters-fpath ).
if v_len gt 4.
v_len = v_len - 3.
endif.
v_type = z_batch->parameters-fpath+v_len(3).
search z_batch->parameters-fpath for '.'.
if sy-fdpos gt 0 and v_len gt 0.
v_len = v_len - sy-fdpos.
v_type = z_batch->parameters-fpath+sy-fdpos(v_len).
endif.
clear v_asn.
v_asn = z_batch->parameters-asnhdr.
concatenate v_asn
z_batch->parameters-asnitem
z_batch->parameters-batch
v_type
into v_unxfile separated by '.'.
concatenate v_root v_unxfile into v_unxfile.
condense v_unxfile no-gaps.
open dataset v_unxfile for output in binary mode.
while idx <= request->num_multiparts( ).
entity = request->get_multipart( idx ).
name = fu->file_name .
if name is not initial.
content_type = entity->get_header_field( 'Content-Type' ).
clear content.
content = entity->get_data( ).
v_transfer = content.
transfer content to v_unxfile.
append content to z_batch->filetab.
endif.
idx = idx + 1.
endwhile.
close dataset v_unxfile.
endif.
endif.
Here is my fileupload button in the view
<htmlb:page title="File Upload " >
<htmlb:form method = "post"
encodingType = "multipart/form-data" >
<htmlb:label id = "Batchnum"
design = "Label"
for = "Batchnumber"
text = "Batch" />
<htmlb:inputField id = "Batchinput"
value = "//zbatch/parameters.batch" />
<htmlb:fileUpload id="batchfile" />
<htmlb:button id = "Upload"
text = "Upload"
onClick = "Upload" />
<htmlb:button id = "Close"
text = "Close window"
onClick = "Close" />
Any of you gurus know why this is happening?
I solved it myself
Similar Messages
-
Importing when source file has a new line
Hi,
While importing a pipe " | " delimted (will apply to any delimter) text file, I have Long text field from source system which is having Product Descriptions in it. Users have enterd the data in multiple lines in that field in the source system, which is a valid case .
When we have extracted the data from source & trying to Import in Import Manager, the "enter" is taking a new line & hence as a new row. How do I import the data keeping the new lines in MDM?
Product_Id|Description|Language
001|Test 1|EN
002|Test
2|EN
003|Test 3|GB
here the Product Id 002 should be imported in text large field with description having the new line character.
Thanks,
KetanOk so the best way is to extract your data from SQL server as XML format into this kind of format:
<?xml version="1.0" encoding="UTF-8"?>
<Products>
<Product>
<Product_Id>001</Product_Id>
<Description><<![CDATA[ Test 1]]></Description>
<Language>EN</Language>
</Product>
<Product>
<Product_Id>002</Product_Id>
<Description><<![CDATA[ Test
2]]></Description>
<Language>EN</Language>
</Product>
<Product>
<Product_Id>003</Product_Id>
<Description><<![CDATA[ Test 3]]></Description>
<Language>GB</Language>
</Product>
</Products>
It is the only way to handle carriage return in Import Manager; with delimited text it is not possible.
Let us know.
Edited by: cau vianney on Mar 1, 2010 3:17 PM
Edited by: cau vianney on Mar 1, 2010 3:19 PM -
Any option to Out-File -Append so new additions are at the top of the file?
Hello,
Many of my scripts create logentries which I 'append' to a log file, as in the following:
$LogEntry | Out-File MyLog.Txt -Append
This puts the newest entries at the bottom of the file so we need to scroll to get to the current data. Are there any techniques/options for adding the most current data to the 'top' of the file such that when you open the file, the most current data
is at the top?
Thanks in advance.
Thanks for your help! SdeDotAnother way that might be useful, depending on the nature of the logfile data, would be to append each new record to the end, but number the records and use csv format, i.e.:
1,"Existing data 5"
2,"Existing data 4"
3,"Existing data 3"
4,"Existing data 2"
5,"Existing data 1"
6,"Some new fancy data"
then to display it in reverse order you could either load it into excel and reverse sort by the sequence number, or read it into your script using import-csv, and use sort-object to display it in the order you want to see it in.
This suggestions is, admittedly, the more complex of the two. I suggest it for two reasons that might (or might not) apply in your case:
if the log file could be written asynchronously by multiple instances of your script, Mike's solution could cause the loss of data.
if the log file becomes excessively large, Mike's solution might create a performance issue
Al Dunbar -- remember to 'mark or propose as answer' or 'vote as helpful' as appropriate. -
Upload text file to oracle table with checking and aggregation
Hi Friends,
I am new to ODI. I have encountered a problem which is specific to ODI 11G (11.1.1.6.3) to upload text file to oracle table with checking and aggregation. Would you please teach me how to implement the following requirement in ODI 11G?
Input text file a:
staffCode, staffCat, status, data
input text file b:
staffCodeStart, staffCodeEnd, staffCat
temp output oracle table c:
staffCat, data
output oracle table d:
staffCat, data
order:
a.staffCode, a.staffCat, a.status
filter:
a.status = ‘active’
join:
a left outerjoin b on a.staffCode between b.staffCodeStart and b.staffCodeEnd
insert temp table c:
c.staffCat = if b.staffCat is not null then b.staffCat else a.staffCat
c.data = a.data
insert table d:
if c.staffCat between 99 and 1000 then d.staffCat = c.staffCat, d.data = sum(c.data)
else d.staffCat = c.staffCat, d.data = LAST(c.data)
Any help on fixing this is highly appreciated. Thanks!!
Thanks,
ChrisDear Santy,
Many thanks for your prompt reply. May I have more information about the LAST or SUM step?
I was successful to create and run the following interfaces p and q
1. Drag text file a to a newly created interface panel p
2. Filter text file a : a.status = ‘active’
3. Lookup text file a to text file b : a.staffCode between b.staffCodeStart and b.staffCodeEnd
4. Drag oracle temp table c to interface panel p
5. Set c.staffCat : CASE WHEN b.staffCat IS NULL THEN a.staffCat ELSE b.staffCat END
6. Set c.data : a.data
7. Drag oracle temp table c to a newly created interface panel q
8. Drag oracle table d to interface panel q
9. Set UK to d.staffCat
10. Set Distinct Rows to table d
11. Set d.staffCat = c.staffCat
12. Set d.data = SUM(c.data)
However, the interface q should be more than that:
If c.staffCat is between 99 and 1000, then d.data = the last record c.data; else d.data = sum(c.data)
Would you please teach me how to do the LAST or SUM steps? Moreover, can interface p and interface q be combined to one interface and do not use the temp table c? Millions thanks!
Regards,
Chris -
Problem: Problem
is occurring in docx format; it is not printing “New Line” character in extracted txt using IFilter (offfiltx.dll) while with doc file IFilter (OffFilt.dll) is working fine.
Environment: -
Operating
System:
Windows XP SP2/7
Language:
C#
MS
Office Version: - MS Office 2007/2010/2013
Problem
Description: -
We
havedocx
file with new line character, and we are processing this file in IFilter for extracting text, and it is giving output with concatenation of lines.
Docx
file format (Sample.docx)
Test this music
Word processing
Testing docx file
Output:
- Test this music Word processing Testing docx file
Requirement:
- We
have requirement to get following text in particular format with New Line from docx because client is using docx format only.
Test this music
Word processing
Testing docx file
Attempt:
We have tried a lot after changing IFilter configuration,
but it is not giving required output. Then we saved same file in doc format (Sample.doc), which is giving required output.
Because it is application specific problem, kindly
assist to resolve issue on priority. We are sharing IFilter paths for extracting text for doc and docx.
Doc Filter Location: - %systemroot%\system32\OffFilt.dll
Docx Filter Location: - <Drive>:\PROGRA~1\COMMON~1\MICROS~1\Filters\offfiltx.dll
Code Snippet for setting property of filter
internal static IFilter LoadAndInitIFilter(string fileName, string extension)
IFilter filter
= LoadIFilter(extension);
if (filter
== null)
return null;
IPersistFile persistFile
= (filter as IPersistFile);
if (persistFile
!= null)
persistFile.Load(fileName, 0);
IFILTER_FLAGS flags;
IFILTER_INIT iflags
=
IFILTER_INIT.CANON_HYPHENS
|
IFILTER_INIT.CANON_PARAGRAPHS
|
IFILTER_INIT.CANON_SPACES
|
IFILTER_INIT.APPLY_INDEX_ATTRIBUTES
|
IFILTER_INIT.HARD_LINE_BREAKS
|
IFILTER_INIT.FILTER_OWNED_VALUE_OK;
if (filter.Init(iflags,
0, IntPtr.Zero, out flags)
==IFilterReturnCode.S_OK)
return filter;
Marshal.ReleaseComObject(filter);
return null;
Kindly
assist to resolve this issue and also let us know if any input is required.
For any help, we would be really
thankful.Kindly
assist to resolve this issue and also let us know if any input is required.
For any help, we
would be really thankful. -
hi
i want to create BDC program for the data uploding.. but i dont hv much knwloadge of about it. i need to sample code the data upload program. i hv to upload text file format. im using gui_upload funtion if u hv any sample plz send me it plz... thnx
regad
nawaCheck the following code:
Selection screen :
SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME TITLE text-020.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001 .
PARAMETERS: p_locl RADIOBUTTON GROUP g1 " desktop file
DEFAULT 'X' USER-COMMAND fil,
p_phys RADIOBUTTON GROUP g1. " appln server file
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002 .
PARAMETERS: p_ifile TYPE dxfile-filename LOWER CASE, " source file
p_afile TYPE dxfile-filename LOWER CASE, " asset class file
p_cfile TYPE dxfile-filename LOWER CASE, " Cost center file
p_dfile TYPE dxfile-filename LOWER CASE, " Depr key file
p_ofile TYPE dxfile-filename LOWER CASE. " Audit file
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-015.
PARAMETERS: p_test RADIOBUTTON GROUP g2 DEFAULT 'X', " test run
p_create RADIOBUTTON GROUP g2. " data migretion
SELECTION-SCREEN END OF BLOCK b3.
SELECTION-SCREEN END OF BLOCK b4.
Main program :
REPORT zfaac900
LINE-SIZE 132
LINE-COUNT 65
NO STANDARD PAGE HEADING
MESSAGE-ID ZFAA.
* includes
INCLUDE: zfaac900_top,
zfaac900_selection_screen,
zfaac900_subroutine.
* AT SELECTION SCREEN ON VALUE REQUEST
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_ifile.
PERFORM help_input_file USING p_phys p_locl CHANGING p_ifile.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_afile.
PERFORM help_asset_file USING p_phys p_locl CHANGING p_afile.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_cfile.
PERFORM help_cost_file USING p_phys p_locl CHANGING p_cfile.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_dfile.
PERFORM help_depr_file USING p_phys p_locl CHANGING p_dfile.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_ofile.
PERFORM help_audit_file USING p_phys p_locl CHANGING p_ofile.
* AT SELECTION-SCREEN
AT SELECTION-SCREEN.
PERFORM check_screen USING p_ifile p_afile p_cfile p_dfile
p_ofile p_locl p_phys.
* TOP-OF-PAGE
TOP-OF-PAGE.
ULINE.
PERFORM sjm_heading IN PROGRAM zacai0005.
ULINE.
* START_OF_SELECTION
START-OF-SELECTION.
PERFORM get_input USING p_ifile p_afile p_cfile p_dfile
CHANGING i_input i_asset i_cost i_depr.
Subroutines :
*& Form help_input_file
* text
FORM help_input_file USING p_phys_file TYPE c
p_locl_file TYPE c
CHANGING p_source_path TYPE any.
IF p_phys_file EQ 'X'.
CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
EXPORTING
dynpfield_filename = 'P_IFILE'
dyname = sy-repid
dynumb = sy-dynnr
filetype = 'P'
location = 'A'.
ELSEIF p_locl_file EQ 'X'.
PERFORM help_local_file CHANGING p_source_path.
ENDIF.
ENDFORM. " help_input_file
*& Form help_asset_file
* text
FORM help_asset_file USING p_phys_file TYPE c
p_locl_file TYPE c
CHANGING p_source_path TYPE any.
IF p_phys_file EQ 'X'.
CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
EXPORTING
dynpfield_filename = 'P_AFILE'
dyname = sy-repid
dynumb = sy-dynnr
filetype = 'P'
location = 'A'.
ELSEIF p_locl_file EQ 'X'.
PERFORM help_local_file CHANGING p_source_path.
ENDIF.
ENDFORM. " help_asset_file
*& Form help_cost_file
* text
FORM help_cost_file USING p_phys_file TYPE c
p_locl_file TYPE c
CHANGING p_source_path TYPE any.
IF p_phys_file EQ 'X'.
CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
EXPORTING
dynpfield_filename = 'P_CFILE'
dyname = sy-repid
dynumb = sy-dynnr
filetype = 'P'
location = 'A'.
ELSEIF p_locl_file EQ 'X'.
PERFORM help_local_file CHANGING p_source_path.
ENDIF.
ENDFORM. " help_cost_file
*& Form help_depr_file
* text
FORM help_depr_file USING p_phys_file TYPE c
p_locl_file TYPE c
CHANGING p_source_path TYPE any.
IF p_phys_file EQ 'X'.
CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
EXPORTING
dynpfield_filename = 'P_DFILE'
dyname = sy-repid
dynumb = sy-dynnr
filetype = 'P'
location = 'A'.
ELSEIF p_locl_file EQ 'X'.
PERFORM help_local_file CHANGING p_source_path.
ENDIF.
ENDFORM. " help_depr_file
*& Form help_audit_file
* text
FORM help_audit_file USING p_phys_file TYPE c
p_locl_file TYPE c
CHANGING p_audit_path TYPE any.
IF p_phys_file EQ 'X'.
CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
EXPORTING
dynpfield_filename = 'P_OFILE'
dyname = sy-repid
dynumb = sy-dynnr
filetype = 'P'
location = 'A'.
ELSEIF p_locl_file EQ 'X'.
PERFORM help_local_file CHANGING p_audit_path.
ENDIF.
ENDFORM. " help_audit_file
*& Form help_local_file
* Local File Path
FORM help_local_file CHANGING p_path TYPE any .
DATA: lt_file_table TYPE filetable,
la_file_table LIKE LINE OF lt_file_table,
l_rc TYPE i,
l_pcdsn TYPE cffile-filename.
REFRESH lt_file_table.
CLEAR la_file_table.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
CHANGING
file_table = lt_file_table
rc = l_rc.
READ TABLE lt_file_table INTO la_file_table INDEX 1.
l_pcdsn = la_file_table-filename.
MOVE l_pcdsn TO p_path.
ENDFORM. " help_local_file
*& Form check_phys_file
* Validation of Physical File
FORM check_phys_file USING p_file TYPE any.
DATA: l_str(300) TYPE c.
CLEAR l_str.
OPEN DATASET p_file IN TEXT MODE FOR INPUT ENCODING DEFAULT.
IF sy-subrc <> 0.
IF g_file_flag = 'I'.
MESSAGE e000 WITH text-021.
ELSEIF g_file_flag = 'A'.
MESSAGE e000 WITH text-095.
ELSEIF g_file_flag = 'C'.
MESSAGE e000 WITH text-096.
ELSEIF g_file_flag = 'D'.
MESSAGE e000 WITH text-097.
ENDIF.
ENDIF.
READ DATASET p_file INTO l_str.
IF sy-subrc <> 0.
IF g_file_flag = 'I'.
MESSAGE e000 WITH text-017.
ELSEIF g_file_flag = 'A'.
MESSAGE e000 WITH text-098.
ELSEIF g_file_flag = 'C'.
MESSAGE e000 WITH text-099.
ELSEIF g_file_flag = 'D'.
MESSAGE e000 WITH text-100.
ENDIF.
ENDIF.
CLEAR: g_file_flag.
CLOSE DATASET p_file.
ENDFORM. " check_phys_file
*& Form check_local_file
* Validation of Local File
FORM check_local_file USING p_file TYPE any.
DATA: l_size TYPE i.
CLEAR: l_size.
CALL FUNCTION 'TMP_GUI_GET_FILE_EXIST'
EXPORTING
fname = p_file
IMPORTING
* exist = l_exist
filesize = l_size
EXCEPTIONS
fileinfo_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
IF g_file_flag = 'I'.
MESSAGE e000 WITH text-016.
ELSEIF g_file_flag = 'A'.
MESSAGE e000 WITH text-101.
ELSEIF g_file_flag = 'C'.
MESSAGE e000 WITH text-102.
ELSEIF g_file_flag = 'D'.
MESSAGE e000 WITH text-103.
ENDIF.
ENDIF.
IF l_size IS INITIAL.
IF g_file_flag = 'I'.
MESSAGE e000 WITH text-024.
ELSEIF g_file_flag = 'A'.
MESSAGE e000 WITH text-107.
ELSEIF g_file_flag = 'C'.
MESSAGE e000 WITH text-108.
ELSEIF g_file_flag = 'D'.
MESSAGE e000 WITH text-109.
ENDIF.
ENDIF.
CLEAR: g_file_flag.
ENDFORM. " check_local_file
*& Form get_input
* To gate input data from local file or from application server
FORM get_input USING p_ifilename TYPE any
p_afilename TYPE any
p_cfilename TYPE any
p_dfilename TYPE any
CHANGING p_input_table TYPE t_input_table
p_asset_table TYPE t_asset_table
p_cost_table TYPE t_cost_table
p_depr_table TYPE t_depr_table.
* to populate the input table
PERFORM upload_file USING p_ifilename CHANGING i_local.
g_file_flag = 'I'.
PERFORM split_localtable CHANGING p_input_table p_asset_table
p_cost_table p_depr_table.
CLEAR g_file_flag.
REFRESH i_local.
* to populate the asset class table
PERFORM upload_file USING p_afilename CHANGING i_local.
g_file_flag = 'A'.
PERFORM split_localtable CHANGING p_input_table p_asset_table
p_cost_table p_depr_table .
CLEAR g_file_flag.
REFRESH i_local.
* to populate the cost center table
PERFORM upload_file USING p_cfilename CHANGING i_local.
g_file_flag = 'C'.
PERFORM split_localtable CHANGING p_input_table p_asset_table
p_cost_table p_depr_table .
CLEAR g_file_flag.
REFRESH i_local.
* to populate the depr key table
PERFORM upload_file USING p_dfilename CHANGING i_local.
g_file_flag = 'D'.
PERFORM split_localtable CHANGING p_input_table p_asset_table
p_cost_table p_depr_table .
CLEAR g_file_flag.
REFRESH i_local.
ENDFORM. " get_input
*& Form upload_file
* text
FORM upload_file USING p_filename TYPE any
CHANGING p_local_table TYPE t_local_table.
* To get the input data from desktop file
IF p_locl = 'X'.
DATA: l_file TYPE string.
CLEAR: l_file,
p_local_table.
l_file = p_filename.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_file
filetype = 'ASC'
TABLES
data_tab = p_local_table
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc <> 0.
MESSAGE e002 WITH l_file.
ENDIF.
ELSE.
* To get the data from application server file
OPEN DATASET p_filename IN TEXT MODE FOR INPUT ENCODING DEFAULT.
IF sy-subrc <> 0.
MESSAGE e001 WITH p_filename.
ENDIF.
CLEAR: wa_local.
DO.
READ DATASET p_filename INTO wa_local.
IF sy-subrc <> 0.
EXIT.
ENDIF.
APPEND wa_local TO p_local_table.
CLEAR: wa_local.
ENDDO.
CLOSE DATASET p_filename.
ENDIF.
ENDFORM. " upload_file
*& Form split_localtable
* text
FORM split_localtable CHANGING p_input_tab TYPE t_input_table
p_asset_tab TYPE t_asset_table
p_cost_tab TYPE t_cost_table
p_depr_tab TYPE t_depr_table.
DATA: l_cnt TYPE i.
CLEAR: l_cnt, wa_local.
LOOP AT i_local INTO wa_local.
REFRESH i_split[].
SPLIT wa_local AT c_tab INTO TABLE i_split.
CLEAR l_cnt.
ADD 1 TO l_cnt.
CLEAR wa_split.
LOOP AT i_split INTO wa_split.
IF g_file_flag = 'I'.
ASSIGN COMPONENT l_cnt OF STRUCTURE wa_input TO <fs_field>.
ELSEIF g_file_flag = 'A'.
ASSIGN COMPONENT l_cnt OF STRUCTURE wa_asset TO <fs_field>.
ELSEIF g_file_flag = 'C'.
ASSIGN COMPONENT l_cnt OF STRUCTURE wa_cost TO <fs_field>.
ELSEIF g_file_flag = 'D'.
ASSIGN COMPONENT l_cnt OF STRUCTURE wa_depr TO <fs_field>.
ENDIF.
CLEAR <fs_field>.
<fs_field> = wa_split-col.
ADD 1 TO l_cnt.
CLEAR wa_split.
ENDLOOP.
IF g_file_flag = 'I'.
APPEND wa_input TO p_input_tab.
CLEAR: wa_input .
ELSEIF g_file_flag = 'A'.
APPEND wa_asset TO p_asset_tab.
CLEAR: wa_asset .
ELSEIF g_file_flag = 'C'.
APPEND wa_cost TO p_cost_tab.
CLEAR: wa_cost .
ELSEIF g_file_flag = 'D'.
APPEND wa_depr TO p_depr_tab.
CLEAR: wa_depr .
ENDIF.
CLEAR: wa_local .
ENDLOOP.
ENDFORM. " split_localtable -
How to write to a file with \n (new line)???
Hi there,
I have the following method that reads a file's content and convert it into a string:
public static String getFileContent(String fileName) throws IOException
File file = new File(fileName);
FileInputStream fileInputStream = new FileInputStream(file);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(fileInputStream));
StringBuffer stringBuffer = new StringBuffer();
String line;
while ( (line=bufferedReader.readLine()) != null )
stringBuffer.append(line+"\n");
return stringBuffer.toString();
}I'm trying to write a method that writes a String to a file WITH THE NEW LINE. All classes I used (DataOutputStream, FileWriter, PrintStream...) do not force a new line (I get everything in one line)
I thought maybe I should change the "\n" in the line
stringBuffer.append(line+"\n"); but...didn't know what.
thanks for any adviseBufferedReader readLine remove the newline sequence. But you're putting \n back which should do what you appear to want.
However newline sequence isn't always just \n, on unix systems it's \n, on windows its \r\n (reads "carriage-return, linefeed"). Sytem.getProperty("line.separator"); will get you the appropriate end of line string. -
Upload text files with non-english characters
I use an Apex page to upload text files. Then i retrieve the contents of files from wwv_flow_files.blob_content and convert them to varchar2 with utl_raw.cast_to_varchar2, but characters like ò, à, ù become garbage.
What could be the problem? Are characters lost when files are stored in wwv_flow_files or when i do the conversion?
Some other info:
* I see wwv_flow_files.DAD_CHARSET is set to "ascii", wwv_flow_files.FILE_CHARSET is null.
* Trying utl_raw.cast_to_varchar2( utl_raw.cast_to_raw('àòèù') ) returns 'àòèù' correctly;
* NLS_CHARACTERSET parameter is AL32UTF8 (not just english ASCII)Hi
Have a look at csv upload -- suggestion needed with non-English character in csv file it might help you.
Thanks,
Manish -
I'm having problem with text boxes. Whenever i hit the enter button to start a new line or paragraph, the cursor doesn't drop down to the next line. Instead i get this little red + sign in the box.
You are absolutely right. Thought Enter meant Enter. I was wrong. Thank you for the help.
Rod Rogers, Broker
Accredited Land Consultant (ALC)
Metcalf Land Company, Inc.
Office: 864-585-0444
Mobile: 864-316-0297
Fax: 864-583-6000
<http://www.metcalfland.com> www.metcalfland.com -
I have Photoshop Elements 10. It appears that I need a plugin to upload RAW files and the plugin necessary for my new Olympus E-M10 is not compatible with version 10. Am I getting this right? Do I have to buy a new version of Photoshop Elements just to upload RAW files from my new Olympus E-M10? Otherwise, what I have is all that I need.
Which operating system are you using?
If your using mac os x 10.6 (snow leopard) or windows xp or vista, then the below solution will not work and you shouldn't try to install the dng converter 8.5
You could use the free Adobe DNG Converter to convert your files to dng copies which should then open in pse 10.
windows:
Adobe - Adobe Camera Raw and DNG Converter : For Windows : Adobe DNG Converter 8.5
mac:
Adobe - Adobe Camera Raw and DNG Converter : For Macintosh : Adobe DNG Converter 8.5
how to use the dng converter
Camera Raw: How to use Adobe DNG Converter - YouTube -
About Final Cut ProX: why a red line appears at the top o a file imported into a New Event? then when I restarted the Project that files comes as "Missed files" How can i fix it? Thank you very much.
Where are you importing from – a camera or computer? If you are optimizing at import, make sure the background processes are completed. (Command-9)
Russ -
How can I read text files from LAN if I only know the hostname?
I'm new in Java Developing, and dont know the written classes yet. I need help, how to do the following steps?
<p>1. How can I read text files from LAN if I only know the hostname, or IP address?
<p>2. How to read lines from text files without read all lines from the beginning of file, just seek to a position.
(ex. how can I read the 120th line?)
<p>Please help!
<p>sorry for the bad englishI'm new in Java Developing, and dont know the written classes yet. I need help, how to do the following steps?
1. How can I read text files from LAN if I only know the hostname, or IP address?You need to know the URL of the file. You need to know the hostname, port, protocl and relative path.
The hostname is server, not file.
2. How to read lines from text files without read all lines from the beginning of file, just seek to a position.Use the seek() to get to a random byte.
(ex. how can I read the 120th line?)The only way to find the 120th line is to read the first 120 lines. You can use other file formats to find the 120th line without reading the whole file but to need to be able to detremine where the 120th line is -
How can FMS create a text file and write data into it in the Server application folders?
Recently, I writed a programe about creating a text file and writing data into it in the server application folder. My code is as following:
var fileObj = new File("/MyApp/test.txt");
if( fileObj != null)
if(fileObj.open( "text", "append"))
fileObj.write( " ———— Chat Info Backup ————\r\n" );
fileObj.close( );
trace("Chat info backup document :" + fileObj.name + " has been created successfully!");
But when I run it, FMS throw the error as following: File operation open failed ; TypeError: fileObj has no properties.
Can you help me ? Thanks in advance.
Supplement: The text file named test.txt doesn't exist before create the fileObj, an instance of File Class.Is MyApp the name of the application directory, or is it a child of the application directory? If myApp is the app name, just use test.txt as the path flag in the file constructor.
-
Records are not getting imported due to new line charactor in the field
Dear All,
I am trying to load a file into target but the import is failing. The error thrown is as below;
During the import of leads into CRMoD through loading the New lead/Step lead file received from CA, leads have not been imported and we encountered the following
error message:
"Import field 'LAST_NAME' had a blank value for the required Oracle CRM On Demand field 'Last Name'. This record was not imported. Please enter desired values for
the required fields and re-import this record."
Reason:
Leads are not imported due to an additional new line (Enter) character, which results in the subsequent lines not being picked up and the error of import failure.
Please help me to resolve this to remove the new line charactor in the field so that import succeeds..
By the way, I am working on ODI 11g.
Thanks in Advance
Regards
SantyWhile i was reading your post i remembered an issue that madded me. I don't know Oracle CRM, but a possible workaround could be to create a temporary Oracle table and load all data inside it. After that load in CRM only valid rows.
-
Copy service line items to new line items in the same contract (ME32K)?
Hello friends,
Requirement: There are many contracts (account assignment K) has service line items (type 9). I need to copy a contract line item along with its service line items (1 or more) into a new line item in the same contract. I tried bapi_po_change but it says Contracts can't be processed with it, as only in this bapi we have a structure for ESLL services. BAPI_CONTRACT_CHANGE or create don't have structure for ESLL..how to achieve this through a bapi or a fm?
So, in what way I could accomplish this? I came across some threads, which was helpful, but is not solving the purpose
Any guidance here would be of great help.
Thanks in advance.
MayankUse BAPI_AGREEMENT_MAINTAIN
This BAPI can be used to create new service items in the contract but won't change existing lines. You can query the contract lines that you want to copy and later call the BAPI to recreate them
Maybe you are looking for
-
Iphone in recovery mode, how can i make assure that my data will not erase
firstly thanks for quick reply. sorry sir, i am confused in last line you wrote, " This will erase the phone but you will be given an option at the end to restore to an existing backup, if you have one." i did not understand last sentence - if i have
-
Problem with children of HtmlDataTable
Hi, I'm trying to highlight a row in a HtmlDataTable by clicking on it but ran into a confusing problem. I can access the table and when I fetch the children I get as many as the table has columns, so far so good. But when accessing the children (or
-
TV Resolution Setting on AppleTV
I recently purchased a new Home Theatre Receiver with HDMI connections. I attached my AppleTV to my receiver via HDMI. Then have one HDMI cable out from my receiver to my TV. Since doing this I have noticed that each time I opt to watch my AppleTV my
-
Game server: Map managing questions
Hello everyone, I'm trying to develop some kind of RPG. I have different issues, where I need advice: 1) Map(2D) managment on game server The map I want to keep in memory on server will contain objects such as: Item, NPC, Character, etc. Item, NPC, C
-
Error deploying my first .war file to Tomcat
My Tomcat version is Apache Tomcat/6.0.18 Using Mojarra: mojarra-2.0.0-PR2 SEVERE: Unable to instantiate ExpressionFactory 'com.sun.el.ExpressionFactoryImpl' Apr 2, 2009 4:35:33 PM org.apache.catalina.core.StandardContext start SEVERE: Error listener