Read from file at a particular rate
hi
could anyone tell me if its possible to read from a previously stored text file at some required rate?
( for example if i have 100 entries in my file i wish to read one value every 5 seconds)
thanks in advance
Solved!
Go to Solution.
First, you'll have to learn not to use Express VI's. (Look in example finder for examples on file I/O)
1. You have no good control over the way it accesses the data.
2. It puts out the annoying dynamic datatype which hides what the data is, and makes you jump through hoops to get the real data out of it.
Second, you need a loop. Right now your code is set up to just run as a single shot.
Here is how you would read one line at a time with a 2 second delay. (Note that the read text file was set in its right click menu to "read lines".)
Another alternative, (and probably better), would be to read the whole file at once, and then just index the values out of the resulting array in a loop with a 2 second delay.
The formula express VI's are doing some operations that could be handled easily with native LabVIEW code. I would get rid of those express VI's. The first formula node has some pretty basic operatons as well. The bigger formula node could also be done with basic LabVIEW operations, but the coding logic going on in there is complicated enough that I would probably leave that formula node as it is.
Message Edited by Ravens Fan on 03-04-2010 01:05 AM
Attachments:
wind%20solar[1]_BD.png 14 KB
Similar Messages
-
Error reading from file glibc-2.5-24.i686.rpm RHEL 5 Setup stuck at 80%
Hi, I am installing Oracle 10g on RHEL 5 (Red Hat Enterprise Linux 5) machine I am facing two problems
1) while installing the rpm packages the following package gave an error
Error reading from file glibc-2.5-24.i686.rpm
2) I still gave a try to runInstaller command the installer opened but was stuck at 80%
I have 3 GB ram and 320GB hard drive I am not sure what to put in the swap memory and other settings i blindly followed instructions given here
http://www.oracle-base.com/articles/10g/OracleDB10gR2InstallationOnRHEL5.php
What could be the problem where do I find the error log if its created
Please help me
Thanks
Edited by: 891355 on Nov 6, 2011 12:06 PMI found the installActions file in the installer folder and I think this could be the problem
INFO: The 'shiphomeproperties.xml' file is missing from shiphome location '/home/oracle/Desktop/database/install/../stage/products.xml.' Add this file to the 'Disk1/stage' directory of the shiphome.
though I am attaching the log file for more details do you think the installer is corrupt :(
InstallActions log file ==> http://www.mediafire.com/?nh7mx7bxqht9ovu
Edited by: 891355 on Nov 6, 2011 1:35 PM -
Hi all
I'm trying to install SQL 2008 Express on my Computer: Hp compact DX7300 Slim tower.
and get this error:
TITLE: Microsoft SQL Server 2008 Setup
The following error has occurred:Error reading from file d:\8268cd7b247d294de359c9\x86\setup\sql_engine_core_inst_msi\PFiles\SqlServr\MSSQL.X\MSSQL\Binn\Template\msdbdata.mdf. Verify that the file exists and that you can access it.
Click 'Retry' to retry the failed action, or click 'Cancel' to cancel this action and continue setup.
For help, click: http://go.microsoft.com/fwlink?LinkID=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=10.0.1823.0&EvtType=0xF45F6601%25401201%25401
Log file
Overall summary:
Final result: SQL Server installation failed. To continue, investigate the reason for the failure, correct the problem, uninstall SQL Server, and then rerun SQL Server Setup.
Exit code (Decimal): -2068643839
Exit facility code: 1203
Exit error code: 1
Exit message: SQL Server installation failed. To continue, investigate the reason for the failure, correct the problem, uninstall SQL Server, and then rerun SQL Server Setup.
Start time: 2014-12-09 23:22:03
End time: 2014-12-09 23:40:28
Requested action: Install
Log with failure: C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20141209_232121\sql_engine_core_inst_Cpu32_1.log
Exception help link: http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=10.0.1823.0
Machine Properties:
Machine name: VISTA-PC
Machine processor count: 2
OS version: Windows Vista
OS service pack: Service Pack 1
OS region: United States
OS language: English (United States)
OS architecture: x86
Process architecture: 32 Bit
OS clustered: No
Product features discovered:
Product Instance Instance ID Feature
Language Edition Version Clustered
Package properties:
Description: SQL Server Database Services 2008
SQLProductFamilyCode: {628F8F38-600E-493D-9946-F4178F20A8A9}
ProductName: SQL2008
Type: RTM
Version: 10
SPLevel: 0
Installation location: d:\8268cd7b247d294de359c9\x86\setup\
Installation edition: EXPRESS
User Input Settings:
ACTION: Install
ADDCURRENTUSERASSQLADMIN: False
AGTSVCACCOUNT: NT AUTHORITY\NETWORK SERVICE
AGTSVCPASSWORD: *****
AGTSVCSTARTUPTYPE: Disabled
ASBACKUPDIR: Backup
ASCOLLATION: Latin1_General_CI_AS
ASCONFIGDIR: Config
ASDATADIR: Data
ASDOMAINGROUP: <empty>
ASLOGDIR: Log
ASPROVIDERMSOLAP: 1
ASSVCACCOUNT: <empty>
ASSVCPASSWORD: *****
ASSVCSTARTUPTYPE: Automatic
ASSYSADMINACCOUNTS: <empty>
ASTEMPDIR: Temp
BROWSERSVCSTARTUPTYPE: Disabled
CONFIGURATIONFILE: C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20141209_232121\ConfigurationFile.ini
ENABLERANU: True
ERRORREPORTING: False
FEATURES: SQLENGINE,REPLICATION
FILESTREAMLEVEL: 0
FILESTREAMSHARENAME: <empty>
FTSVCACCOUNT: <empty>
FTSVCPASSWORD: *****
HELP: False
INDICATEPROGRESS: False
INSTALLSHAREDDIR: C:\Program Files\Microsoft SQL Server\
INSTALLSHAREDWOWDIR: C:\Program Files\Microsoft SQL Server\
INSTALLSQLDATADIR: <empty>
INSTANCEDIR: C:\Program Files\Microsoft SQL Server\
INSTANCEID: SQLExpress
INSTANCENAME: SQLEXPRESS
ISSVCACCOUNT: NT AUTHORITY\NetworkService
ISSVCPASSWORD: *****
ISSVCSTARTUPTYPE: Automatic
MEDIASOURCE: d:\8268cd7b247d294de359c9\
NPENABLED: 0
PID: *****
QUIET: False
QUIETSIMPLE: False
RSINSTALLMODE: FilesOnlyMode
RSSVCACCOUNT: <empty>
RSSVCPASSWORD: *****
RSSVCSTARTUPTYPE: Automatic
SAPWD: *****
SECURITYMODE: <empty>
SQLBACKUPDIR: <empty>
SQLCOLLATION: SQL_Latin1_General_CP1_CI_AS
SQLSVCACCOUNT: NT AUTHORITY\NETWORK SERVICE
SQLSVCPASSWORD: *****
SQLSVCSTARTUPTYPE: Automatic
SQLSYSADMINACCOUNTS: VISTA-PC\VISTA
SQLTEMPDBDIR: <empty>
SQLTEMPDBLOGDIR: <empty>
SQLUSERDBDIR: <empty>
SQLUSERDBLOGDIR: <empty>
SQMREPORTING: False
TCPENABLED: 0
X86: False
Configuration file: C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20141209_232121\ConfigurationFile.ini
Detailed results:
Feature: Database Engine Services
Status: Failed: see logs for details
MSI status: Passed
Configuration status: Passed
Feature: SQL Server Replication
Status: Failed: see logs for details
MSI status: Passed
Configuration status: Passed
Rules with failures:
Global rules:
Scenario specific rules:
Rules report file: C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20141209_232121\SystemConfigurationCheck_Report.htm
I will very appriciate if someone can help me solve it. I was trying to set Full control for my account in Properties/Security of root folder and try again but error is still.
Many thanksHi Foreverduy,
Before you run SQL Server 2008 express setup, make sure that you have installed Windows installer 4.5 and.NET Framework 3.5 SP1 manually. For more information about the process, please refer to the article:
http://msdn.microsoft.com/en-us/library/ms143506(v=sql.100).aspx. Moreover, please turn off all the third-party softwares which could prohibit the installation process.
According to your error message, the issue could be due to that your account has no rights to install SQL Server, or the corruption on the media.
Firstly, please ensure that your account has admin rights. Also make sure that you right-click the setup.exe and choose “Run as administrator” to complete the installation.
Secondly, please check if "msdbdata.mdf" file exists at d:\8268cd7b247d294de359c9\x86\setup\sql_engine_core_inst_msi\PFiles\SqlServr\MSSQL.X\MSSQL\Binn\Template. If it exists, please make sure that your account has read permission to the extracted
folder.
However, if the file doesn't exist in the extraction, the media could be corrupt. Please download the
media
again and check if the issue still occurs.
Regards,
Michelle Li -
Iam trying to load illustator in my PC i get following error while loading Application CD 2
Adobe Illustrator CS4
Error:
Error 1603. Error 1305.Error reading from file C:\Program Files\Adobe\Adobe Illustrator CS4\Support Files\Required\Fonts\AdobeSongStd-Light.otf. Verify that the file exists and that you can access it.
AdobeColorCommonSetRGB
Error:
Error 2.
My serial no. [Removed by moderator]Download a copy an installer for CS4 from the links on this page:
Other downloads -
Read from file and plot data against timestamp
Hello,
I know that there are already many posts regarding the question I m about to ask. But, I somehow dont seem to achieve what I want using the suggestions given in the other posts.
My problem is that, I have a file with the first column as a time stamp containing hour, minute, second and millisecond. The second column in a set of pressure values. I want to plot a graph of these pressure values against the timestamp recorded in this .txt file. Whatever I do, the timestamp values seem to skip by a couple of seconds.
How do i do this correctly?
Also, Is it advisable to use the read from file or the read from spreadsheet file vi? Kindly help me out.
Thanks and regards.Hey, I was having a similar issue the other day. The first problem I had was how to open the file and actually get the timestamp information. Since I'm using LabView 8.0, I had to go into Read Spreadsheet File and create a new vi to open strings (in an array form). That's the Read Spreadsheet File (string) vi below. Then, I had to figure out how to convert the string of a timestamp to something meaningful to me. The Timestamp2.vi is how I did that below. I'm also including a little test file. So, to run Timestamp2.vi, you will have to input the right base path, and have the Read Spreadsheet File (string).vi in the same place as Timestamp2. Hope that helps. I think I'm finally getting this stuff, so let me know if it doesn't work.
Attachments:
Test.txt 1 KB
Timestamp2.vi 28 KB
Read From Spreadsheet File (String).vi 25 KB -
Web Service; Error attempting to read from file
I'm trying to connect to a web service as outlined by the book "Creating Dynamic Forms with Adobe LiveCycle Designer" which is an excellent book by the way.
I'm receiving the following error "Error attempting to read from file. http://www.webservicex.net/BibleWebservice.asmx"
I've successfully created the Data Connection to
http://www.webservicex.net/BibleWebservice.asmx?wsdl
I dragged and dropped the bookTitle, chapter & Versie onto the form. I also dragged and dropped the GetBibleWordsByChapterAndVerseResult and the GetBibleWordsByChapterAndVerseBtn.
I Preview PDF and click the button I get the above error.
Does anyone have experience using Web Services with Adobe LiveCycle ES and have advice on how to resolve this. Any Suggestions would be greatly appreciated.
-ToddWell, I have more news on the error I'm getting. - NO I didn't find the problem. Yet
I checked and made sure that web.config had "None" selected " in authentication mode. I.E. <authentication mode="None" /> This should eliminate any authentication problems since that turns off IIS's authentication checking.
At first I was thinking the form was generating the error trying to read the result coming back from the web service, but I put in some code that writes the result to a log file when the method fires off.
I noticed that when I clicked on the button on the form, the error message would pop up from Acrobat, but when I check the log file, there was NO entry. This means that Acrobat failed before it could execute the method.
Here is the web method:
[WebMethod(CacheDuration = 30,
Description="Returns the String 'True' or 'False' whether or
not you entered a 'T' or 't'.")]
public string TF(string Tf)
string result="False";
if(Tf.Substring(0,1).ToLower()=="t"){
result= "True";}
LogFile.Write("Sent: "+result);
return result; -
Dear friends,
I have one problem. When we are creating abap program by clicking on program button on recording screen it asks for the program name and there are 2 oprions..
1) read from file and
2)transfer from recording....second one is fine...but i am not able to use first option...how to use that and why it is used...
Thanks And Regards,
Bhavin Shah.Hi Bhavin,
The basic difference between read from file & transfer from recording is that...
In transfer from recording you have to give a session name or you have to choose call transaction. Here you have to give the data manually.
The Read from file will generate a dataset where who have to give that path of your flat file. When you execute it the data from the flat file will go into the necessary fields you have choosen before. You can process the job in the back ground which will be executed and a log file will be generated so that you can check whether it is updated correctly or not.
In general we use read from file option when we know that the data are correctly arranged for recording.
For eg. if you want to update the database with the file you have to know the datatype and length of each database-field so that you can specify the data in a file.
i.e Assume that you are having 2 fields in db-table of type char and length 10 & 20. Assume that you are going to give values for these fields as mala & kala.
In the file... you should specify like this...
mala kala xxx
123456789012345678901234567890
<---Ten--><-----Twenty------->
In a Real Time scenario you have a very large table with 50 to 100 fields to update with a very large data like 1000 - 10,000 records and if you are not sure with the flat file data. Then you should not go for the file option.
Hope this helps you.
Regards,
Maheswaran.B -
Is there is abetter performance to read from file than my code for longfile
Hi
This is my code to read from file and show it in a text area ,but for long file it wait for along time to show the file ,Is there is better performance code?
chooser=new JFileChooser();
chooser.showOpenDialog(sav);
File fe=new File(chooser.getSelectedFile().getAbsolutePath());
//out = new PrintWriter(new FileOutputStream(f));
in2 = new BufferedReader(new FileReader(fe));
str=in2.readLine();
if(str!=null)
nn2=str;
str=in2.readLine();
try{
while((str)!=null)
{ nn2=nn2+"\n"+str;
str=in2.readLine();
}}catch(NullPointerException e){}
jta2.setText(nn2);
in2.close();
// in2 = new BufferedReader(new FileReader(fe));
} catch (IOException ex) {
}catch(NullPointerException e){}
nn1=str;Yes you code would be slow because you are continually creating new string by concatenating one string to another.
The easiest way is to simply use the read(...) method of the text area. -
Reading from file into an array
Hello, new to Java and we need to modify a mortgage calculator to read interest rate from a file into an array and not have them hard coded in the program. I have read many post on how to perform this but am lost on where to put the new code and format. Here is my code and I hope I posted this right.
import javax.swing.*; // Imports the Main Swing Package
import javax.swing.event.*;
import javax.swing.text.*; // Used for Text Box Caret Position
import java.awt.*; // Imports the main AWT Package
import java.awt.event.*; // Event handling class are defined here
import java.text.NumberFormat;
import java.text.*; // Imports the Main Text Package
import java.util.*; // Imports the Main Utility Package
public class mortgageCalculator1 extends JFrame implements ActionListener // Creates class mortgageCalculator
JLabel AmountLabel = new JLabel(" Enter Mortgage Amount:$ "); // Declares Mortgage Amount Label
JTextField mortgageAmount = new JTextField(10); // Declares Mortgage Amount Text Field
JButton IntandTerm1B = new JButton("7 years at 5.35%"); // Declares 1st Mortgage Term and Interest Rate
JButton IntandTerm2B = new JButton("15 years at 5.50%"); // Declares 2nd Mortgage Term and Interest Rate
JButton IntandTerm3B = new JButton("30 years at 5.75%"); // Declares 3rd Mortgage Term and Interest Rate
JLabel PaymentLabel = new JLabel(" Monthly Payment: "); // Declares Monthly Payment Label
JTextField monthlyPayment = new JTextField(10); // Declares Monthly Payment Text Field
JButton exitButton = new JButton("Exit"); // Declares Exit Button
JButton newcalcButton = new JButton("New Calculation"); // Declares New Calculation Button
JTextArea mortgageTable = new JTextArea(35,65); // Declares Mortgage Table Area
JScrollPane scroll = new JScrollPane(mortgageTable); // Declares ScrollPane and puts the Mortgage Table inside
public mortgageCalculator1() // Creates Method
super("MORTGAGE CALCULATOR"); // Title of Frame
JMenuBar mb = new JMenuBar(); // Cretes Menu Bar
JMenu fileMenu = new JMenu("File"); // Creates File Menu
fileMenu.setMnemonic('F'); // Enables alt + f to Access File Menu
JMenuItem exitItem = new JMenuItem("Exit"); // Creates Exit in File Menu
fileMenu.add(exitItem); // Adds Exit to File Menu
exitItem.addActionListener(new ActionListener() // Adds Action Listener to the Exit Item
public void actionPerformed(ActionEvent e) // Tests to Verify if File->Exit is Pressed
System.exit(0); // Exits the Programs when File->Exit is Pressed
mb.add(fileMenu); // Adds the File Menu
setJMenuBar(mb);
setSize(600, 400); // Sets Size of Frame
setLocation(200,200); // Sets the Location of the Window
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Command on how to close frame
JPanel pane = new JPanel(); // Declares the JPanel
pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); // Sets Panel Layout to BoxLayout
Container grid = getContentPane(); // Declares a Container called grid
grid.setLayout(new GridLayout(4,3,5,5)); // Sets grid Layout to GridLayout
pane.add(grid); // Adds the grid to the Panel
pane.add(scroll); // Addes the scrollPane to the Panel
grid.setBackground(Color.yellow); // Set grid color to Yellow
setCursor(new Cursor(Cursor.HAND_CURSOR)); // Makes the cursor look like a hand
mortgageAmount.setBackground(Color.black); // Sets mortgageAmount JPanel JTextField Background Color
mortgageAmount.setForeground(Color.white); // Sets mortgageAmount JPanel JTextField Foreground Color
mortgageAmount.setCaretColor(Color.white); // Sets mortgageAmount JPanel JTextField Caret Color
mortgageAmount.setFont(new Font("Lucida Sans Typewriter", Font.PLAIN, 18)); // Sets mortgageAmount JPanel JTextField Font
monthlyPayment.setBackground(Color.black); // Sets monthlyPayment JPanel JTextField Background Color
monthlyPayment.setForeground(Color.white); // Sets monthlyPayment JPanel JTextField Foreground Color
monthlyPayment.setFont(new Font("Lucida Sans Typewriter", Font.PLAIN, 18)); // Sets monthlyPayment JPanel JTextField Font
mortgageTable.setBackground(Color.yellow); // Sets mortgageTable JTextArea Background Color
mortgageTable.setForeground(Color.black); // Sets mortgageTable JTextArea Foreground Color
mortgageTable.setFont(new Font("Arial", Font.PLAIN, 18)); // Sets JTextArea Font
grid.add(AmountLabel); // Adds the Mortgage Amount Label
grid.add(mortgageAmount); // Adds the Mortgage Amount Text Field
grid.add(IntandTerm1B); // Adds 1st Loan and Rate Button
grid.add(PaymentLabel); // Adds the Payment Label
grid.add(monthlyPayment); // Adds the Monthly Payment Text Field
monthlyPayment.setEditable(false); // Disables editing in this Text Field
grid.add(IntandTerm2B); // Adds 2nd Loan and Rate Button
grid.add(exitButton);
grid.add(newcalcButton); // Adds the New Calc Button
grid.add(IntandTerm3B); // Adds the Exit Button
setContentPane(pane); // Enables the Content Pane
setVisible(true); // Sets JPanel to be Visable
exitButton.addActionListener(this); // Adds Action Listener to the Exit Button
newcalcButton.addActionListener(this); // Adds Action Listener to the New Calc Button
IntandTerm1B.addActionListener(this); // Adds Action Listener to the 1st loan Button
IntandTerm2B.addActionListener(this); // Adds Action Listener to the 2nd loan Button
IntandTerm3B.addActionListener(this); // Adds Action Listener to the 3rd loan Button
mortgageAmount.addActionListener(this); // Adds Action Listener to the Mortgage Amount Text Field
monthlyPayment.addActionListener(this); // Adds Action Listener to the Monthly payment Text Field
public void actionPerformed(ActionEvent e) // Tests to Verify Which Button is Pressed
Object command = e.getSource(); // Enables command to get data
if (command == exitButton) //sets exitButton // Activates the Exit Button
System.exit(0); // Exits from exit button // Exits from exit button
int loanTerm = 0; // Declares loanTerm
if (command == IntandTerm1B) // Activates the 1st Loan Button
loanTerm = 0; // Sets 1st value of Array
if (command == IntandTerm2B) // Activates the 2nd Loan Button
loanTerm = 1; // Sets 2nd value of Array
if (command == IntandTerm3B) // Activates the 3rd Loan Button
loanTerm = 2; // Sets 3rd value of Array
double mortgage = 0; // Declares and Initializes mortgage
double rate = 0; // Declares and Initializes rate
double [][] loans = {{7, 5.35}, {15, 5.50}, {30, 5.75},}; // Array Data for Calculation
try
mortgage = Double.parseDouble(mortgageAmount.getText()); // Gets user input from mortgageAmount Text Field
catch (NumberFormatException nfe) // Checks for correct number fformatting of user input
JOptionPane.showMessageDialog (this, "Error! Invalid input!"); // Outputs error if number is wrong format or nothing is entered
return;
double interestRate = loans [loanTerm][1]; // Sets interestRate amount
double intRate = (interestRate / 100) / 12; // Calculates Interst Rate
double loanTermMonths = loans [loanTerm] [0]; // Calculates Loan Term in Months
int months = (int)loanTermMonths * 12; // Converts Loan Term to Months
double interestRateMonthly = (intRate / 12); // monthly interst rate
double payment = mortgage * intRate / (1 - (Math.pow(1/(1 + intRate), months))); // Calculation for Monthly payment
double remainingLoanBalance = mortgage; // Sets Reamaining Balance
double monthlyPaymentInterest = 0; // holds current interest payment
double monthlyPaymentPrincipal = 0; // holds current principal payment
NumberFormat myCurrencyFormatter = NumberFormat.getCurrencyInstance(Locale.US); // Number formatter to format output in table
monthlyPayment.setText(myCurrencyFormatter.format(payment));
mortgageTable.setText("Month\tPrincipal\tInterest\tEnding Balance\n" + // Formats morgageTable Header
"---------\t----------\t------------\t---------------------\n");
for (;months > 0 ; months -- )
monthlyPaymentInterest = (remainingLoanBalance * intRate); // Calculation for Monthly Payment Toward Interest
//Calculate H = R x I
monthlyPaymentPrincipal = (payment - monthlyPaymentInterest); // Calculation for Monthly Payment Toward Principal
//Calculate C = P - H
remainingLoanBalance = (remainingLoanBalance - monthlyPaymentPrincipal); // Calculation for Reamining loan Balance
// Calculate R = R - C
// H = monthlyPaymentInterest
// R = remainingLoanBalance
// P = payment
// C = monthlyPaymentPrincipal
// I = interestRateMonthly
mortgageTable.setCaret (new DefaultCaret()); // Sets Scroll position to the top left corner
mortgageTable.append(String.valueOf(months) + "\t" + // Pulls in data and formats MortgageTable
myCurrencyFormatter.format(monthlyPaymentPrincipal) + "\t" +
myCurrencyFormatter.format(monthlyPaymentInterest) + "\t" +
myCurrencyFormatter.format(remainingLoanBalance) + "\n");
if(command == newcalcButton) // Activates the new calculation Button
mortgageAmount.setText(null); //clears mortgage amount fields
monthlyPayment.setText(null); //clears monthly payment fields
mortgageTable.setText(null); //clears mortgage table
public static void main(String[] args) //This is the signature of the entry point of all the desktop apps
new mortgageCalculator1();
}OK, making a little progress but am still very confused.
What I have is a file (int&term.dat) with three lines;
5.75, 30
5.5, 15
5.35 ,7
I have three JButtom that I what to read a seperate line and place the term in a term TextField and a rate in a Rate TextField
I have added the following code and all it does now is output a black space to the screen; I am working with one Button and Just the rate for now to try and get it to work. I have been looking at the forums, reading the internet and several books to try and figure this out. I think I may be getting closer.
public static void read()
String line;
StringTokenizer tokenizer;
String rate;
String term;
try
FileReader fr = new FileReader ("int&term.dat");
BufferedReader inFile = new BufferedReader (fr);
line = inFile.readLine();
while (line != null)
tokenizer = new StringTokenizer(line);
rate = tokenizer.nextToken();
line = inFile.readLine();
inFile.close();
System.out.println(new String());
catch (FileNotFoundException exception)
System.out.println ("The file was not found.");
catch (IOException exception)
System.out.println (exception);
} -
Hi! I tried to download Adobe Reader 9.3 from your website (www.adobe.com), it downloaded successfully, but when I tried to install it, I got this error:
Do you know how I can install it so it will read this file? I am not computer-savvy so I don't want to mess with the Security properties of this file nor do anything else with this (or even just anything), unless you are sure you know how to do it so it doesn't mess up my computer. Please help me install this program!! Any help on this is always greatly appreciated!!!
Thank You.Elemanzer wrote:
Sounds like something is wrong with your profile.
Create a new admin profile and log into that and try to install adobe reader. If that works fine, then something is wrong with your profile, if you get the same error message than something is wrong with the machine.
You can also go to "right click" my computer and go to manage.
Under there find "services" and see if the windows installer is disabled.
Do you have the latest java 6.20? Not that it's needed, but you may want to see if you can installl something else. It may not even be Adobe, it could be that you can't install anything.
Creating a new admin profile may not have anything to do with the installation, but I will give it a try anyway.
Edit I tried creating a new admin accout (it worked out succesfully), but when I tried to log into this account, the User Account service failed to log me into it, even with a new password. So this does not apply and I deleted the new account.
As for the Windows Installer in Services, I changed the startup option from Manual to Automatic, and also started it.
I will try running the installer to see if it installs succesfully.
Do you think I could remove the Adobe folder from Program Files, to see if this makes a difference? This is just a suggestion. Any other suggestions please let me know.
I was also thinking, if there are any other Adobe Reader setup files I can download? If so, please post the links in your reply.
Edit 2 I was also wondering (or even worrying) about this:
Does this mean I have to reinstall Windows Vista, simply because I cannot install Adobe Reader because of "missing files and/or folders" thing?!? I have been getting other installation errors from installing other programs (like for instance, I got an "Internal error ..." error because it could not find a specific Temp file when I tried to install Google Earth; or, I got some kind of an error because it could not find an "Installer" folder when I installed Dell Support Center)?!? I would HATE to do this, especially since I made (and wasted) a lot of time backing up my important files, installing Windows Vista, and THEN installing some programs. And NOW I get these errors trying to install?! Good grief!! PLEASE HELP!! -
Reading from file one at a time
I am trying to read from an Excel file one cell at a time, and am having some trouble. I have included my VI. Any help would be greatly appreciated.
Attachments:
demo.vi 165 KBYour first problem is that you are using the Read file function. This doesn't work with Excel. Native Excel files have their own special format and you have to use ActiveX to read them. If you have the report generation toolkit, you can use that or look at the examples on the Excel Board. You can also save the Excel file as comma or tab separated text and then the Read From Spreadsheet or Read File will work.
Second, if the file is static, you would be much better off to read the file all at once to an array and then just index out the values inside the while loop. It looks like you are getting temperature values from a file. Is the Excel file being generated at the same time as your program? If it is, what is generating the file? Maybe that program can be controlled by LabVIEW and you can get the temp values directly from it. If it's a file that is constantly being updated, then the reading is going to be somewhat comlpicated if you care at all about getting the most recent value. -
Can any1 tell me whats wrong.. trying to read from file..
import java.io.FileReader;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.Scanner;
public class AccountClient {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
Account[] accountList = new Account[10];
int accountNumber = 0;
String accountType = "";
String clientName = "";
String socialSNumber = "0";
double intBalance = 0;
double intCheck = 0;
double intSave = 0;
int theAccountNumber = 0;
String theAccountType = "";
String theClientName = "";
String clientSocialSNumber = "";
double clientIntBalance = 0;
double theIntCheck = 0;
double theIntSave = 0;
int counter = 0;
String theSpacer;
String x="";
try {
FileReader infile = new FileReader("input.txt");
Scanner fin = new Scanner(infile);
fin.useDelimiter("\t");
while (fin.hasNextLine()) {
accountNumber = fin.nextInt();
accountType = fin.next();
clientName = fin.next();
socialSNumber = fin.next();
intBalance = fin.nextDouble();
intCheck = fin.nextDouble();
intSave = fin.nextDouble();
if(accountType.equalsIgnoreCase("checking") || accountType.equalsIgnoreCase("interest checking")) {
accountList[counter] = new CheckingAccount(accountNumber, accountType, clientName, socialSNumber, intBalance, intCheck);
counter ++;
else
if (accountType.equalsIgnoreCase("saving")) {
accountList[counter] = new SavingAccount(accountNumber, accountType, clientName, socialSNumber, intBalance, intSave);
counter++;
PrintWriter fout = new PrintWriter("output.txt");
for(int i = 0; i < counter; i++) {
theAccountNumber = accountList.getAccountNumber();
theAccountType = accountList[i].getAccountType();
theClientName = accountList[i].getName();;
clientSocialSNumber = accountList[i].getSSNumber();
clientIntBalance = accountList[i].getInitialBalance();
if (accountType.equalsIgnoreCase("interest checking")) {
theIntCheck = accountList[i].getIntRate();
else
if (accountType.equalsIgnoreCase("saving")) {
theIntSave = fin.nextDouble();
x = accountList[i].toString(theAccountNumber);
theSpacer = accountList[i].space(x.length());
fout.print(theAccountNumber + theSpacer);
theSpacer = accountList[i].space(theAccountType.length());
fout.print(theAccountType + theSpacer);
theSpacer = accountList[i].space(theClientName.length());
fout.print(theClientName + theSpacer);
theSpacer = accountList[i].space(clientSocialSNumber.length());
fout.print(clientSocialSNumber + theSpacer);
x = accountList[i].toString(clientIntBalance);;
theSpacer = accountList[i].space(x.length());
fout.print(clientIntBalance + theSpacer);
if (accountType.equalsIgnoreCase("interest checking")) {
x = accountList[i].toString(theIntCheck);;
theSpacer = accountList[i].space(x.length());
fout.print(theIntCheck + theSpacer);
theSpacer = accountList[i].space(3);
fout.print("n/a" + theSpacer);
else
if (accountType.equalsIgnoreCase("saving")) {
theSpacer = accountList[i].space(3);
fout.print("n/a" + theSpacer);
x = accountList[i].toString(theIntSave);
theSpacer = accountList[i].space(x.length());
fout.print(theIntSave + theSpacer);
fout.close();
catch (Exception e) {
System.out.println("error"); e.printStackTrace();
//PrintWriter fout = new PrintWriter("output.txt");its supposed to read from the input file and print to the output file, but right now its throwing an exception for whatever reason. when i trace it, i get this and im not sure what its telling me
java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:817)
at java.util.Scanner.next(Scanner.java:1431)
at java.util.Scanner.nextDouble(Scanner.java:2335)
at AccountClient.main(AccountClient.java:45)
at __SHELL5.run(__SHELL5.java:6)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at bluej.runtime.ExecServer$3.run(ExecServer.java:858)
java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:817)
at java.util.Scanner.next(Scanner.java:1431)
at java.util.Scanner.nextDouble(Scanner.java:2335)
at AccountClient.main(AccountClient.java:45)
at __SHELL6.run(__SHELL6.java:6)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at bluej.runtime.ExecServer$3.run(ExecServer.java:858)
java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:817)
at java.util.Scanner.next(Scanner.java:1431)
at java.util.Scanner.nextDouble(Scanner.java:2335)
at AccountClient.main(AccountClient.java:45)
at __SHELL7.run(__SHELL7.java:6)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at bluej.runtime.ExecServer$3.run(ExecServer.java:858) -
Read from File which is dynamically updated
Hello all
Is there any class for reading from a file which is dynamically updated?and those updates are immediatley reflects in java File object without closing previous and reopen that file again to get the latest updates?
thanks
sjaferyI meant RandomAccessFile
-
Java Applet that reads from file
I'm quite new to java, I'm fiddling around with it for a nonprofit organization.
I have a java program that reads from a specified file and generates output but my final goal is a search box on the website that will take user input, run it through my program which searches through a prespecified file, and generate output.
I'd appreciate any help.What can I do with this? I need it to be a String because I'm breaking it down to Tokens.
Thanks,
-Grant
Scanner input = null; //input is going to be the Scanner object
input = new Scanner(new BufferedReader(new FileReader("test.txt"))); /*setting up the Scanner object "input" to read the file "test.txt"*/
String words = null;
String MyArray[] = new String[5000];
while (input.hasNext()) { //Puts ALL the file's data into one string
words = words + " " + input.next(); /*Without that space the string "words" contains is all just one word making it unTokenizable*/
} -
hello,
I am in the process of doing my final year project. I am just doing some testing to find out certain things and I have come across this problem which I would like some advice on.
Below is the code I am using to try this out. I am able to output the contents of a text file but not the pdf. Is this because I am using the wrong file reader or is it because PDFs like Doc files have formating, font types etc which txt files do not and therefore Java cannot read them?
I would also like to know if Java can read one or more files and output their contents at the same time for example FileReader = new FileReader ("data.txt", "btcssbill20080601ref698520080602170743.pdf"); Therefore I won't have to create a new object each time I can just do it on one line of code?
public static void main(String[] args) {
// TODO code application logic here
try
FileReader file = new FileReader ("data.txt");
FileReader file1 = new FileReader ("btcssbill20080601ref698520080602170743.pdf");
BufferedReader buffer = new BufferedReader (file);
BufferedReader buffer1 = new BufferedReader (file1);
String line = "";
while ((line = buffer.readLine())!= null)
System.out.println(line);
buffer.close();
catch (IOException e)
System.out.println("A read error has occured ");
Thanks
Timprometheuzz wrote:
Tjstrico wrote:
I've just read that link and that says generate the PDFS. I've already got the PDF I wanna read from I don't wanna make a new one:SI'm fairly sure iText can be use to not only to create PDF's, but also to read existing ones.From the home page of iText:
In short: the iText classes are very useful for people who need to generate read-only, platform independent documents containing text, lists, tables and images; or who want to perform specific manipulations on existing PDF documents.So, it can do "specific manipulations" on existing PDFs. That probably doesn't cover whatever the original poster's requirement was. (All we saw was code that copied data to the console. It's obvious that doesn't do anything useful for most PDF documents, so there must be more requirements beyond that.)
Maybe you are looking for
-
My home button on my iPad2 isn't working anymore.....I use four fingers to swipe back to homepage...what should I do??
-
Accounting documents not cleared - sales return being procced
Dear Experts, In sales return process, material was received by Movt.651, credit memo raised, while seeing the document flow the sales return document showing as "being processed" and Accounting documents showing as "not cleared". how to clear the a
-
Error trying to prune DB via Cursor
I'm using JE 3.1.0 and have last-event records in a database and am trying to write a thread to prune the database of old records. The database is not transactional - setTransactional() is set to false in both EnvironmentConfig and DatabaseConfig. Da
-
Hi dears, I deployed the ISE primary and secondary mode. Then I did deregister the secondary ISE at Primary ISE. Now i want to register the same second ISE as secondary mode on Primary ISE. but this error occur: Unable to register SecondaryISE. Node
-
FileVault - Files & Folders Locked, etc
Since turning off FileVault the folllowing has occurred: All documents listed in the Finder have a "blank" icon. All documents are locked. When I unlock a document in "Get Info" it re-locks when launched again.