In my pursuit to modify the tutorial Android application Bluetooth Chat, I'm trying to add View Switcher to alternate between screens simultaneously in the app, but in my function onCreate ViewSwitcher isn't being resolving and I get a debugging error when trying to run the app. The spelling match and all required libraries are being called, so not sure how to fix it. My code for onCreate function is:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (D)
Log.e(TAG, "+++ ON CREATE +++");
// Set up the window layout
setContentView(R.layout.main);
i am trying to write a coin program:Write a class called Coin which will be used by a program called CountFlips.
1. The class, is an object created from this program. It is composed of data values and methods. It should contain a main method and should output the number of flips done (an integer that will be read from the user), the number of heads and tails that occur.
2. The CountFlip class will flip a coin multiple times and counts the number of ‘heads’ and ‘tails’ that result. This class should have a method called flip() of type void; a method called isHead() of type Boolean and a toString() method that will return the current face of the coin as a string.
So i created 2 classes, one called Coin.java & the other CountFlips.java,
PHP Code: package test; public class Coin { private final int heads = 0; private final int tails = 1; private int facetype; private int flips;
I am working on a project that uses a custom tag in a JSP file. Here is the tag descriptor
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd"> <taglib> <tlibversion>1.0.0</tlibversion> <jspversion>1.1</jspversion>
[code]...
Everything seems working fine except that the custom tag handler does not get called at call. I set breakpoint and it never stops there. The JSP page is displayed fine, only not showing the custom tag content and there is no logged error/warning from the log. The tld is found fine. Like what classes called/validated the tag handler so I can logging those classes at DEBUG level to see what goes wrong.
While studying polymorphism , i have some doubts that i am unable to clarify ..... Here they are :
Suppose our inheritance ladder be : C1 <- C2 <- C3 <-....... <- C100 where C1 is most general (superclass) and C100 is most specific class . Now , if i write java code in my main() :
C21 Obj = new C100(); Obj.someMethod();
So, what will happen in scenarios as given below :
Scenario - 1) If someMethod() is only defined in C1 ? How will compiler search for this someMethod() ?Will it be executed ? Scenario - 2) If that someMethod() is static and only defined in C1 , then how will it be searched and executed ? Scenario - 3) If someMethod() is only present in C100 , then what will happen ?
So, I have a gameOver() method that should when oval goes out of bounds abort game but, as soon as I start the game it runs the gameOver method. I've been looking over it for a while trying different things. I think what stood out to me is removing the abort sequence the game runs mostly as it should after, popup is closed and that if I replace game.gameOver(); with ya = -1 the ball bounces off the wall.
From within that thread I try to call a method from within the same class the contain the thread. This method is not being called. I have confirmed that that section of code is being executed in the thread.
If you look at the following code, the thread being run is called MainThread ln 114, and the method it calls that is not being executed is called onprogressTime() ln 105;
I just wanted to know that why are final and abstract called as modifiers ,what is the essence of calling them as modifiers since there are two types of modifiers access modifiers and non-access modifiers so final and abstract come under the second category ,so why are these called as modifiers?
Write a program called GeometricMean that prompts the user to
1.Enter the number of values (total number of instances) that should be processed
2.A set of values to be processed (in a while loop)and then calculate the geometric mean of the values entered. You should use a while loop to perform the multiplication part of the calculating the geometric mean. The program should output the initial data and the labeled geometric mean. Consider printf, and DecimalFormat.
My Program:
import java.util.Scanner; public class GeometricMean{ public static void main(String[] args) { Scanner keyboard= new Scanner(System.in);
We have to create a program called MyStack.In Push: Add one element at the end of the buffer.In Pull: Remove one element from the end of the buffer. In isEmpty: Should check if the list is empty or not and return the result as a boolean variable.
I am totally confused, I wrote the buffer and the array, but how do i add an remove element from the buffer?How do i add an element? What Statement do i Use?
Java Code: public class MyStack<T> implements Stack<T> { private final T[] ringbuffer; int index = 0; int last;
I'm trying to understand the concept behind this recursive method called rangeSum. This method sums a range of array elements with recursion. I tried summing the elements of 2 through 5, and I tried writing down what actually happens when java executes the program, but what I get when I try to figure it out by paper is different from what netbeans gives me. Here is a snapshot of my scratch work as well as my source code. Netbeans gives me "The sum of elements 2 through 5 is 18" when I try running it but it I get 12 when I do the recursion on paper. I know that the source code is correct because it's out of the book but what am I doing wrong when I try figuring it out by hand?
XML Code:
package recursivecall; import java.util.Scanner; /** * Author: <<Conrado Sanchez>> Date: Task: */ public class RecursiveCall {
I am making a simple battleship program, you have the menu and click Start to get the board with the bombs (4 buttons as of now) Each button has either a bomb or a defualtbutton. I created my button so it can't be unselected. The problem is I have the button in a Class.java and I want that to close in a period of time. What do you recommend using?
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package battleship; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.GridBagLayout;
[code]....
I can call the clas in my main jFrame but I want to close the class after a certain time.
public void draw(ArrayList<int[]> good,ArrayList<int[]> bad){ drawing = true; goodToDraw=good; badToDraw=bad; System.out.println("Canvase/draw: Calling paint with a size of "+goodToDraw.size()); middleMan();
[code]....
What this does is two ArrayList are sent to the draw function.one called good and the other bad. Right now I am only working on good. What is suppose to happen is paint takes all the good coordinates and paints them but I seem to loose the arrayList size when repaint is called. You can see in the picture below of my console that it starts of with 20. Then because I was wondering if the scope was to short i called middleman to make sure that it held its size outside of the first function. Then finally it calls paint and tells me the array is empty. To simplefy..Why does my arraylist size go to zero when I call repaint?
I have added a windowListener to my JFrame but for some reason it is not being called when I click X to close the window. I need to send a message to a server to notify it that the client window is closed. Some code snippets below (some lines excluded for brevity):
public class ChatGUI extends javax.swing.JFrame { .... setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); // I have all the window constants here but has no effect other than closing the window without calling the listener... addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosed(java.awt.event.WindowEvent evt) { formWindowClosed(evt); } }); .... private void formWindowClosed(java.awt.event.WindowEvent evt) {
I have a scenario here where the JSF lifecycle is not getting invoked. I have a filter, whose responsibility is to filter only authorized requests.the code of the filter is given below
now in the else block i am filtering the unauthorized requests, and sending them back to the Login.xhtml page of the application.The problem i am encountering here is that, the images and styles associated with the page are not getting loaded, what i am thinking is that when i am using redirect or forward, the FacesServlet is not getting called, and it is directly going to Login page i.e. no Lifecyle is being called.how to Filter the requests and at same time not lose the styles?
Write an instance method, contains, that has one explicit parameter of type Rectangle. The method should return true if every point of the rectangle determined by the explicit parameter is on or within the rectangle determined by the implicit parameter. It should return false otherwise.
The problem is that after loading the dropdown, I am selecting values from them and clicking the button to submit the form. But it does not seem to work. I tried putting an alert inside the function call too alert("entered function"); but no good.
I have a scenario here where the JSF lifecycle is not getting invoked. I have a filter, whose responsibility is to filter only authorized requests. The code of the filter is given below
Now in the else block I am filtering the unauthorized requests, and sending them back to the Login.xhtml page of the application.
The problem I am encountering here is that, the images and styles associated with the page are not getting loaded, what i am thinking is that when i am using redirect or forward, the FacesServlet is not getting called, and it is directly going to Login page i.e. no Lifecyle is being called.
Am I right on this?, if so how to Filter the requests and at same time not lose the style?
My java class doesn't execute a shell sript, I had given the java io file permission read and execute over the script shell to the user who execute the java class, also I executed the script shell in the console each RAC server using oracle user session and the srcript shell works. My team DBA told me that " The user server process is oracle". My script shell resides in all RAC server file system the last result looks as follows:
/home/mydir/dir2/mybin/compacta_archivo.sh No Funcionando!! java.io.IOException: /home/gi91591/reppostpago/bin/compacta_archivo.sh not found
[Code]....
of course, the script file exist on my file system, it has the suitable permission as the test result i got each time I executed on the console. My Oracle version is 11.2.0.3.0 on Rac ASM.
I have the following listener on a tableset of names:
ListSelectionListener singleListener=new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { int row=e.getFirstIndex(); if (row==previousRow) { row=-1;
[Code] .....
The println shows that getValueIsAdjusting is called 4 times when I click a single selection from the list. Is this normal behavior? If so how do I determine which call to really use. If not, where can I look to see why it is being called 4 times on a single click?
I use the right term, release resources because after clicking the close button, the DOS prompts becomes unresponsive. So I have to close the DOS prompt, then reopen it, then type in the path again for the Java folders. Can you check where did I go wrong with my code? Is my placement of the WindowListener and WindowAdapter incorrect? Please refer to my code below:
I have other programs where the placement of the WindowListener and WindowAdapter are as exactly like this (within the class constructor block) where they close correctly and some that behave like this, that renders the DOS prompt unresponsive.
I need to work on this "Dice" program. I've done it twice already. I've also been pouring over examples on here and elsewhere online, but none of them exactly match what I'm doing, as they all say "Pair of Dice".Mine says: "Create a class called Dice to represent a SINGLE cube". It should have a method called roll() that randomly selects a number from 1-6 for the value of the dice."
It has to use java.util.random, not math.java, and it has to have numberShowing:int, roll():int, and main() all in it.The last part reads "Create a test main method for the Dice class that creates a dice and rolls it many times. Can you keep track of how many times a number comes up? Describe how or implement it in the program." I have started at this computer for hours, and read as much info as I can.
I have a problem about this numeric or value error on my java class. Whenever I am calling for the procedure in callable statement it says that error. I don't know what is the problem with my sql code because I;ve tried running it on database alone and it runs perfectly. The results that I need came out fine. But when I'm already calling it in java that error appears. But I tried on finding the line that the said error is coming from and here is the code...
create or replace PROCEDURE RENTING (P_NNAME IN VARCHAR2, P_ADD IN VARCHAR2, P_PHONE IN NUMBER,