There are multiple .CSV files (each file has multiple rows and columns). I need to fetch data from all the files and find MEDIAN of the values for each column and do further calculations. Suppose there are 3 files, i need to find the MEDIAN of column 1 in file1, MEDIAN of column 1 in file2, MEDIAN of column 1 in file3. Below code just fetch data from one file.
I am trying to create a Community Theater program that has Actors, Directors, Investors, Staff etc. I should eventually be able to input the information for the people from both a file and the keyboard. I'm working on trying to take in multiple Actors from one file and adding them to an ArrayList of Actors. My code takes in only one actor right now.
I am trying to take in multiple sets of data for the same type of class but creating new instances after each set of data (16 lines). Each actor has 16 lines of data (text file included), so I was thinking that I would need perhaps a for loop but I am unsure of how and where to implement it. I am also unsure about adding these new actors to the Actor ArrayList. I'm a little shaky on the idea of creating multiple objects when it is unknown how many you need to create. Right now, I know how many Actors I need to add but it would be nice if I could learn how to expand that based on the user's needs.
My Questions: How can I write my program to know when it is done reading 16 lines and then initialize a new Actor (will expand to other people)?(expanded below)Eventually, I plan on using my theaterObj (an instance of CommunityTheater class), what if I wanted to move the readActorFile method to that class? Would that change the way I implement anything majorly? Would it still be a static method? I ask this because I want the Actors array to be a variable in the CommunityTheater class. I would extend this to adding actors to an ArrayList in a Play class which would be in CommunityTheater as well. So, essentially a CommunityTheater has different Play(s), and each Play contains a list of Actors.
I don't exactly know where I should put a loop (should I use a loop?) to read through each line, in readActorFile or in readInFile? How should I write this loop, as in, how do tell my program what line it's reading?
for(countLine=0; countLine < 17; countLine++) or while(countLine<17) read all the info and then an if(?)-
if(file has a next line)-I don't really know how to code this-start over with loop of reading information?I don't know about the for loop, as I'm not sure how to "count" lines in a text file.OR I've been thinking that readInFile in the Actor class could return something(true/false?) to let the method readInActor know that it's done reading, then readInActor can check to see if there's anything else in the file, if there is- it would call the readInFile in Actor class again to read in information... and so on. But again I am unsure of how to code this.
Question : How to execute batch file & .exe file using jsp servlet?I am giving input for blast in the FASTA format. After that i wants to make the sequence.FASTA file in my project folder. And I wants to execute batch file with parameters as blastp.exe file, sequence. FASTA file, database files, output file.
There is no problem in the file creation of sequence.FASTA
ERROR IN: the batch file is not execute, So the I am not able to get the output file for display.
ERROR is : java.io.FileNotFoundException: D:vaibhav_workspace.metadata.pluginsorg.eclipse.wst.server.core mp4wtpwebapps oxin-dataoutputprotein.txt (The system cannot find the file specified)
Technologies Used :JSP,Servlet,Process-builder
I have the following code as :
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out=response.getWriter(); String values=request.getParameter("t1"); ServletContext servletContext = request.getSession().getServletContext(); servletContext = request.getSession().getServletContext(); String path="//sequence.FASTA"; /*file is created in getRealPath()*/
I'm trying to make the program read the "Entity.sql" File and then execute it to make it run in phpmyadmin. I did used a mysql connector to link netbeans to mysql and then it should used the Connection for phpmyadmin to execute the Statement (Entity.sql).The Entity.sql file contains as sql Statement:
CREATE DATABASE IF NOT EXISTS Student
The problem is that it's not working and it's giving me this error:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
I'm trying to make the program read the "Entity.sql" File and then execute it to make it run in phpmyadmin. I did used a mysql connector to link netbeans to mysql and then it should used the Connection for phpmyadmin to execute the Statement (Entity.sql)..The Entity.sql file contains as sql Statement:CREATE DATABASE IF NOT EXISTS Student
The problem is that it's not working and it's giving me this error:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorEx ception: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
I have declared an array list that will store data type of 1 Character and 2 integer. The data that will be store in this list is
1. A = {0 3} 2. B = {0 5} 3. C = {0 3} 4. D = {0 3} 5. E = {0 5} 6. F = {0 6}
Now here the alphabets are routers and integers are there con1 and con2 respectively. I have a set of router={ A,B,C,D,E,F}.
Step 1:I have to subtract con1 from con2 i.e. (3-0) of all the routers and Step 2: then put the router having largest value in new set 1 and Step 3: then this router will be subtract from the router set. Step 4:then again I have to repeat the step 1 until the value of routers become <= 1.
Now what I did is I defined 3 arrays first is String array that stores names of routers, 2nd array that stores the first value and 3rd array that stores the second value. I can find the largest value but how to store the name of router against the largest value in the set.
I got my first project in which i need to receive some data from multiple client on network regularly(say every second) and then process that data and stored it to the database and then GUI needs to be created which display data accordingly.
While thinking for the design i thought blocking queue to implement the same. Like producer receive data from the port into a string builder and put that into the LinkedBlockingQueue. Consumer will take this data , process some work on it and store it into the database.I am using sybase ase 15 as a database.
My question is as i am receiving data very frequently which require insertion , updation and search almost every second into the database. What is the best way to improve the performance.
say i have 2 types of data is coming one having keyword 'Alarm' and other having 'ceased' so i need to use something like this
common fields in both is name and number.
if (ceased) search into the database for particular event for which this ceased receive using name and numbe rand update the another field into it Also make separate entry for it else make a entry
Also as i am using 2-3 thread for consumers and thread = Number of client for the producer. So i thought to use synchronization at the consumer side which writes data into the database such that only 1 thread can write it.
I currently have a datatable on the bookingList.xhtml which is supposed to list all bookings made, if first booking petName is spot it displays the booking details perfect but if another booking is made (for example one with petName fluffy) then it displays 2 lines with fluffys details and spots details are not displayed, it carries on that if a third booking is made then the 3rd bookings details are displayed 3 times and neither spot or fluffys booking details are displayed,
bookingList.xhtml code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui">
I would like to understand how does multipart/form-data works during file upload scenario's, Does it chunks the data from client to server while transferring the files ?
By using FileReader, FileWriter and their constituents, I am creating a file to contain employee information ( name, age, hours, etc. ). The user is to input all of the data on a single line and we were asked to implement StringTokenizer to assign that data to the file. I have never used the StringTokenizer before, but I have a rough idea how it is to function. I used pw.println to test what I have so far, now I would like to let the user build the initial file with the "first employees" of the company, and then view the file, and then go back and append new employee data to that same file. My question is, how can I take the user input as a StringTokenizer and add that to the file?
In the for loop below, I thought I would see if it would work, but it does not. The loop only executes once and does not allow me to enter data.
public class Records { public static void main(String [] args) throws IOException { Scanner input = new Scanner(System.in); FileWriter fw = new FileWriter("dbs3.java"); BufferedWriter bw = new BufferedWriter(fw); PrintWriter pw = new PrintWriter(bw); System.out.println("NEW EMPLOYEE DATA SHEET"); System.out.print("Number of new employees: "); int number = input.nextInt();
I am trying to remove a line based on user input. myFile.txt looks like:
Matt Brian John
However when I enter "Brian" (to remove this line), It is deleted on the temp file (myTempFile.txt), but not renamed back to the original file (myFile).
I managed to retrieve data, and set data in my own ways in which I like. But my problem is, if the file does not contain anything (fully empty), when I try to use my
I am creating a program where it reads the data inside a file and then places this data into arrays. The file I created has numbers 1-30 in it, file named, testing1.txt .
New to programming. Am supposed to create a program that reads a text file (of integers) and computes a series of computations on these integers. I don't have the code for the integers in my code yet, (i know how to do those), but am struggling getting the array to simply print in the print writer. I have the user select a text file, read the file with a scanner, and then save the computations done from my code into another file. specifically, the problem is as follows: Write a program that uses a file chooser dialog to select a file containing some integers. The file contains an integer N followed by N integers. The program then uses a file chooser dialog to let the user specify the name and location of an output file to write results to.The data written to the output file will be as follows
(1) The original list of N numbers from the input file, (2) The original list of N numbers printed in reverse order of how they appear in the input file. (3) The sum and average of these numbers, (4) The minimum of all the numbers, (5) The maximum of all the numbers.
I have recently start learning about objects and classes in java. I understand that in order to use multiple classes in one file you need one class to be public and the rest are private. But after that I don't understand how to invoke the private class in the public class. I thought if I tried programming on my own I can have a better understanding of it, but had no success.
I have a text file with the below details and we get the input as name CONNECTION_PORT and we need to delete the matching global variable which as CONNECTION_PORT and keep the remaining global variable in file without using any temp files.
The following script is a multiple file renaming script. Once this script completes the renaming of multiple files the script then deselects all of the files it renames.
Any kind of jscript code that can allow this script to keep the renamed files highlighted after the renaming process is complete?
I have an application separated into three different projects - core, command line version and Web UI version.
Core contains all the business logic in several services classes. Command line version and Web UI version both uses the core project services.
Command line have main class which call services from core. Web UI version is Spring base application using same services from core.
Java Code:
CoreProject - src - Service Classes (code here use thirdParty jars and core_file.txt) - lib - thirdParty.jar - core_file.txt mh_sh_highlight_all('java');
[Code] ....
Now I want to give two separate versions to client.
Command line version to run as service in Windows andUI version to deploy in their server.
With above structure I create the cmdline.jar but when I am trying to run with
I am getting java.lang.NoClassDefFoundError exception for the service classes in core. So my question is how to pack/generate jar for this kind of distribution?
So I am calling this method several times and trying to write multiple records to a file. Problem is that every time I call the method it overwrites the file from before and doesn't add it.
public void fileWriterMethod() throws IOException{ RandomAccessFile raf = new RandomAccessFile(filename, "rw"); raf.writeInt(id); raf.writeInt(existingMileage); raf.writeInt(gasCost); raf.writeInt(ndays); raf.writeInt(rate);
I have a small application that I have been working on for several months. It works great. Now when I created an executable .jar file for it, it will not load data from a .csv file. I have tried looking into everything I can think if. I checked file paths, etc. I am using OpenCVS to read the csv. Is there an issue with that when you include it into another .jar file? I am trying to log if there is an error but I don't even get an error. I just doesn't run past that statement...
I am new in java. I executed a java program using eclipse. the program contain two java file. when i try to run it using terminal in Ubuntu. Two files are not linking. it shows error. i am attaching all the data.
It shows the following error
regex2string.java:83: error: cannot find symbol str = randomstr.nextString(2000); ^ symbol: variable randomstr location: class regex2string 1 error
I am writing to a file coordinates of texts using PathIterator (Java Platform SE 7 ) saved as SVG format i defined the Font attributes using AttributedString (Java Platform SE 7 ) and TextLayout (Java Platform SE 8 ). It is saving to the file and working properly, but it is just writing as a single line of text where is my target is multiple lines of text, i began using LineBreakMeasurer (Java Platform SE 7 ) Class, but some text is removed plus i got single line of text only, where i face the problem that , How to determine the width to get multiple lines of text ? i tried to figure out from this exampleDrawing Multiple Lines of Text (The Java - Tutorials > 2D Graphics > Working with Text APIs) where is drawing multiple lines of text but i am using getBounds().getWidth() of TextLayout object the code i tried
I am not all secure on the execution of the fileupload Primefaces.
The uploading execution occurs normally, but I would like to have a counter that control's the received files. The problem is that sending files go by so fast by this method that appears to be running in parallel. My question is whether this behavior is normal while sending files.
If it is not, where may be the error. If it is normal what can i do to make the counter really take the right value?
I'm using the scope of the "bean" type of view, but when im trying to run the session the problem also occurs depending on the file size.
If my files are very small, the execution is very fast and I cant follow the counter. If I clean the code the execution usually occurs no matter the size of the files.
@ManagedBean (Name = "bean") @ViewScoped public class BeanUpload { private int counter; @PostConstruct public void init () { counter = 0;
[Code] .....
The result on the console for 3 files is:
COUNTER EX: 1 COUNTER EX: 1 COUNTER EX: 1
If I run the code in debug mode on the console this is the result: