How To Read Something Specific Of A Web Page

Feb 28, 2014

I am trying to have a program go on one of the stock trading websites and read the number a stock or currency is at and display or save it. I have it reading and displaying the binary code but I don't see how to have it find the numbers I would like to get.

On the site you would have to go on the page and click some tabs to trade and maybe the stock you would like, it doesn't really matter what one it returns as this is more just an idea. Although I would like to have it search out a selected stock eventually to take it to the net level. I think my biggest problem is I can't see how to access the stock numbers in the code. I looked for different click events but don't see how to have a program do this.

I do not intend to have it display all the code like it is now. I just did it like that to see what I was getting. I will just have a small toolbar with options and a display.

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
public class StockTracker {
public static void main(String[] args) {
 
[Code] ......

View Replies


ADVERTISEMENT

How To Create JSP Page That Can Be Seen By Some Specific Users

Jun 6, 2014

What should i do to create a JSP page that can be visible to some specific user's.

View Replies View Related

JSP :: Displaying Different Menu According To Specific User On Same Page

Sep 24, 2014

i am beginner in java and i am making an application in which i want to display menu for 3 different types of users. like when we login i want to check which type of user is this and which menu to show them. for ex. if there is a employee the menu bar has a dropdown which shows activities like fill nomination, see details etc. if it privileged user he is shown a diff menu and if its the admin the dropdown shows some different activities. i want to make it through simple jsp and servlet. i have a table in data base which has types of user predefined with an id how to display that menu according to a specific user.

View Replies View Related

JSF :: CommandLink To Display Specific Row Of Data In New Page

Apr 16, 2015

I am currently working on a project where I have a dataTable, containing some of the information for a specific database table, with commandLinks at the side which I need to bring me to a new page(another jsf file that I have to display the relevant information there) and display only the row of data selected. I've been racking my brain about this and have been unable to figure out a way to do it.

View Replies View Related

Servlets :: Login To Specific Page Like Facebook

Nov 5, 2014

There are two designation named admin and student. I just need to work in coding to open specific page by email of person like done in facebook or any other mail account.

well one thing I have done is that I have matched email,password and type(designation) in my servlet page to database and the program run and also open the page.If email,pass,type matched witn admin than admin.jsp opens up else student.jsp.But but I wants to open the specific pafe by email that shows the profile of logged in user like in facebook it opens.

View Replies View Related

JSF :: Navigating From Link In Primefaces Tree Menu To Specific Page

Jul 7, 2014

i have a problem with navigating from a link in a primefaces tree menu to a specific page. The explanation is the following: I have a template with the following code :

<?xml version="1.0" encoding="UTF-8"?>
<!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://xmlns.jcp.org/jsf/facelets"

[code]....

i had to put a "*" in the from-view-id tag to be able to navigate to the pages specified with the navigation cases. If i put /templates/leftMenu.xhtml insted of * then the navigation doesn't work and i get the error "WARNING: JSF1064: Unable to find or serve resource, /deleteDepartment-page.xhtml."

View Replies View Related

Read / Write From Specific Line

Mar 17, 2014

I have a question for the read and write method in file.In my code for writing i m using PrintWriter and for reading Scanner.So i m saving data to file and when is need it i m reading from the file.but i also have to delete specific data from it.Is there a way to delete a specific line from the file?When i google my problem i found that is better to save your data to temporary file and then to the final.

View Replies View Related

How To Send User Back To Login Page After A Specific Idle Timeout

Sep 29, 2014

I want to send user back to the Login page after idle time of 10 secs. If user clicks again on screen before 10 secs are over, time will automatically reset to new 10 sec and so on...

I want to use the same timeout on multiple pages.

View Replies View Related

Read Lines With Specific Characteristics From A File / Exclude All Others Line?

Jan 16, 2014

I am trying to write method to read lines with some specification from a file. for Example,

my text file contains following:--

12-01-0113:26San Jose12.99DVD
12-12-3009:40Miami13.50Music
14-08-3010:20Arizona16.03Scientist
11-07-1009:10New York25.00ColdPlay
14-08-3010:20Arizona18.04MeetYou
14-08-3010:20Arizona50.03Scientist
11-07-1009:30New York25.00ColdPlay
11-07-1009:20New York25.00ColdPlay

tab separated values, for different columns and these are the lines only I want method to read.Now suppose if any is there as below, or even enter

12-01-0113:26San Jose12.99DVD
12-12-3009:40Miami13.50Music
14-08-3010:20Arizona16.03Scientist
11-07-1009:10New York25.00ColdPlay
14-08-3010:20Arizona18.04MeetYou
[new lines]
14-08-3010:20Arizona50.03Scientist
11-07-1009:30New York25.00ColdPlay
//This line should not be read
even this should not be read #$%^&
11-07-1009:20New York25.00ColdPlay

That particular line should be escaped. Till now I have done when the file format is proper, and it is as below:--
 
public static void main(String[] args) {
BufferedReader br = null;
String temp = null;
List<String> arrayRead = new ArrayList<String>();
try{
br = new BufferedReader(new FileReader("D: estingSalesData.txt"));

[code]....

View Replies View Related

Read Text File And Perform Operation On Specific Columns

Dec 9, 2011

I am somewhat of a java newbie (learned it awhile back and just getting back to programming some again.) I have a text file of data much larger than this, but here are the first ten rows and first 10 columns.

39755320111041730140.633038085-2.117082366149.069997
39850320111041730150.633038085-2.117082511148.309997
39955320111041730160.633037998-2.117082293149.509997
40055320111041730170.633037945-2.117082351149.239997
.......

I can read and write all the data back out to files. But I am not sure about a few things.

First would it be best to use BufferedReader and OutputStream such as:

public static void main(String[] args) throws IOException {
BufferedReader bReader = new BufferedReader(new FileReader ("testdata.txt"));
BufferedOutputStream bytesOut = new BufferedOutputStream(new FileOutputStream ("outfile.txt"));

Second, I was then going to initialize an array but I might have 30 or more columns of data, of which I might perform and output only 10 columns to my output.txt file so is this a good way?

Third, I only want to perform operations (such as average the data, convert units or multiply two columns together) on 10 of the 30 plus columns and print out results to output.txt file. For example, In testdata.txt file above, I want to skip first seven columns. I then want to take column 8 and multiply by 100 then divide by 3 and output result to output file. I want to do same for column 9. Column 10 I want to multiply by different number (by 3.5).

View Replies View Related

Create A Java Program That Can Read Specific Data Within Csv File To Work Out Averages

Aug 7, 2014

i am fairly new to java but have made a few projects so i do know most aspects that would allow me to complete the task its just i have been stuck at the same place now for 2 days.The project is to create a java program that can read specific data within a csv file to work out the averages etc. The csv file is a database of different weather stats . an example of the first 12 months of the csv file is below..

[CSV FILE]

year ,month,average rainfall etc

1946 15.70.616108.131.5
1946 28.23.56111.871
1946 38.82932.9 102.9
1946 414.16.3029.2 150.5
1946 513.96060.7 143.6

[code]...

I know that once the data is indexed i can than use a double to find the average of the 12 specific pieces of data and so on. once this is complete i should than be able to transfer the data to a simple graph.

View Replies View Related

Write A Specific Byte Sequence To A Specific Memory Location On A Removable Storage Drive?

Jan 29, 2014

I am trying to write a specific byte sequence to a specific memory location on a removable storage drive. Does Java allow me a way to do this? I know the dangers in accessing memory, but the memory location of the data that will be written will never change.

how to assign a variable a memory location.

View Replies View Related

Swing/AWT/SWT :: Move Focus From Specific Jcombobox To Specific Jtextarea?

Nov 5, 2014

How do I move focus from a jcombobox to a specific component say a jtextarea.

My attempt below seems to be moving to a random component not the desired jtextarea.

takenByCombo.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_TAB ) {
e.consume();
dayJTArea.requestFocus(); // focust not moving dayJTArea
}
}
});

I applied the above logic to move focus from a specific jtextarea to another jtextarea as seen below and it works as desired.

dayJTArea.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_TAB ) {
e.consume();
monthJTArea.requestFocus();
}
}
});

View Replies View Related

JSP :: How To Browse And Read A File In Page To Perform Encryption For File

Nov 12, 2014

I am trying to create a file browse option in my jsp and later after browsing, all i want to do is to read that file in my jsp without saving it into that database so that i can perform encryption for it and save that encrypted file later into my database. please provide reference link so that i can refer to some applications and and move ahead with my work.

View Replies View Related

Changing Value In Specific Point Of Specific Line In TXT File

Feb 9, 2015

So here we go with my problem:

- from the main class will arrive three variable (String name_used, int level_choose, int level_result)

I have a .txt file with this kind of formatting:

mario 1 1 0 1 0 1
carlo 0 0 0 1 1 0
...

Where I use 1 and 0 in the main for write if the level (you see that the numbers are always sixr? are egual to six level existing) BEFORE is done correct or wrong

- when in the main a user make a level a feedback coming back from the class level saying if the user made the count correctly or wrong. and i wanna replace the value (1 or 0) in the txt file with the new level result.

So i have all what i need as parameters i think.

name_used to look for the correct line in .txt file with .indexOf
level_choosed to go throught the correct index of that line
level_result (1 or 2) to be replaced with the existing one

Java Code:

public void salvaRisultati(String name_used, int level_choosed, int result_of_level) throws FileNotFoundException{
}
} mh_sh_highlight_all('java');

View Replies View Related

Check Specific Value From A Specific Line From TXT File

Feb 8, 2015

I have some problem to understand the way to make this:

In my main class a user can save his name in a txt file (and the system initially will add 6 value equals to 0) than he can choose between 6 level and make it.

example of .txt file data:

mario 0 0 0 0 0 0
carl 0 0 0 0 0 0

AT THIS MOMENT i just made other class and they work, is this new one that is hard for me. I'm trying to make a class that:

1- (first method called verificaRisultati) take name_used and level_choosed from the main and go to check in the .txt file if that level before was done right(1) or wrong(0)

and return something like "before you made this level properly" or "before you made this level incorrectly" AND THEN let the user start with the level.

2- (second method called salvaRisultati) at the end of the level i wanna pass the result (correct/incorrect) to another method of this class that will save the value (1 or 0) associated to the user in the right position.

This is the class that i'm writing:

Java Code:

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
public class ResultUsers {

[Code] ....

I really need some hint and some code example because I'm stuck. How I can take exactly the line with the user name? How I can correctly split the line in an array and then read/modify the value for that level?

View Replies View Related

JSP :: Extracting Information About Previous Page From Where Current Page Came

Jan 31, 2015

I have to implement a system where I have to do almost same processing on a jsp page. The slight differences on the present page is based on whether the current page came from page 1 or page 2. So how can I do this?

View Replies View Related

JSF :: XHTML Page - Access To Content Of Dynamic Page?

Jan 15, 2014

I have a xhtml file that initialization it with ui:repeat tag in realtime.all tags of this page placed under ui:fragment tag.

<edges>
<ui:repeat value="#{graphInfoBean.edges}" var="edge" varStatus="indexVar">
<edge id="#{indexVar.index}" source="#{edge.source}" target="#{edge.target}"
weight="#{edge.weight}">

[Code] ....

When i access to this page and save it as xml in realtime, the tags in xml file saved is empty while it is initialized and everything is working properly.

<edges>
</edges>

How can i access to content of this xhtml page and save it on disk?

View Replies View Related

JSP :: How To Open Page Inside Another Page

Apr 1, 2015

I have two jsp page one is demo1.jsp and other is demo2.jsp on a click of a particular link on demo1.jsp I want to opwn demo2.jsp inside demo1.jsp without changing layout of demo1.jsp..I tried to use <jsp;include but that doesn't work for me.But how to do this simply on a single link click on a big page?

View Replies View Related

I/O / Streams :: Get Specific Value From Txt File

Sep 22, 2014

I know that it's possible to retrieve a line from a txt file but say for example my file looked like this:

staff id = 1
firstname
surname
age

staff id =2
firstname Kate
surname Hollar
age 33

staff id =3
firstname Daniel
surname Hong
age 21

It is possible to retrieve just the staff id's?

View Replies View Related

Splitting Array By Specific Value

Jan 15, 2014

How do you split an array by a specific value.

For instance this is my array: "4*6*9*89"

How can I take out "*" and therefore split up all the values like this: "4" "6" "9" "89"

View Replies View Related

Using Loops To Create A Specific Design?

Sep 10, 2013

I am completing the exercises in Java How To Program 8th Edition by Harvey and Paul Deitel.There are two optional exercises GUI and Graphics Case Study Exercises on page 141 Chapter 4.

I have to use loops and control statements to draw lines thereby creating two designs.I am trying to create the design on Fig. 4.20. The lines do not line up correctly.The lines should fan out from all corners. Individually, they look exactly like it should.

Example of one corner.

int width = getWidth();
int height = getHeight();
// upper-left corner
int startX = 0;
int startY = 0;
int endX = 0;

[Code] ....

For the other corners I have different starting and ending positions.To draw upper-left corner I have a starting position of 0,0 and ending position of 0,height.I then move ending position up one vertical step and right one horizontal step. I repeat this fifteen times.

To draw upper-right corner I have a starting position of width,0 and ending position of width,height. I then move ending position up one vertical step and left one horizontal step.

To draw bottom-left corner I have a starting position of 0,height and ending position of 0,0. I then move ending position down one vertical step and right one horizontal step.

To draw bottom-right corner I have a starting position of width, height and ending position of width,0. I then move ending position down one vertical step and left one horizontal step.

For the second design Fig. 4.21 all my lines line up correctly no matter the direction I resize it. Both designs frame size is 250,250. Both designs are divided into fifteen steps.

View Replies View Related

Comparing Specific Elements Of Two Arrays

May 5, 2015

I’ve been working on this problem for a couple days already but I came to a point where I don’t really know what to do. Basically I’ve got two arrays filled with int values (0, 1, and 2), which I get from Class B through their respective getMethods.

1 stands for black and 2 stands for something else.

The program counts how many times the value 1 (if chosen color is black) occurs in both arrays and then compares the both counts. If it detects any difference the program does something else, otherwise it waits.

public class A {
private static boolean finished;
public A() {
B objectClassB = new B();
int[] numbers = objectClassB.getNumbers();
int[] numbers2 = objectClassB.getNumbers2();
String color = objectClassB.getColor();

[Code] ....

Here the class B.

public class B {
private int[] numbers = new int[] { 2, 2, 0, 2, 1, 0, 1, 2, 1, 1, 0, 2, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 2, 1 };
private int[] numbers2 = new int[] { 2, 2, 0, 2, 1, 0, 1, 2, 1, 1, 0, 2, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0 };
private String color = "black";
public B() {
}
public int[] getNumbers(){

[Code] .....

this would be the Output:

[2, 2, 0, 2, 1, 0, 1, 2, 1, 1, 0, 2, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 2, 1]
[2, 2, 0, 2, 1, 0, 1, 2, 1, 1, 0, 2, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0]
number of black tokens of first array: 8
number of black tokens of second array: 7
the number of black tokens has changed

The actual problem is that I will be getting one array at a time (meaning: the array int[] numbers from Class B updates itself and might change its values). I just declared and initialize both arrays for illustration purposes.

That would mean I need to hold the array’s values the first time I get them in a temporary variable until I get the values of the updated array. Then I could use them in the method –numberOfRelevantElements- and check if any changes have occurred.

What would be the best approach for doing this? I though of inserting the different counts that I get into a queue and then comparing these values one after the other. But I’m not really sure if that would work.

View Replies View Related

Removing Specific Characters From A String

May 7, 2014

I just need to write a simple program/function that replaces certain letters from a string (i.e. censor( "college", "aeiou" ) returns "cllg"). I'm trying to get the code right first, and then write a function for it.I basically just thought that I would iterate over the first string, and once I had the first character, I would then iterate over the second string, to see if the character exists. I'm getting a "dead code" error on my second loop because I put the second "break."

public class ap {
public static void main(String [] args){
String s = "Hello";
String s2 = "aeiou";

[code]....

View Replies View Related

Copy Specific Array Data?

Dec 4, 2014

if there was a way to copy specific array info into a temp array with more concise code?

This is the code I have for instance:

tempList[0] = myCube.orange[2];
tempList[1] = myCube.orange[5];
tempList[2] = myCube.orange[8];
tempList[3] = myCube.blue[6];
tempList[4] = myCube.blue[7];
tempList[5] = myCube.blue[8];

But isn't there any way I could just condense it to be like:

tempList[0,1,2] = myCube.orange[2,5,8];

It would save me from 72 lines of code down to 24 if I could rock it all on one line.

View Replies View Related

Terminate Scanner At Specific Integer

Jan 18, 2015

I have the following code:

while (scan.hasNextInt()) {
list.add(scan.nextInt()); }

It asks the user to input integers and passes them to an ArrayList of integers named list. Without any termination it works fine, but I am not sure about how to terminate the scanner at a specific value. I am trying to terminate the scanner once the user enters 0. Is there a method in the Scanner class that terminates at a specific value?

I've been trying while (scan.hasNextInt() && scan.nextInt() != 0 ) but it seems to only work on the second zero entered. For ex, if I enter 2 3 6 8 0 0 it stops on the second zero, not the first

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved