I am running this method but for some reason I am not able to find the data record, it keeps going to the catch. I have the data.txt file in the same directory as the java file.
public static Games[] gamesRecord(){
Games[] game = new Games[50];
try{
Scanner dataFile = new Scanner(new File("data.txt"));
for(int i = 0; i > 50; i++){
game[i].title = dataFile.next();
game[i].releaseDate = dataFile.nextInt();
game[i].redistributions = dataFile.nextInt();
game[i].platformRelease = dataFile.next();
I have written a program student record system but can not save data to view or submit record. Able to run the program but failed to submit record or view pre-submitted records.
After install when i run sqldeveloper command then it prompt me for jdk path
1. Which I don't know how to find 2. When I try to give /usr/bin/java1.7.0_09/ and enter then it give me below error
/usr/bin/java1.7.0_09 Error: /usr/bin/java1.7.0_09/bin/java not found Type the full pathname of a J2SE installation (or Ctrl-C to quit), the path will be stored in ~/.sqldeveloper/jdk
I want to find the prime palindrome numbers less that a given number by my program. Here is my code, I am trying to find the method to solve the errors when I compile it. It said variable a might not have been initialized in line 41,62,86.
import java.util.Scanner; public class Lab5{ public static void main (String[] args){ System.out.println("Please input a number"); Scanner Input=new Scanner(System.in); int num = Input.nextInt();
I am trying to prevent data from being overwritten and appended instead when I save it to a file. I already set the append boolean to true on the FileOutputStream, but the data is still being overwritten. My code is below:
public class Main { public static void main(String[] args) { LinkedHashMultimap<String, Integer> testMap = LinkedHashMultimap.create(); //ListMultimap<String, Integer> test = ArrayListMultimap.create(); OutputStreamWriter outputStream; testMap.put("NumberA",1); testMap.put("NumberA", 33);
[Code]...
I performed a print statement to verify that the LinkedHashMultiMap is not replacing values with the same key (which it was not) and realized that the overwriting was occurring when I wrote the data to a file.
I am trying to connect to a local service over UDP - the simulator works fine, but my code does not... The sender is a separate thread and I have tried blocking, non-blocking, connecting, not connection, reading and re-reading the Oracle docs,
I am trying to use double data type in a for loop for precise operations and just to see if there could be any problem doing that I tested a small code :
public class doubleLimit { public static void main(String[] args){ for(double i=-0.1;i<=0;i+=0.01) System.out.println(i); }}
The output I was expecting is : -0.1 -0.09 -0.08 -0.07 -0.06 -0.05 -0.04 -0.03 -0.02 -0.01 0.00
But the output of the code is : -0.1 -0.09000000000000001 -0.08000000000000002 -0.07000000000000002 -0.06000000000000002 -0.05000000000000002 -0.040000000000000015 -0.030000000000000013 -0.02000000000000001 -0.01000000000000001 -1.0408340855860843E-17
Why is the code not working the way I expected, I think it has something to do with any property of double but I am not sure.
I've been trying to pull data from another class file "Calculations.java" and have it be displayed in a TextField in "DataAnalyzerGUI.java". Here is how the hierarchy is broken down for my assignment:
We created one web application which runs on tomcat 7.0.35 using spring mvc 3.0 . Its working perfectly on 32-bit windows machine in IE 8 on Windows 7 OS, when we tried to run this on 64-bit windows 2008 Server, jquery is not working. Also I populate data from Pop-up JSP to parent JSP, and it works 3/10 times only and does not work always.
We used the following jquery plugins in our project
I'm creating a web applicaion. for that i want to create a registration page. and this registration details have to be stored in the database.
I'm getting the below error while trying to send the data ...
The requested resource (/cmd/InsertRegtodb) is not available.
Here cmd is project name and InsertRegtodb is servlet name.
Actually the servlet is present is the mentioned address. but it is not connecting to it
There is one more servlet in the same folder and which is accessible from another jsp. But this servlet is not accessible even though i have used same code as it is used for the servlet which worked for me previously...
My code below creates the 2 files successfully, but it is not able to write the sample data into the newly created file. I can't figure out the reason why.
Another strange thing is that when I tried inserting System.out.println calls for debugging, nothing prints out.
I have a requirement where in my primefaces datatable ,the filterMatchMode attribute(like any part of field,whole field) needs to be selected by the user by select menu .
To achieve this i have declared a variable in my viewscoped managed bean as filterCriteria and set the filterMatchMode attribute as filterMatchMode="#{beanName.filterCriteria}".The bean variable is getting set in the managed bean on submit but the filtering is not happening,i am getting empty message.
Also when i remove the keyed in value from filter box the data table is not restored which otherwise must be restored in normal situations. I have used and modified the example code given in primefaces showcase here.The code snippet is as below
<h:form id="tblFrm"> <h:selectOneMenu id="filterOptions" value="#{dtFilterView.filterOption}" required="true" requiredMessage="You must select an option!"> <f:selectItem id="hd1" itemLabel="Select" itemValue="#{null}" />
I have been trying to implement custom request method in HTTP header while posting my data to the server URL. My application specific URL accepts -X parameter and -d for the data and it is mandatory for that url. Basically I am trying to dump JSON data into my influx DB using CURL command which is working fine from the shell. But the issue is, if I am implementing the same in java with proper approach, it is not supported or working. My CURL command is :
curl -X POST -d '<my_json_data>' '<my_url>'
How can I implement the same in java using HttpUrlConnection or other available approach?
The first is MyArray Class (You can either use an array or an arrayList)Create a class called LastNameFirstNameMyArray according to the UML diagram. This class will allow a user to enter 5 integer values into an array(or object of ArrayList<Integer>). It contains methods to find min and max values and calculate the mean for the data set.
LastNameFirstNameMyArray - data[ ] : int (or data : ArrayList<Integer> ) - min : int - max: int - mean : double + LastNameFirstNameMyArray() + findMin() : void + findMax() : void + calculateMean(): void + toString() : String
Attributes: data[]the array which will contain the values or data<Integer>the arraylist which will contain the values minthe minimum value among the values in the arraylist maxthe maximum value among the values in the arraylist mean the arithmetic average of the values
Methods: You need to implement the constructor LastNameFirstNameMyArray(), which populates 5 values. In addition, the constructor should call findMin() and findMax(), and also calculateMean().
Methods: LastNameFirstNameMyArray()the constructor. It will allocate memory for the array (or arraylist) of size 5. Use a for loop to repeatedly display a prompt for the user which should indicate that user should enter value 1, value 2, etc. Note: The computer starts counting with 0, but people start counting with 1, and your prompt should account for this. For example, when the user enters value 1, it will be stored in indexed variable 0. The constructor should populate 5 integer values, call findMin() and findMax(), and also calculateMean().
findMin()this is a method that uses a for loop to access each data value in the array (or arraylist) and finds the minimum value. The minimum value is stored into min.
findMax()this is a method that uses a for loop to access each data value in the array (or arraylist) and finds the maximum value. The maximum value is stored into max.
calculateMean()this is a method that uses a for loop to access each data value in array (or arraylist) and add it to a running total. The total divided by the number of values (use the length of the array), and the result is stored into mean. toString()returns a String containing data, min, max, and the mean.
Task #2 TestMyArray
1. Create a LastNameFirstNameTestMyArray class. This class only contains the main method. The main method should declare and instantiate a LastNameFirstNameMyArray object. 2. Compile, debug, and run the program. Then, it should print out the contents, the min, max, and mean of the data.
and the second is A theater seating chart is implemented as two-dimensional array of ticket prices, like this:
Write a program that prompts the users to pick either a seat or price. Mark sold seats by changing the price the 0. When a user specifies a seat, make sure it is available. When a user specifies a price, find any seat with that price.
Note: Assume that if the user enters 1 for the row and 1 for the seat, the yellow marked sit will be sold.
So I have two related tables - Country (Master) Projects (Detail). Country has a OneToMany relationship with Projects. I put a link on my AllProjects.xhtml page. When tyhe link is clicked it uses a data model class to to display the current (clicked) project record (projectRecord object). After editing all the details, the UPDATE button calls a merge method in the DAO class. On the first attempt to update, nothing happens and the record is returned as it is with no errors. If I try updating again, I get:
Is the 'new' keyword in the entity class causing the Inser statement in the DAO because the JPA thinks I want to create a new object therefore invokes INSERT instead of UPDATE?
I am working on web project in java. i have taken buttons in column..and projects is my column..when i click on a button in first row ,i want fetch all information about selected project....so how can i do that?
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub String delete = ("DELETE FROM anagrafica WHERE Nome = ? And Cognome = ?"); ConnectionManager cm = new ConnectionManager(); String Nome = request.getParameter("nome"); String Cognome = request.getParameter("cognome");
[code]....
and this is my JSP.The problem is easy, when I click on the grid for deleting the record two things happen, or the record is deleted only on JSP but not in my Database or Nothing happens even on my JSP, it is because I don't know how to get values from my jsp and send them to replace the ? in my delete query I tried even to give a name to the <tr> which contains Name and Last name but obviously i guess it works only for input type ex. Textbox.
if (addrecord == true){System.out.printnl("record added");}
I close the interface then enter search for the record i just added using add record method but i do not find it what i am trying to say the added record using my application is not there. The question is how to save this record in the database ...
In my java web jsf seam jboss application, I want to add a row in a table with some data fields such as date type, String etc, but one field will be a word attachment, how to do it?
Basically, there is a loop to create some rows of data in a table, before each table row data creation, I will create a word file and saved to a local path(the physical file path is hardcoded), then I will create a table row and attach this word file to that row. the loop will continue until the end of loop.
I'm making a game to teach myself programming java so I can start making android. I have this game I'm making where there will be objects(so far its asteroids) will be falling with a progressive velocity (they will move faster as time goes on). The object is the click on the objects before they hit the bottom. It's still early meaning not all the parts I want to implement are there but it works the way I want it to so far besides my click function.
I'm using the Mouse.isButtonDown(0) to record left click but It lets me hold it down and hover over them instead of clicking on each one. Here is a snippet of the part of the code im talking about :
I uploaded a .jar and a exe file so you can see what I mean [URL] .... -jar [URL] .... -exe
public void update(GameContainer gc, int d) throws SlickException { posX = Mouse.getX(); posY = (Mouse.getY()-height)*-1; timePassed += d; deltaTime= deltaTime();
I want an app that I can use to save the name, address, item sold, subject discussed and date that I visited someone - in a job similar to a sales rep. I would like to be able to choose how to sort the info so that if I sort by date I can see who hasn't been visited for the longest and start there. If I think of someone's name then of course I want to sort by name.
One of my friends says he works with "php"[? I'm still learning these terms] and everything happens online. I would like it to be an android app so it can be done without an internet connection ....