How Do I Comile an Ascii File?
My application needs to generate, compile, and load a class.
java.lang.Compiler is not the answer.
What is? How do I convert a String or ascii file into a Class object?
You would have to use com.sun.tools.javac.Main. However, this is one of the non-documented and non-supported classes. Furtermore, it exists only in the JDK and not in the JRE.
You might be able to distribute the tools.jar from the lib directory in the JDK with your application. But I am not sure that you are actually allowed to do that. There may be some license issues.
Similar Messages
-
How to convert tdms to ascii files?
Hello,
I need to convert *.tdms files to an ascii file. I have 16 channels and scalling coefficient information in the tdms file, With the TDMS-Image Viewer i can see the 1-D array waveform perfectly, but I cant write it to an ascii file. When I use a signalexpress.vi or the spreetsheat.vi for writing an LVM/ascii file, information gets lost. (Red symbol at INPUT!!!!)
Please answer me, because I dont have lots of experience with labview and an ascii file is more easier to handle for me! I found only export to matlab and exel, but i just want it in an ascii file. Reading the tdms and opening it is no problem, but connecting the right blocks to the 1D array waveform without dataloss doesnt work.
thank you for reading
dannyThank you for reply,
i have the new version 8.5. With signalexpress.vis i can do asciis but the red symbol (at input) is there so i dont want to get information lost.
The tdms file has header information for scalling factors and unscalled data for 16 channels.
so because tdms files are faster for writing i want to convert them to ascii with a Convertion Vi, but it seems that with an express vi he stops because it cant handle handle with the headerinformation.
now i use the signalexess vi to write tdms data, before i did it manully by setting channel and group information.
Please tell me if the red symbol AT input of a Signalexpress VI does matter? its a 1D array wavefrom that goes in to the input.
thank you for this discussion, i hope that i dont need to use the matlab import option for tdms!!
greetings danny -
How can I append sequential ascii files?
I am trying to read ~100 sequential ascii files and then append them end-on-end into one text file. Is there a simple way to automate this step so I don't have to select each ascii file individually?
You can use the list directory to get all the file names under that directly. Then programactically read contents of the file and save to single file by having append to file TRUE on the write VI.
Naresh -
How to identify binary vs ASCII file???
Hello,
What is the best way to decide whether a file is binary or plain text?
Thanks in advance.
Chris.Other than passing through the bytes, check that there are no bytes that you wouldn't usually have in a text file and pray that the file isn't in an "exotic" character encoding such as utf8?
There is no real difference. Both "binary" and "text" files contain bytes. -
ASCII-File aus SAP Business One
Hallo
Ich muß eine Schnittstelle zu einer Verpackungsmaschine, die auch die Etiketten druckt bedienen. Den Satzaufbau für die Etiketten habe ich vom Hersteller bekommen und kann den auch soweit erstellen. Was mir fehlt ist die Übergabe einer ASCII-Datei an die Schnittstelle (Ich vermute mal mit einer Printdefinition von Coresystems ?!)
Hat von Euch schon mal jemand so etwas gemacht ?
Bin für jede Hilfe dankbar
Viele Grüße an alle
Annette LenhardHere is my question in english
Well, I have to create an interface to a machine that pack the goods and that print lables at the same time. This machine understands only ASCII-File. So my question is - How can I create an ASCII-File out of Business One?
The structure of the sentence is clear but I don't know how to respond the maschine ?
Kind regards
Annette Lenhard -
How can I extract a dates column from an ascii file
I am extracting data from an ascii file and the rest of the data is extracted using read from spreadsheet, but the date appears as just the day e.g. 22 for 22nd, how can I get the date, format in ascii is e.g 22/04/2006, can I do this by specifying something at format of read from spreadsheet ? Cheers
EmilyHi,
I found the other day that there are instructions included inside the Read From Spreadsheet vi on how to modify it slightly to read strings rather than doubles.
If you drop the Read From Spreadsheet vi onto the block diagram and double click on it, you will open the front panel for the vi. If you then select the block diagram (for Read From Spreadsheet) you will see an 'instructions' frame below the main 'code', and the 3rd paragraph tells you how to modify the VI to read the spreadsheet as a set of strings rather then doubles. Save the vi as a new filename when you've edited it or you will overwrite the existing vi!
Using the newly modified vi you can read in your entire spreadsheet, extract the dates as strings, then do any conversion necessary to the other columns of the sheet to change them into the types of value you require (eg doubles).
I hope this helps.
Mark
Applications Engineer
National Instruments -
How to convert an ascii file into dBase .dbf file type
Does any one out there know how to convert an ascii file(which is generated from PL/SQL script) into a .dbf (dBaseIII) file type? Thanks in advance.
I haven't worked with dBase for about 20 years, but I seem to recall it having an IMPORT command for that purpose. But maybe I'm wrong...
-
UTL_FILE: How do you use the ^ as a delimiter from an ASCII file?
We currently have UTL_FILE pulling in a comma delimited file,
with this code: With the V_COMMA's declared and other variables
declared listed below. It works. When we change the ASCII file
to ^ delimited, the program fails. How do we get the ^ to work
with UTL_FILE?
BEGIN
UTL_FILE.GET_LINE(V_FILEHANDLE, V_NEWLINE);
EXCEPTION
WHEN NO_DATA_FOUND THEN
EXIT;
END;
/* adding numbers 1-6 to position one on newline*/
V_COMMA_1 := INSTR(V_NEWLINE, ',', 1, 1);
V_COMMA_2 := INSTR(V_NEWLINE, ',', 1, 2);
V_COMMA_3 := INSTR(V_NEWLINE, ',', 1, 3);
V_COMMA_4 := INSTR(V_NEWLINE, ',', 1, 4);
V_COMMA_5 := INSTR(V_NEWLINE, ',', 1, 5);
V_COMMA_6 := INSTR(V_NEWLINE, ',', 1, 6);
V_ITEM_NUMBER := SUBSTR(V_NEWLINE, 1, V_COMMA_1 - 1);
V_AVAILABLE := SUBSTR(V_NEWLINE, V_COMMA_1 + 1, V_COMMA_2 -
V_COMMA_1-1);
V_ETA_CHAR := SUBSTR(V_NEWLINE, V_COMMA_2 + 1,
V_COMMA_3 - V_COMMA_2-1);
V_RETAIL_PRICE := SUBSTR(V_NEWLINE, V_COMMA_3 + 1,
V_COMMA_4 - V_COMMA_3-1);
V_DROP_SHIP_FILE := SUBSTR(V_NEWLINE, V_COMMA_4 + 1,
V_COMMA_5 - V_COMMA_4-1);
V_COMPANY_FILE := SUBSTR(V_NEWLINE, V_COMMA_5 + 1);Thanks for your response!
I have simplified the sheet so it contains no split or merged cells, yet still I get the exclamation mark where I want the average. (The exclamation mark says 'Numbers can't be divided by zero'.)
Exam
Skit
Exam
Class Participation
1
2
TOTAL
MAX. MARK
55
30
100
15
200
ADJ. %
MARK
Student A
37
20
84
15
156
78%
72%
7
Student B
39
28
91
15
173
87%
80%
8
Student C
39
28
86
10
163
82%
76%
8
Student D
34
26
92
15
167
84%
78%
8
Student E
38
26
74
10
148
74%
69%
7
CLASS AVERAGE
37.4
25.6
85.4
13.0
161.4
80.7%
75.0%
I guess the basic question is: can you actually use AVERAGE on data that is output by an IF formula? -
How to read an ascii file and record data in a 2d array
HI everyone,
I have an experimental data file in ascii format. It contains 10 data sets.
I'm trying to read the ascii file and record data in a 2d array for further analysis,
but I still could not figure it out how to do it.
Please help me to get this done.
Here I have attaced the ascii file.
-Sam
Attachments:
data.asc 123 KB
2015-01-27_18-01-31_fourier_A2-F-abs.zip 728 KBGot it!
Thank you very much !
-Pamsath -
Can SQL*PLUS deal with 'flat ASCII files' (input ) in UNIX ? and how?
Can SQL*PLUS deal with 'flat ASCII files' (input ) in UNIX ? and how?
No, but PL/SQL can. Look at utl_file.
John Alexander www.summitsoftwaredesign.com -
How can I Read/write a ascii file?
How can I Read/write a ascii file? like this:
101 0.0000 -1.0000 +
102 -0.1887 -0.9485 +
103 -0.3578 -0.8639 +
104 -0.5022 -0.7516 +
105 -0.6177 -0.6177 +
106 -0.7018 -0.4689 +
107 -0.7533 -0.3120 +
108 -0.7723 -0.1536 +
109 -0.7603 -0.0000 +
110 -0.7198 0.1432 +
111 -0.6543 0.2710 +
112 -0.5682 0.3796 +
113 -0.4660 0.4660 +
114 -0.3531 0.5284 +
115 -0.2345 0.5660 +
116 -0.1152 0.5791 +
117 -0.0000 0.5689 +
118 0.1069 0.5375 +
119 0.2020 0.4876 +
120 0.2823 0.4224 +
121 0.3457 0.3457 +
122 0.3911 0.2614 +
123 0.4180 0.1732 +import java.util.*;
import java.io.*;
class BallB{
public static void main (String args [])
throws Exception {
String str=" ";
String myString="";
try {
FileReader fr = new FileReader("test.txt");
BufferedReader br = new BufferedReader(fr);
FileWriter fw = new FileWriter("test1.txt");
while(str!=null){
myString = str+"\n";
str = br.readLine();
fw.write(myString);
br.close();
fw.close();
}catch (Exception e) {
e.printStackTrace();
} -
How do i create a list of frequencies +/- a peak output as ascii file?
I have an VI set up that reads in from a Spectrum Analyzer and searches for the peaks and outputs them along with there amplitudes as an ASCII file.
A Macro has been created in Excel that reads the ASCII file and creates a list of 5 frequencies +/- the peak frequencies above a threshold to be tested later. The problem is that it has some frequencies
created more than once.
Is it possible to create this list in the VI that would filter the list and then output it to excel to be printed later?ChrisKalina wrote:
I have an VI set up that reads in from a Spectrum Analyzer and searches for the peaks and outputs them along with there amplitudes as an ASCII file.
A Macro has been created in Excel that reads the ASCII file and creates a list of 5 frequencies +/- the peak frequencies above a threshold to be tested later. The problem is that it has some frequencies
created more than once.
Is it possible to create this list in the VI that would filter the list and then output it to excel to be printed later?
Of course it is possible to do this. What have you tried so far?
One problem you will have, though, is that LV 5 is such an ancient version, many people on the forums will have trouble being able to open your file, and almost no one will have the means to save back that far. So you may have a hard time getting help. -
How to handle ASCII file in file download
Hi:
I have an applet that will download mutiple files to client's PC at the background. It handle binary files (e.g. word, excel) OK.
However, for ASCII file, it lost the line feeds, etc. so my multiple-lines file become 1 line (seems to be transfer via binary mode). Anyway to fix this ?
The relevant code segment looks like this:
public class Filedownload extends JApplet
public Filedownload()
String FileName1="template2.doc";
String webFile1 =
"http://hkzux05/~doracle/dev/"+FileName1;
String outfile1 =
"c://dev//mail-merge//" +FileName1;
String FileName2="data1.csv";
String webFile2 =
"http://hkzux05/~doracle/dev/"+FileName2;
String outfile2 =
"c://dev//mail-merge//" +FileName2;
try {
System.out.print("Start downloading file "+FileName1+"\n");
URL url = new URL(webFile1);
InputStream in = url.openStream();
byte[] buf = new byte[1024];
int len;
OutputStream out = new FileOutputStream(outfile1);
while ((len = in.read(buf)) != -1) {
//write byte to file
out.write(buf, 0, len);
//close the stream
in.close();
System.out.print("End downloading file "+FileName1+"\n");
System.out.print("Start downloading file "+FileName2+"\n");
url = new URL(webFile2);
in = url.openStream();
OutputStream out2 = new FileOutputStream(outfile2);
while ((len = in.read(buf)) != -1) {
//write byte to file
out2.write(buf, 0, len);
in.close();
System.out.print("End downloading file "+FileName2+"\n");
System.out.print("... Done ...\n");
catch (MalformedURLException e){
//TODO
catch (IOException e){
//TODO:FileNotFoundException caught here
finally{
//TODO
ThksCan anyone help ?
Thks -
How to read a web page as an ascii file
I need to open an url and read the contents, as it
were a simple local ascii file. This give me just
garbage, as [B@fd2e84b (that change every time,
seems to be a memory address, not the contents..).
<pre>
import java.io.*;
import java.net.*;
try {
URL j_urlobj = new URL("http://www.google.com";);
URLConnection j_urlcon = j_urlobj.openConnection();
BufferedInputStream j_bis =
(BufferedInputStream)j_urlcon.getInputStream();
byte[] j_data = new byte[4096];
int j_size;
j_size = j_bis.read(j_data, 0, 4096);
while (j_size != -1) {
out.print(j_data);
j_size = j_bis.read(j_data, 0, 4096);
j_bis.close();
} catch (Exception e) { out.print(e.toString()); }
</pre>
What is wrong?? Thank you!
StefanoI try your code and it's work right with a little change....
The problem is that you read bytes, so if you want something readable try to convert to a String.
String s = new String(j_data)
out.println(s);
Here, the complete code:
try {
URL j_urlobj = new URL("http://www.google.com");
URLConnection j_urlcon = j_urlobj.openConnection();
BufferedInputStream j_bis =
new BufferedInputStream(j_urlcon.getInputStream());
byte[] j_data = new byte[4096];
int j_size;
j_size = j_bis.read(j_data, 0, 4096);
while (j_size != -1) {
out.print(new String(j_data));
j_size = j_bis.read(j_data, 0, 4096);
j_bis.close();
} catch (Exception e) { out.print(e.toString()); } -
How to extract a column out of a large ASCII file?
Hi all.
After searching the board and applying several solution approaches my problem still remains. Maybe you can help me.
The data source i've to deal with are large ASCII files (~540 MB) with 14 columns (delimiter: TAB). Each column represents one channel. The number of characters in each "field" is variable. I have to read user defined columns (=channels) out of each data set. Needless to say that reading the whole file runs into memory problems.
If anyone has an idea i would be happy
Thanks in advance.
Greets
KaneI hate to defocus you, but there is a more efficient way to do this. My apologies that I do not have the time to write code, but here is the pseudo code.
Create an array for your output greater than or equal to what you think you will need.
Read a 65,000 character chunk from the file (or the rest of the file, whichever is smaller).
Use the string search functions functions to find successive line ends and the appropriate tab character delimiters for your column.
Convert and replace the element in your output array.
When done, trim your output array to the right size.
If you drop an LVM read, convert it to a regular VI, and dive in, you will see an example of this type of process. The idea is to keep disk reads, which are very inefficient, to a minimum. It also minimizes your memory allocations, because you do not need to resize your input buffer for every line. Problems you will need to deal with (which are handled by the LVM read) are such things as:
Your line crosses a chunk boundary.
The end-of-file creates a smaller chunk than 65,000 characters (the optimum chunk size for Win32 systems).
The end-of-line character is not well defined (in your case, this is probably not an issue)
Searching for a character can produce memory allocations
You may want to try reading the data as a U8 array instead of a string and doing your searches on that instead of the string.
I have always wanted to write the piece of code, but never had the time or reason to do so. Good luck. I will try to help if I can.
This account is no longer active. Contact ShadesOfGray for current posts and information.
Maybe you are looking for
-
More than one updatable report on one page.
I hope someone can help me with this. I've spend a long time looking for the best way to do this but keep running into APEX constraints. My problem is that I have two tables; 1) an 'object' table with static attributes (that can change value but keep
-
Why is Lightroom 2.4 Thumbnail Rendering SLOOOOOOOOW...?
For some reason Lightroom 2.4 is taking an enormous amount of time to render thumbnail previews and in spite of having my thumbnail cache set to 50 GB, it still re-renders the thumbnails every single time I use the scroll bar. Every other aspect of L
-
Why does Weather Channel keep knocking me out and how do I get rid of it?
Weather Channel comes up even though I have deleted it
-
HT201272 Cant download as it is telling me payment method declined
Hi im trying to install new apps and its telling me payment declined (app is free) try another payment method :s can any1 help in what i have to do thanks
-
I am trying to add standby database to the broker configuration and am getting this error ORA-16796 : one or more properties could not be imported from the database -- are there any specific checks I can do to locate the error ? Thanks, ramya