File reading at run time
hi all,
i have a problem that i want to read a file which is continously update(mean data is inserting in it) i want that my programme continously read the file and show the newly inserted data at runtime.
thx in adavance for help
did any one use a "tail" utility which read log files
and continuously pop up newly inserted data to user.Yes.
i want that type of functionality.And I described how it probably should be done, i.e. ignore EOF and just continue reading (preferably with a small pause between the polls so you don't take 100% cpu).
Similar Messages
-
I have the code to read from a file but my problem is how to prompt the user for the file name at run time.
import java.io.File;
import java.io.FileNotFoundException;
import java.util.InputMismatchException;
import java.util.Scanner;
public class FileRead {
public static void main(String args[]) {
Scanner scan = null;
File file = new File("Results.txt");
String number;
try {
scan = new Scanner(file);
while (scan.hasNext()){
number = scan.next();
System.out.println(number);}
catch (FileNotFoundException ex1){
System.out.println("No such file");
catch (IllegalStateException ex2){
System.out.println("Did you close the read by mistake");
catch (InputMismatchException ex){
System.out.println("File structure incorrect");
finally{
scan.close();}
}Any hints would be greatly appreciated. Thank you in advanceI have read through some of the tutorials that you have directed me too and they are very useful, thank you. however there are still a few things that i am not clear about. I am using net beans 5.0 I have placed a text file named Results.txt into the project at the root so the program can view it.
When I use the code that you provided me with, does it matter where the file is, or will it look through everywhere on the hard drive to find a match?
This code compiles but at run time it comes up with this error
run-single:
java.lang.NoClassDefFoundError: NamedFile
Exception in thread "main"
Java Result: 1
BUILD SUCCESSFUL (total time: 3 seconds)
import java.util.Scanner;
import java.io.*;
class NamedFileInput
public static void main (String[] args) throws IOException
int num, square;
// this Scanner is used to read what the user enters
Scanner user = new Scanner( System.in );
String fileName;
System.out.print("File Name: ");
fileName = user.nextLine().trim();
File file = new File( fileName ); // create a File object
// this Scanner is used to read from the file
Scanner scan = new Scanner( file );
while( scan.hasNextInt() ) // is there more data to process?
num = scan.nextInt();
square = num * num ;
System.out.println("The square of " + num + " is " + square);
}his is the code that i used. It is the same as the code you posted for me (on chapter 23 I/O using Scanner and PrintStream) Sorry im just really stuck on this!! -
Can we load and unload the files in the run time?
Can we load and unload the files in the run time?
For example there are four files named "test1.h & test1.c" and another set "test2.h & test2.c" (I attached them as attachment to this post).
test1.h contains code:
int variable; //variable declared as integer
test1.c contains code:
variable = 1; //variable assigned a value
test1.h contains code:
char *variable; //variable declared as string
test1.c contains code:
variable = "EXAMPLE"; //variable assigned a string
So here, in this case can I dynamically load / unload the first & second group of files so that the same variable name "variable" can be used both as integer and string? And if yes, how is that to be done?
Solved!
Go to Solution.
Attachments:
test.zip 1 KBWhat do you mean by "dynamically"?
If you want to have a variable that either is an int or a char in the same program run, I'm afraid your only option is to define it as a variant and assign from time to time the proper data type in the variant according to some condition. Next, every time you access the variable you must firstly check which data type is stored in it, next access it in the proper way.
If on the other hand your option or to have a run in which the variable is an int, next you stop the program and in a following run it is a char, you may have it by using some appropriade preprocessor clause:
#ifdef CHAR_TYPE
#include "test1.h"; // variable defined as a char
#else
#include "test2.h"; // variable defined as int
#endif
Next, every time you want to access the variable you must proceed in the same vay:
#ifdef CHAR_TYPE
variable = "string";
#else
variable = 1;
#endif
Does it worth the effort?
Additionally, keep in mind that this "dynamical" approach can work only in the IDE, where you can properly #define your CHAR_TYPE or not depending on your wishes: when you compile the program, it will have only one #include depending on the definition of the macro.
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos? -
Getting adobe form file size at run time
hi,
ya i need the adobe form file size at run time. my requirement
is to get xstring and file size of the adobe form. adobe form format is already in xstring format, but how to get the file size.Hi,
try the following:
DATA lv_file_content TYPE xstring.
DATA lv_file_size TYPE i.
lv_file_size = XSTRLEN( lv_file_content ).
This will give you the file size in Byte. For KB, just divide by 1024, and once more for MB.
Kind regards
Ole -
Appending in file and supplying file name at run time using File Adapter
Hi,
Can we use File Adapter to write in a file in append mode. i.e. a BPEL process opening a file appending some text and closing the file each time it called.
Another query is can we create the file at run time with the supplied file name?In order to append to a file, we can use Append="true" in the interaction spec for the File/Ftp adapter.
<jca:operation
FileType="ascii"
PhysicalDirectory="/home/adapter/output"
FileNamingConvention="OutputFile.txt"
NumberMessages="1"
Append="true"
>
Filename we can specify in wsdl... -
Dynamic jar file inclusion at run time
Hello,
I have a java application which should accept the three parameters.
1) The jar file location
2) Particular Class file insdie that jar(we specified the location in step number 1)
3) And method name in that class.
My question is how to include specified jar location with jar name to CLASSPATH at run time. So that i can execute a particular method name in step number (3).
I would appreciate for the quick reponse or any input.
Thanks,
RaghuAnd if you want to change the system classpathduring
runtime, don't forget that you can always use
reflection to call the System classloader'sprotected
addUrl method :)Really?
Seems reasonable although this is the first time I
have seen that referred to.you can indeed. I've done this, as a quick avoid-writing-a-classloader hack. wouldn't really recommend it, though. if you're using reflection to modify access, chances are you're doing a massive fudge
and of course, since it's not part of a public API, there's absolutely no reason to the method won't simply disappear in a future release.... -
How to change property file contents during run time?
Hi everyone. First post so go easy on me please.
I have a couple of properties that I want to read from a from a file. To achieve this I simply use:
ResourceBundle.getBundle("my.package.MyItems").getString("MyProperty");
This works like a wonder. The problem is, i want to change the property "MyProperty" during runtime. I've found the properties file (MyItems.properties) inside weblogic, but if a change its contents it does not reflect in the application.
I can come up with a couple of justifications:
* I'm not looking in the right folder/changing the wrong file in the server;
* Weblogic caches the properties file, meaning that I have to redeploy the project (defeating the purpose of actually having a properties file).
Can anyone help with this one?
[EDIT] Forgot important info:
* JDeveloper 11.1.1.4
* Weblogic 11.3 (not 100% sure)
* Both JDev and WebLogic running on Windows 7 64 bits
Thank you in advance!
Best Regards
J. Peixoto
Edited by: 868634 on Jul 12, 2011 9:37 AM
Edited by: 868634 on Jul 12, 2011 10:21 AM
JDeveloper 11.1.1.4, not 3I tried it all.
Just an explanation of my context.
I have 1 application with 2 projects in it. First project is called "CommonUI_ViewController" and the second one "FO_ViewController".
The properties file I'm trying to change is located inside "CommonUI_ViewController", in package "PropertiesConfig" and the file is called "PhaseListener.properties".
"FO_ViewController" is dependent on "CommonUI_ViewController". When I run "FO_ViewController" the integrated weblogic server log shows this (among other things):
[10:25:55 AM] Wrote Web Application Module to D:\JDeveloper\dump\system11.1.1.4.37.59.23\o.j2ee\drs\SPV_BPM\FO_ViewControllerWebApp.war
[10:25:57 AM] Wrote Web Application Module to D:\JDeveloper\dump\system11.1.1.4.37.59.23\o.j2ee\drs\SPV_BPM\CommonUI_ViewControllerWebApp.war
Note: both lines above point to folders. "FO_ViewControllerWebApp.war" and "CommonUI_ViewControllerWebApp.war" are NOT war files, but folders that have that name.
I tried changing the properties file in the following locations:
* D:\JDeveloper\dump\system11.1.1.4.37.59.23\o.j2ee\drs\SPV_BPM\FO_ViewControllerWebApp.war\WEB-INF\lib\adflibSPVCommonUI.jar > PropertiesConfig\PhaseListener.properties;
* D:\JDeveloper\dump\system11.1.1.4.37.59.23\o.j2ee\drs\SPV_BPM\CommonUI_ViewControllerWebApp.war\WEB-INF\lib\adflibSPVCommonUI.jar > PropertiesConfig\PhaseListener.properties;
* D:\JDeveloper\dump\system11.1.1.4.37.59.23\o.j2ee\drs\SPV_BPM\CommonUI_ViewControllerWebApp.war\WEB-INF\classes\PropertiesConfig\PhaseListener.properties (no need to open any jar/war to get to this one).
I changed all these files with different values but no change was shown in the application (using the method in the previous post).
I believe that I'm still doing something wrong :/
Thank you for your help so far vinod_t_krishnan!
J. Peixoto -
Help please - how can i change a file extension at run time
hi all
i have a question about file created on the run. for instance, if i need to create a file initially with a an extension of '.in'. and there are some processes writing data to it, and after the file is written. i need to change it to some thing like '.out'. is it possible to do this? can u please provide some samples if you have any solution or suggestion. thanks.do u have the links of these tutorials?IO tutorials...
http://java.sun.com/docs/books/tutorial/essential/io/index.html -
Maybe I was to quick to report this as a bug... I was unable to find anything related to it at my normal sources of information. Does someone has exeperience with it?
I have a work-around and this is included in the description :
http://forums.ni.com/ni/board/message?board.id=BreakPoint&message.id=6776 (message 25)
** Original post **
When a library (.lvlib) that contains a file with a run-time-menu (.rtm) file is removed from the project, but there is still a file that uses this .rtm file, both the .lvlib and all of it's vis and the .rtm file are displayed in the project Dependencies.
For the Vi's the callers can be found by 'Find->calllers'. For the .rtm file this always results in 'No items found' but the .rtm file remains in the Dependencies (as it should since it is still used).
Finding the .rtm file can be hard since it is only loaded at run-time and not at edit time(?). If someone encounters this issue, a working method:
- rename the rtm file (so it cannot be found)
- open the vis that you suspect are using this file AND try to edit the run-time menu. When this vi uses the run-time menu a warning will appear (cannot load rtm file, using default menu instead)
Kind regards,
MarkDear Mr. Beuvink,
thank you for your reply. It seems that a while back this problem has been reported to our R&D group. The request (CAR) has ID; 41579. There is the following statement in this CAR: the caller vi is in memory or not. When a caller vi is in memory, rtm files will currently never report the vi as a caller. This confirms the behavior you are seeing.
I'm sorry to say I don't have a solution at this moment, at this moment they are busy fixing this problem. You can look this up in future release notes by searching on the CAR ID I mentioned.
If you haven any questions, please don't hesitate to contact me.
Best regards,
Martijn S
Applications Engineer
NI Netherlands -
Hi Forum,
I have Created queries in FIAR on a particular Infocube which uses Datasource 0FI_AR_4. The problem is when ever I make any changes in the property of any query object it give me an error which reads as: " Run time error 429" "Activex Component cant create object".
Any suggestions on how to resolve the issue.
I promise to award full points tohelpful answers.
Thanx and regards
SuhelHello,
i also faced this problem many times but i fixed it, i also got some help from this article [error 429 windows 7|http://www.error429.com] , hope someone might get help from this article.
Runtime error 429: u201CActiveX component canu2019t create objectu201D
Here is a solution to this error:
Reinstall Windows Script
Repair Windows Script File Information in Registry
Reregister Concerning File
Reset Internet Explorer Settings
Restore your Computer
Repair System Files -
Run time Error : UNCAUGHT_EXCEPTION
Hi Team
Pls reply to resolve the below error
When we are uploaded TB through flexible upload and then Test run for Data Collection for that Cons unit, we got the below Run time error:
Runtime Errors UNCAUGHT_EXCEPTION Except. CX_UCI_NO_CHECK
Short dump has not been completely stored
Short text
An exception occurred that was not caught.
What happened?
The exception 'CX_UCI_NO_CHECK' was raised, but it was not caught anywhere
along
the call hierarchy.
Since exceptions represent error situations and this error was not
adequately responded to, the running ABAP program
'CL_UC_DATASTREAM==============CP' has to be
terminated.
Error analysis
An exception occurred which is explained in detail below.
The exception, which is assigned to class 'CX_UCI_NO_CHECK', was not caught and
therefore caused a runtime error.
The reason for the exception is:
An exception occurred
Missing Handling of Application Exception
Program UCUWB000
Trigger Location of Exception
Program CL_UC_DATASTREAM==============CP
Include CL_UC_DATASTREAM==============CM003
Row 150
Module type (METHOD)
Module Name DTS_READ_TRANSACTION_DATA
Source Code Extract
Line
SourceCde
120
it_hry_field = it_char_node
121
it_hry_field_attr = it_char_attr_node
122
it_hry_node = lt_hry_node
123
it_hry_attr_node = lt_hry_attr_node
124
i_authority_check = l_authority_check
125
i_keydate = i_keydate
126
it_hry_nodename = lt_hry_nodename
127
it_hry_attr_nodename = lt_hry_attr_nodename
128
i_packagesize = i_packagesize
129
i_cursor_mode = i_cursor_mode
130
importing
131
et_hry_data = lt_hry_data
132
e_end_of_data = e_done
133
et_message = lt_message1
134
changing
135
ct_data = ct_data
136
exceptions
137
no_authorization = 1.
138
139
if sy-subrc is not initial.
140
move-corresponding syst to ls_message2.
141
raise exception type cx_uci_no_authorization
142
exporting ds_message = ls_message2.
143
endif.
144
145
if lt_message1 is not initial.
146
loop at lt_message1 into ls_message1.
147
move-corresponding ls_message1 to ls_message2.
148
insert ls_message2 into table lt_message2.
149
endloop.
>>>>>
raise exception type cx_uci_no_check
151
exporting dt_message = lt_message2.
152
endif.
153
154
call method dts_process_hry_result
155
exporting
156
it_hry_node = lt_hry_node
157
it_hry_attr_node = lt_hry_attr_node
158
it_hry_nodename = lt_hry_nodename
159
it_hry_attr_nodename = lt_hry_attr_nodename
160
it_hry_data = lt_hry_data
161
importing
162
et_node_data = et_node_data.
163
164
call method lo_tx_data->read_data_from_infoprov
165
exporting
166
i_comp_s_field = i_comp_s_char
167
i_comp_s_kfig = i_comp_s_kfig
168
it_field = it_char
169
it_kfig = it_kfig
Pls revert me immediately how to resolve the issue, i already do the following functionality as per OSS Note 1074424
thanks & regards
Madhu ylHi Sanjyot,
The solution is resolved by technical team ,
I don't have suport documents to fulfill, they said they added data files and this run time occurs due to space problem
Thanks
Madhu
Edited by: Madhu YL on Jun 10, 2009 1:32 PM -
Mdworker deny file-read-data, what does it really mean?
I get numerous log posts like this:
3/17/14 7:22:57.561 AM sandboxd[5688]: ([4412]) mdworker(4412) deny file-read-data /Volumes/Time Machine Backups/Backups.backupdb/Jack Shelton’s iMac/2014-03-17-042247/JackHD/System/Library/Fonts/TimesLTMM (import fstype:hfs fsflag:4809018 flags:48200000056 diag:0 uti:com.apple.font-suitcase plugin:/Library/Spotlight/Font.mdimporter - find suspect file using: sudo mdutil -t 235288)
My questiions are:
What is being sandboxed, the mdworker or the file Times LTMM or the mdimporter?
Which one has the sudo command in it?
What does the -t flag/option mean? Looking it up via man mdutil in the terminal, it does't exist.
I saw this type of post quite frequently in Mavericks so much so that I decided to start over from scratch. I wiped the HD including the HD Recovery partition and installed OS X 10.6.8. I am now in Mountain Lion and have reinstalled MS Office 2011 and loaded the main identity data from my recovered files. I did not see any adverse log posts until I ran the first time machine backup.
I hope someone can clear the air for me with perhaps a way to fix it.Thank you Baltwo. It's a major relief to know that the sudo command is being used by an Apple app/process and not by a file that's not supposed to have it.. However a few more questions if you don't mind.
Is the font file the suspect file or is it this particular mdworker?
If the font file is the suspect file will a process or app that calls for it be allowed to use it?
Which process/app/file invoked the sandbox and deny file-read-data?
What is the role of the mdimporter?
These questions are part of my attempt to understand how a large part of the files on my computer and Time Machine become corrupted when I first installed Mavericks. Mainly .plist (and other plain text files), .png, jpeg (and other picture types) and pkg info bundles would have thier icons and file Kind changed to Unix Executable files, spreadssheets and doc/docx would become genrandom (or something similar). I became aware of this when my machine began freezing up. I made several clean reinstalls and the problems would reoccur on plugging in the Time Machine. I eventually recovered the files I wanted from the Time Machine but I had to use another iMac with an older OS X. I repartitioned my machine and rebuilt it to Mountain Lion and i'm in the process of reloading with what I hope are non corrupted files. Although I still see log posts like "Locum[6230]: Connection with distnoted server was invalidated" every time I paste a folder or file. I don't know what that means but it doesn't seem to cause any further reaction or posts.
My apologizes for bothering you with alll this and thanks for your insight. -
Installing Run Time engine question
Hi,
I am new to this and I am looking for information on how to set up a test system PC.
I have the 2014 developer software and one test seat but need to know how to install the labview 2014
runtime engine and anything else that I need in order to use this test system PC to run Labview and teststand
applications that I create with my development system PC...
Is there any tutorials or instructions out there that I can download that will tell me everything that I need to install and how on my target test system?
Thanksthe Installation instructions are on the Download Page
Installation Instructions
Close all NI software.
Run the LVRTE2014_f1Patchstd.exe self-extracting executable and follow the prompts.
Repeat these steps for all development systems where you want to install the LabVIEW 2014 Run-Time Engine (32-bit).
The installation files for the Run-Time Engine are automatically extracted to a directory on disk. The installer does not remove the files after installing, if you want to remove these files from disk, be sure to note their location during the unzipping process.
Jeff -
LabVIEW 8 Run-Time Eninger on 2011 Startup
Hey All,
Weird issue here where the LabVIEW 8.2.1 Run-Time engine trys to install/configure itself everytime I start the 2011 development environment. Has anyone ever seen this?
It quickly goes to a prompt asking for...
"The Feature you are trying to use is on a network resource that is unavailable."
Clock OK to try again or enter an anternate path to a folder containing the installation package 'lv82runtime.msi' in the box below.
Why would it be asking for this at all? It tries to install itself 3-4 times before finally launching the development environment.
Regards,
KenHi Ken,
That is odd behavior, there could be a corrupt file in you run time install. I would suggest repairing your LabVIEW 8.2.1 Run Time Engine. Refer to the document below for repairing NI software.
How Do I Uninstall or Repair National Instruments Software?
http://digital.ni.com/public.nsf/allkb/AC6ED75D3D93375686256E8E00245F0D?OpenDocument
Tim O
Applications Engineer
National Instruments -
CSV file reading using UTL_FILE at run time
Hi,
I have to read CSV file using UTL_FILE.
but Folder contains Many CSV files.
I dont know there name.So i have to read csv file at run time.
Please let me know how should we achieve this?
Thanksplace the following in a shell script, say "list_my_files.ksh"
ls -l > my_file_list.datthen run the shell script using dbms_scheduler;
begin
dbms_scheduler.create_program (program_name => 'a_test_proc'
,program_type => 'EXECUTABLE'
,program_action => '/home/bluefrog/list_my_files.ksh'
,number_of_arguments => 0
,enabled => true);
end;
/then open "my_file_list.dat" using UTL_FILE, read all file names and choose the one you require.
P;
Maybe you are looking for
-
I have a power mac g4 with mac os 10.4. 11 , I want to change the hard-drive ,what program can I used to transfer one hard-drive data to another hard- drive on this mac pc.
-
IPhoto won't recognize iPhone as a device
I have talked to apple about this and sent information to help, but it didn't work. When I plug-in the phone to the computer and open iPhoto, iPhoto does not do what the Apple tech said it would do. It does not acknowledge the iPhone camera as a devi
-
I erased my images and i want to recover them
-
Hello, i hope someone can help with this query, i have a feeling it is a simple one but i am only a beginner. In my library for example, i have 20 songs by Jimmy Barnes. 10 of which i have imported from various cd's and the other 10 are all from one
-
Why can't I use Server 2.2.2 with Mavericks 10.9
why can't I use Server 2.2.2 with Mavericks 10.9? I have just upgraded and there seems to be no way to upgrade the Mini server. Do I have to uninstall Mavericks