EJB / EE :: Inquire To Get Some Queue Statistics Like Current And Max Depth
Apr 7, 2014
In weblogic deployment, I have my MQ profile defined which creates weblogic.jms.PooledConnectionFactory. I want to Inquire to get some queue statistics like Current depth and max depth. If I have MQQueueConnectionFactory/MQQueueManager, I can do this with MQQueue INQUIRE but I am not able to find a solution for this from PooledConnectionFactory.
Is there a way to convert PooledConnectionFactory to MQQueueManager/MQQueueConnectionFactory or is there any other way to INQUIRE from PooledConnectionFactory.
View Replies
ADVERTISEMENT
Mar 6, 2014
How can i assign current null value to current date, I only what to assign this if the current value coming from database is null otherwise i must use value from database
public static String getDate(Calendar cal){
return "" + cal.get(Calendar.DATE) +"/" +
(cal.get(Calendar.MONTH)+1) + "/" + cal.get(Calendar.YEAR);
}
try {
[Code] .....
View Replies
View Related
May 25, 2014
I made a heads or tails game but I'm getting a bug when the user says he doesn't want to play anymore. The statistics are printed as many times as the games played. If you want to test the code, write" cap" " pajura" and when the program says "Vrei sa mai joci?" that means "do you wanna play another one?" and you can answer with "da"(yes) or "nu"(nu) Here is the code:
import java.util.Scanner;
public class cap_sau_pajura{
private static int user;
private static int pc;
private static String converted;
static int usermove;
private static int castiguri = 0;
private static int pierderi = 0;
[code]....
View Replies
View Related
Apr 2, 2014
I have a list of people with a matching telephone extension number, the people are organised in a hierachy tree with some colleagues at the same level and then some junior colleagues. I have been trying to write code that can find the tree height of any given member but I am unable too. Here is my code so far but the left and right are not working because I have not declared them any where in my code.
Java Code:
//hierarchy rank section 7
// **Depth** from node to root (bottom up)
public int rank(Member p1){
//to do
[code]....
View Replies
View Related
Mar 17, 2015
I want to be able to use the current date to solve a math problem, specifically as follows:If today is March 17, the math problem of the day should be:
(Month times Day of Month) + 99 = Answer of the Day
(3 x 17) + 99 = 150
How can I create a java script to find the current month and the current day of month, multiple those two together, then add 99 and display the answer as a result.
View Replies
View Related
Sep 17, 2014
This program is for a swimming pool filling service company. They charge 2 cents per gallon and $50 per hour to fill a pool. The truck can fill at a rate of 730 gallons per hour.
Create the Pool class that calculates the cost to fill a pool based on it's Shape, length, width and depth. (Input order is S L W D)
The pool class will need data fields for String shape, double length, double width, double depth, static double GallonsPerSqFoot = 7.4805, static double price per gallon = .02, static double FillingFeePerHour = 50.0, and static double FillingRate = 730gal/hr.
Create a No-Arg constructor and a constructor that accepts the non-static values, and has the methods: getShape, getLength, getWidth, getDepth, getGallons, getHours, getFillingFeePerHour, getHourlyCost and getTotalCost.
At the end of the class, create a main() method that asks for the input and returns the output based on the Pool class gets.. methods.
The shape options are oblong or rectangle. (A round pool would be oblong with the same width and height, a square pool would have the same width and height)
Formulas:
Rectangle cubic ft = length * width * depth.
Oblong cubic ft= ((Math.PI * Math.pow(width/2,2)* depth) +((length-width) * width * depth))
Gallons = cubic ft * 7.4805.
hours = total gallons/730.
Total cost = (total Gallons * .02)+(hours * $50)
Example Output
An oblong pool 18.00 feet long by 12.00 feet wide and 5.00 feet deep will use 6923.10 gallons of water and take 9.48 hours to fill. The total cost will be 612.65.
Here is my code:
import java.util.Scanner;
import java.util.*;
public class Pool
{
private String poolshape1 = "oblong";
private String poolshape1 = "rectangle";
private double length;
private double width;
private double depth;
private static double GallonsPerSqFoot = 7.4805;
[Code] .....
View Replies
View Related
Nov 13, 2014
I need to write a program that prints the current time every second. Here is what I have and I am not entirely sure why I'm not.
Java Code:
import java.util.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;
public class CurrentTime
[Code] .....
View Replies
View Related
Jun 2, 2014
I am trying to get the current utc date/time, but it keeps printing out in local time:
Java Code: LocalDateTime dt = LocalDateTime.now();
ZonedDateTime zdt = dt.atZone(ZoneOffset.UTC);
System.out.println("time: " + zdt);
// output:
time: 2014-06-02T13:37:55.705Z mh_sh_highlight_all('java');
13:37 is local time. Utc time is 17:37.
View Replies
View Related
Mar 18, 2014
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Scanner;
public class Swipe_In {
public String DTStart; //Swipe in Date Time
[code]....
I have got 2 questions on the above class...
1) I get an error "Cannot make a static reference to the non-static field DTStart" wherever i use DTStart in the main method....What's causing this error? and How do i fix it for good?
2) public String DTStart; Once i get the current date & time assigned to the above DTStart String in the main method i cannot use the updated value of DTStart in any other class. In another class i wanna create an instance(object) of this Swipe_In class with DTStart assigned to the current time(as in its main method)..I tried but the object's DTStart gets assigned to null.(( How do i achieve this?
View Replies
View Related
Jun 24, 2014
First of all, i am using ubuntu and jdk8. My problem: displaying the current path of a file in my system Approach: I have a file called dummy.txt in a given directory which have enough permissions and i did the following:
File file=new File("dummy.txt");
System.out.println(file.getAbsolutePath().substring(0,file.getAbsolutePath().lastIndexOf("/")));
I expected to see displayed the current path of the file without the name of the file but it is showing a different path. I just want to display the current path of the file without the name.
View Replies
View Related
Sep 14, 2014
Following is the code on the click of a button, id like to know how do i close the current jframe on which the jButton4 is currently placed. I know how to send it to the next Jframe i.e JobCard. But need to close the current one. I tried using this.setVisible(true); But it does not work.
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
this.setVisible(false);
JobCard jobCard = new JobCard();
jobCard.setVisible(true);
}
View Replies
View Related
Nov 10, 2014
Basically we have to create a calculator that it will have to keep track of the current value, and do the functions that the calculator uses.
But I have it working for the most part, but the current value does not keep...
The double " currentValue " Must stay private.
import java.util.*;
public class MemoryCaluclator {
private double currentValue;
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
int answer = 0;
[Code] ......
View Replies
View Related
Jun 29, 2014
Can we set the class path for one level down the current directory? My structure is like
binlibresourceshexicon.cmdinside the folder dist.
In this case I could run the .cmd file which has java -cp .;lib;resources client.Test .
c: rycpdist>java hexicon.cmdBut if i put the .cmd file inside bin as like this and run as
c: rycpdistin>java hexicon.cmdI am getting this error Error: Could not find or load main class
Is there any possibility to set the class path in this case
View Replies
View Related
May 29, 2014
I'm working on a project for class that asks me to record punch-in and punch-out times for employees. However, I am having difficulty figuring out where I am going wrong as none of the information will write to the text file in the ArrayList that I have created. The code is as follows:
import java.text.*;
import java.util.*;
import java.io.*;
import java.nio.file.*;
public class TimeClockApp {
// declare class variables
private static EmployeeDAO employeeDAO = null;
[Code] .....
I want to keep the coding as simple as possible as I am new to Java, and have spent hours upon hours trying to figure this all out. The console output looks like this:
Welcome to the Punch-In/Punch-Out Screen
Please choose an option below:
I. Punch In
O. Punch Out
Choice: i
PUNCH IN
--------
Enter Employee ID:
8
8Punch-In Date & Time: 2014/05/28 22:44:26
[]
Press enter to return to the main screen:
View Replies
View Related
Jan 5, 2014
Is there a way to measure current download speed of a file being downloaded? I've searched all over google and the only thing i get is average download speed. This is basically how it is being done, the result is average download speed.
Java Code:
OutputStream out = null;
URLConnection conn;
InputStream in = null;
long startup = System.currentTimeMillis();
try {
URL url = new URL(adress);
out = new BufferedOutputStream(
[Code] .....
View Replies
View Related
Feb 12, 2014
My primary question is about which method is the best for having an applet of mine communication with a backend database of mine. In other words, I don't want to try learning a technology that is out of date or not a good fit for my goal. I purchased the O'Reilly title "Java Servlet Programming", but it seems to be very old and out of date (referencing Netscape 4, etc.) and I see a Java RMI O'Reilly title on Amazon, but it was written in 2001.
My basic goal is to allow my applet to have access to a back-end database for reading and writing. I understand that direct Applet to DB (via JDBC) access is a bad idea so my thought is to create a servlet (much like web service for lack of a better term) or an actual web service (RESTful would be my first guess) to broker the requests. I already have a very basic servlet running that has access to my database server so now I want to focus on the best method for making calls from the applet to the servlet but having said that I don't want to go down this road too far if a servlet is not the right tool for the job.
My reading has been leading me to RMI, but as I said, I don't want to focus on that if there is a better option. In a non-Java environment, I'd use a web service (REST, SOAP, etc.) and perhaps that's what I should do here as well and not even bother with a servlet per se and just go with a web service.I know there can be some subjectivity with regard to these choices and I don't need to know what the "best" one is.I don't want to use RMI if it's dead or has been surpassed by something else, for example.
Should I use a servlet? Should I use a web service? My needs are rather modest; query the database, send updates to the database, etc. Nothing too crazy.
View Replies
View Related
Sep 30, 2014
I have now slowly moving on the learning Database Connectivity.Found a simple example on one site and tried to execute it, Creating a database, connecting to it and displaying the output.
I am getting trouble with recordset in displaying all the records in the badabase. It displays the very first record correctly but if I try to enclose it in while(rs.next()) loop, it generates an error message saying "Invalid operation at current cursor position".
package database_console;
import java.sql.Statement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.ResultSet;
[code]....
View Replies
View Related
Aug 29, 2014
I would like to know how much of memory is free and used my java program.I have used Runtime.totalMemory and freeMemory() functions. However, how come used memory is so different than java.exe process show in windows task manager?
View Replies
View Related
Mar 10, 2014
I want to have JTextField automatically highlighting the current values for overwriting when the box is selected. Is there a way to do this? It seems like something that might occur in an action listener.
View Replies
View Related
Oct 8, 2014
I am supposed to write a Tester to get the current volume of a balloon that starts with a radius of 0 after it is inflated.This is the balloon:
public class Balloon
{
private double savedRadius;//instance variable
/**constructor!!
Constructs a balloon with a radius
*/
}
[code]....
View Replies
View Related
Nov 23, 2014
So basically we have this question to do : Write a method dayNumber that determines the number of days in a year up to and including the current day. The method should have three int parameters: year, month, and day. If the value of any parameter is invalid, the method should print a warning message and return the value zero. The table gives some examples of the action of the method. Accept any non-negative year as being valid. You may want to assume the existence of a method numberOfDays that returns the number of days in a given month of a given year. And you should have a method call isLeapYear, if the user enter a year that is a leap year.
This is what I did so far:
class dayMonthYear {
public static void main(String[] args) {
System.out.println("Enter a year");
int year = In.getInt();
System.out.println("Enter the month for '1' to be January - '12' to be december");
[Code] ....
It works and compiles but my problem is that: let say I enter "12" for December and December has 31 days, so what my program will do since December has 31 days, it thinks each month has 31 days and add them up which will give me 372 when it's suppose to give me 365. How do I make it that it won't do that and that it will work if the year is a leap year too.
View Replies
View Related
Oct 22, 2014
I want to know if I can get the entire log4j.properties file constructed in Java code. I am not talking about configuring the logger using Java code.I have a logger that is already configured using a file. I want to get access to either Logger or LogManager (any other?) class and print the current configuration that is in memory.
View Replies
View Related
Apr 7, 2014
I want to get current RAM usage of my computer and display it in Console View of Eclipse? How can I achieve this?
View Replies
View Related
Feb 21, 2014
Is it possible to define the same message driven bean as a listener to different queues?
The goal being to define different redelivery configuration for different kind of messages, but handle them all through a single deployment MDB for unity/entity purposes.
The other option is to have many MDBs targeted to the same source code.
View Replies
View Related
May 29, 2014
leaveQ method does not work..To see the other files related to these code click here:(Its a dropbox location) URL....Java Code:
public class CustomerQ {
private int MaxLength;
private int totalCustomers;//assuming #of customers served
int Qlength;
Customer cus;
LinkedList4Q cus4Q;
[code]....
View Replies
View Related
Apr 15, 2014
Implement a priority queue based on a sorted linked list. The remove operation on the priority queue should remove the item with the smallest key.
View Replies
View Related