API extracting keywods from text files
hi all,
i will be grateful if any of you can suggest some free java api which can be used to extract keywords from text files.
thanx in advance
malls
java.util.regex - regular expressions API in JDK 1.4
Similar Messages
-
How to extract data from text file to database table
Hi ,
I am trying to upload data in text file to database table using GUI_UPLOAD function .what would be the program for that.
thanks in advance.Hi,
I don't think you have a standard sap program to upload data from file to database table...
Instead you can create a custom program like this..
DATA: T_FILEDATA(1000) OCCURS 0 WITH HEADER LINE.
DATA: T_ZTABLE LIKE ZTABLE OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:\TEST.TXT'
tables
data_tab = T_FILEDATA
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 ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT T_FILEDATA.
T_ZTABLE = T_FILEDATA.
APPEND T_ZTABLE.
ENDLOOP.
MODIFY ZTABLE FROM TABLE T_ZTABLE.
COMMIT WORK..
Thanks,
Naren -
Extracting number from text files for variable
Hello again,
I have several different types of text files all with the line
# NPTS=32768 DT=0.005
somewhere in the file. The numerical values are different for each file and I need to pull them out to assign as a variable for a program I am running.
How can I search a file and pull out each of these two numbers?
Thank youProcyon's sed script assumes that the NPTS number and the DT number will both always have a period in them. In the original, the NPTS number doesn't have a period, and I don't know whether the DT number may lack a period.
You could try this instead (replacing the 's~....~p' part of Procyon's script):
's~# NPTS=\([0-9.]*\) *DT=\([0-9.]*\)~\1,\2~p'
That may let in stuff you want to exclude, for instance, it would let in:
NPTS=0.0.0.0.0 DT=1.1.1.1.1
and:
NPTS=....... DT=
and so on. But it's a tradeoff: if you know your data doesn't include anything like that, you can go with a simpler sed script. If you need to be fussier about what you're matching, then your sed script will need to be more complex.
EDIT: What I said in first paragraph is wrong. I overlooked the '*' after the '\.' in Procyon's script. What he's got will permit but not require a period. My final point still applies, though, to both of our suggestions. His script and my script would both match the second of my bad cases.
Last edited by Profjim (2008-09-17 21:31:34) -
Trying to parse a file-read from text file.vi
I'm attempting to read a txt file that has tab separated data. In the fourth (or any) column is the only data I need. The data is a string of numbers (23.454).
I've used the Read from Text File.vi and the Read From Spreadsheet.vi and I just don't seem to have enough LV background to extract the pertinent data into a graph. any suggestions?(It is silly to use "delete from array" if all you want is a column. The correct function is "index array")
Joe's idea above basically works fine. Here's a quick adapdation (the node before the graph is "index array" from the array palette.).
Message Edited by altenbach on 06-11-2007 11:57 AM
LabVIEW Champion . Do more with less code and in less time .
Attachments:
FileRead.png 11 KB -
How to extract data from XML file with JavaScript
HI All
I am new to this group.
Can anybody help me regarding XML.
I want to know How to extract data from XML file with JavaScript.
And also how to use API for XML
regards
NagarajuThis is a Java forum.
JavaScript is something entirely different than Java, even though the names are similar.
Try another website with forums about JavaScript.
For example here: http://www.webdeveloper.com/forum/forumdisplay.php?s=&forumid=3 -
Hi, extract data from xml file and insert into another exiting xml file
i am searching code to extract data from xml file and insert into another exiting xml file by a java program. I understood it is easy to extract data from a xml file, and how ever without creating another xml file. We want to insert the extracted data into another exiting xml file. Suggestions?
1st xml file which has two lines(text1.xml)
<?xml version="1.0" encoding="iso-8859-1"?>
<xs:PrintDataRequest xmlns:xs="http://com.unisys.com/Anid"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://com.unisys.com/Anid file:ANIDWS.xsd">
<xs:Person>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://com.unisys.com/Anid file:ANIDWS.xsd">
These two lines has to be inserted in the existing another xml(text 2.xml) file(at line 3 and 4)
Regards,
bubblyJadz_Core wrote:
RandomAccessFile? If you know where you want to insert it.Are you sure about this? If using this, the receiving file would have to have bytes inserted that exactly match the number of bytes replaced. I'm thinking that you'll likely have to stream through the second XML with a SAX parser and copy information (or insert new information) as you stream with an XML writer of some sort. -
Extract data from XML file to Oracle database
Dear All
Please let me know, how to extract data from XML file to Oracle database which includes texts & images.
Thanking You
Regards Lakmal MarasingheI would do it from the database, but then again, I am a database / PL/SQL guy.
IMHO the database will deliver you with more options. I don't know about "speed" between the two. -
Is it possible in java to extract audio from video file and ...
Hi,
Is there any API in java for creating DVD video from Normal TV and extract audio from video file and convert MP3 to WMA file. What about java Media Framework and Java 3D API?
If it is notpossible in java which will be the next option. Vc++?
Please help me.
Thanking in advance.
From,
Vinod Alol
If all you want is to create a backup of some file you can do:public class Foo
public static void main(String[] args) {
Foo f = new Foo();
f.createBackup("something.xls");
public void createBackup(String inFile) {
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream(inFile);
out = new FileOutputStream(inFile + ".bak");
int read;
while ((read = in.read()) > -1) {
out.write(read);
out.flush();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
if (out != null) {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
} -
Extracting Images from PDF file
Hello All,
I am reading PDF File.I need to extract images from PDF File programatically.But problem is that some images are stored inside PDF File using FlateDecode Filter and I need to first decode that file and then I can extract that image .I dont know the way to decode that image data.Is there any way or API to do that in C++.
Thanks
Aarti NagpalI think you can do it through cos object in VC++ plugin..go through the PDEFilterSpec in
Acrobat core api reference
Be well.. -
Unable to Upload data from text file into BEx Analyzer selection screen
Hi,
No response from BEx Analyzer when I am trying to upload around 40,000 material from text file into BEx Analyzer selection screen using "Upload selections" options. But I am able to upload only 10,000 material from text file. I never faced same kind of issue when I am using BEx Analyzer 3.x. Please let me know I have to change any settings related to BEx or any other.
Thanks
Sri Krishna Ponnada.Hello
It seems you are reaching the .NET memory limitation informed in note 1040454.
Because 3.5 does not use .NET it can work that.
Regards,
Ricardo -
Why does Read from Text file default to array of 9 elements
I am writing to a text file starting with a type def. cluster (control) of say 15 dbl numeric elements, that works fine I open the tab-delimited text file and all of the elements appear in the file. However when I read from the same text file back to the same type def. cluster (indicator), the read from text file defaults to 9 elements?? Is there a way to control how many elements are read from the file. This all works great when I initially use a cluster of 9 elements and read back to a cluster of 9 elements.
Solved!
Go to Solution.From the LabVIEW Help: http://zone.ni.com/reference/en-XX/help/371361G-01/glang/array_to_cluster/
Converts a 1D array to a cluster of elements of the same type as the array elements. Right-click the function and select Cluster Size from the shortcut menu to set the number of elements in the cluster.
The default is nine. The maximum cluster size for this function is 256.
Aside: so, how many times has this question been asked over the years? -
How to open saved files using 'read from text file' function
Hi everyone, I am having a hard time trying to solve the this particular problem ( probably because I am a newb to lanbview ). Anyway , I am able to save the acquired waveforms by using the 'Write to text file' icon. I did manually modify the block diagram of the 'Write to text file' icon and create the correct number of connector so as to make my program work. But now I have no idea on how to modify the block diagram of the 'Read from text file' block diagram to make my program 'open' my saved waveforms. Or i do not have to modify anything from the block diagram of the 'Read from text file'? Can anyone teach/help me connect up? Do i need the build array on the "open" page?
Here are some screenshots on part of my program
let me know if you guys would need more information / screenshots thank you!
Attachments:
ss_save.jpg 94 KB
ss_open.jpg 94 KB
modified_writetotextfile.jpg 99 KBOhmy, thanks altenbach. oh yeah i forgot about those sub VIs. will upload them now. Was rather demoralized after reading the comments and really struck me on how weak i'm at on labview really hope to get this done. But of course i have to study through and see how it works. Actually i am going to replace those 'signal generators sub vi' with ThoughtTechonology's sample code so i can obtain data waveforms real-time using Electrocardiography (ECG) ,Electromyography (EMG ) and Electroencephalography (EEG) hopefully i can find out how to connect the sample code.
( ps . cant connect it now unless my program is working otherwise labview will crash )
( p.s.s the encoder of my biofeedback trainer already acts as an DAQ so i wont need to place an DAQ assistant in my block diagram i suppose )
The sample code of ThoughtTechnology is named as attachment.ashx.vi. too bad i cant use it and present it as my project
Attachments:
frequency detactor.vi 53 KB
signal generator.vi 13 KB
attachment.ashx.vi 40 KB -
LabVIEW for ARM 2009 Read from text file bug
Hello,
If you use the read from text file vi for reading text files from a sdcard there is a bug when you select the option "read lines"
you cannot select how many lines you want to read, it always reads the whole file, which cause a memory fault if you read big files!
I fixed this in the code (but the software doesn't recognize a EOF anymore..) in CCGByteStreamFileSupport.c
at row 709 the memory is allocated but it tries to allocate to much (since u only want to read lines).
looking at the codes it looks like it supposed to allocated 256 for a string:
Boolean bReadEntireLine = (linemode && (cnt == 0));
if(bReadEntireLine && !cnt) {
cnt = BUFINCR; //BUFINCR=256
but cnt is never false since if you select read lines this is the size of the file!
the variable linemode is also the size of the file.. STRANGE!
my solution:
Boolean bReadEntireLine = (linemode && (cnt > 0)); // ==
if(bReadEntireLine) { //if(bReadEntireLine && !cnt) {
cnt = BUFINCR;
and now the read line option does work, and reads one line until he sees CR or LF or if the count of 256 is done.
maybe the code is good but the data link of the vi's to the variables may be not, (cnt and linemode are the size of the file!)
count should be the number of lines, like chars in char mode.
linemode should be 0 or 1.
Hope someone can fix this in the new version!
greets,
Wouter
Wouter.
"LabVIEW for ARM guru and bug destroyer"I have another solution, the EOF works with this one.
the cnt is the bytes that are not read yet, so the first time it tries to read (and allocate 4 MB).
you only want to say that if it's in line mode and cnt > 256 (BUFINCR) cnt = BUFINCR
the next time cnt is the value of the bytes that are not read yet, so the old value minus the line (until CR LF) or if cnt (256) is reached.
with this solution the program does not try to allocate the whole file but for the max of 256.
in CCGByteStreamFileSupprt.c row 705
if(linemode && (cnt>BUFINCR)){
cnt = BUFINCR;
don't use the count input when using the vi in line mode. count does not make sense, cnt will be the total file size. also the output will be an array.
linemode seems to be the value of the file size but I checked this and it is just 0 or 1, so this is good
update: damn it doesn't work!
Wouter.
"LabVIEW for ARM guru and bug destroyer" -
Set a timeout for "read from text file"
I Need to read from a text file on a remote pc and use the read from text file function to do this. It wotks but sometimes this pc is down causing long wait times in my vi.
Is there a way to set a timeout for the read from text file function, or is there an other solution?
Thank youYou could check that the path is valid first before you attempt to read the file. hen put the file read in a True-False case structure based on the results of the check. You can use the function "Check if File or Folder Exists" It checks whether a file or folder exists on disk at a specified path. This VI works with standard files and folders as well as files in LLB files. The function is found in the File I/O --> Advanced File Functions palette.
Tom -
Read from text file vi won't read file...
I am very new to LV programming so I hope you forgive any stupid mistakes I am making. I am using Ver. 8.2 on an XP machine.
I have a small program that stores small data sets in text files and can update them individually or read and update them all sequentially, sending the data out a USB device. Currently I am just using two data sets, each in their own small text file. The delimiter is two commas ",,".
The program works fine as written when run in the regular programming environment. I noticed, however, as soon as I built it into a project that the one function where it would read each file sequentially to update both files the read from text file vi would return an empty data set, resulting in blank values being written back into the file. I read and rewrite the values back to the text file to place the one updated field (price) in it'sproper place. Each small text file is identified and named with a 4 digit number "ID". I built it twce, and get the same result. I also built it into an installer and unfortunately the bug travelled into the installation as well.
Here is the overall program code in question:
Here is the reading and parsing subvi:
If you have any idea at all what could cause this I would really appreciate it!
Solved!
Go to Solution.Hi Kiauma,
Dennis beat me to it, but here goes my two cents:
First of all, it's great to see that you're using error handling - that should make troubleshooting a lot easier. By any chance, have you observed error 7 when you try to read your files and get an empty data set? (You've probably seen that error before - it means the file wasn't found)
If you're seeing that error, the issue probably has something to do with this:
Relative paths differ in an executable. This knowledge base document sums it up pretty well. To make matters more confusing, if you ever upgrade to LabVIEW 2009 the whole scheme changes. Also, because an installer contains the executable, building the installer will always yield the same results.
Lastly, instead of parsing each set of commas using the "match pattern" function, there's a function called "spreadsheet string to array" (also on the string palette) that does exactly what you're doing, except with one function:
I hope this is helpful...
Jim
Maybe you are looking for
-
Custom field in the search criteria of contract management in SRM - POWL
Hi, I have to add a custom field in the search criteria of the POWL query for Contract Management. I have done adjusting of the POWL by adding the custom field in the /SAPSRM/S_POWL_RESULT_CTR and /SAPSRM/S_SEARCH_RESULT_CTR. I have created entries i
-
Terms and Agreement Violation?
Hey, thanks for taking to help me out. Anyways, I'm gonna be buying a web-hosting service pretty soon and I need to check something first. In the Terms and Agreement section of the site, I saw this paragraph. [CLIENT must not run any kind of 'server
-
Creating a Discussion Forum in APEX
I am trying to provide a discussion forum functionality in my APEX application. If there are any plug-ins/similar applications, please let me know. thanks in advance!
-
Hi, I see posts about this subject but none have helped me so far. I seem to have accumulated 3 issues Since a couple of weeks I am unable to download apps from the app world or update apps from the app world. 1. unable to download / update apps from
-
I'm doing a reinstall for various reasons and have hung 4 times at installing python for rankmirrors. After python is installed I get a message about tk and sh with an error about a file not being read because it's missing. The error indicates that t