I am trying to execute the a command using process builder. But that command is having some Japanese Character. So it is executing the command but result is not as expected.
command i tried : 1) echo 拝見 マイクロエレクトロニクス 2) mkdir "d: est拝見 マイクロエレクトロニクス" OS: XP SP2
result: some chunk char are getting displayed.
See here a sample code which i tried ...
String commandNotWorksFine ="echo 拝見 マイクロエレクトロニクス"; String charSetname = "Shift_JIS"; String[] envArr = new String[] { "cmd", "/c", commandNotWorksFine}; ProcessBuilder builder = new ProcessBuilder(envArr); Process p = builder.start();
I'm doing a program where a user enters in exam results for students. Once he's entered the code, the code should split the results in stars in 4 categories.
I am working with a while loop that prints out infinite results. What I want to do is, if the user enters 2 digits, say "12", it should output 1 "*".
If the user enters "21" and "22", it should output "**".
There are 4 categories of marks which are marked with ints range1, range2, range3 and range4, which are user enter digits. Part 1 of the code is to split the user entered digits into its correct ranges. the ranges are 0-29, 30-39, 40-69 and 70-100. I've done the part where when the user enters a digit, it goes into the correct variable. After that when the user enters a digit over 100, the enter results should show up as stars. For example
Enter number =
21 22 44 66 44 23 11 111 (the 111 is where the program breaks and moves on)
So it should then display
0-29 ****
30-39
40-69 ***
70-100
Whatever I'm trying, it displays an infinite amount of stars. If I try to use break, It only outputs a single star, no matter how many digits I enter
Here is the code
int mark = 0; int range1 = 0, range2 = 0, range3 = 0, range4 = 0; int count1 = 0, count2 = 0, count3 = 0, count4 = 0; while (mark >=0 && mark <=100) {
[Code] .....
"The problem is with the while loop, the one above is something I was experimenting with "
i am trying to run a command in terminal the code is below if i run the command in terminal it works fine however when i run it from netbeans with code below nothing gets printed. however if i run a different command such as (ip addr) it works fine?
public static void a() throws IOException{ ArrayList lister=new ArrayList(); Runtime rt = Runtime.getRuntime(); Process proc = rt.exec("ps -ef | grep firefox");// the command i am trying to run to get pid of application InputStream stderr = proc.getInputStream();
I need to print certain information from an arraylist depending on the arguments the method has. I'm trying to print the last 3 methods from the database class but nothing is printing and I don't know what the problem is.
package hw3; import java.util.*; public class Driver { public static void main(String[] args){ /* Comments required PersonFileReader pfr = new PersonFileReader("person.dat"); ArrayList<Person> testData = pfr.readData(); Database db = new Database(testData); */
[Code] .....
On the driver class I just print what the methods from the database class do.
I develop a little app in javaee6 and jsf2. I have a search page which has a search form with 2 fields and a search button when i click search button the results should be displayed in searchresults page.
Issue: searchresults page is is not displaying records though it fetched records from table I'm able to achieve this using search bean as session scope but i want to use the scope as Requestscope.
how to display results in a PLAIN_MESSAGE. My program is converting hex to decimal and displaying the results. Here's the code:
package pkgfinal; import javax.swing.JOptionPane; import java.util.Scanner; public class Final { public static int Convert(String userInput, int base){ int running_sum = 0;
I have the code here to populate a GUI. I have the math and then print out and return a single number. I have tried to use setText in the class CalculateButtonHandler.
import javax.swing.*; import java.awt.*; import java.awt.event.*; public class RectangleProgram extends JFrame { private JLabel lengthL, widthL, areaL, perimeterL, averageL;
I wrote this small program to take an octal number from the user and convert it to decimal form.
import java.util.Scanner; public class Decimal { public static void main (String args []) //gets octal number from user, later prints conversion { int octal;
[Code] .....
Some conversions work. For example, 77 will be correctly converted to 63, and 77777777 will be converted to 16777215. However, some conversions do not work. An example of this is 775002 gets converted to 74898.
I'm working on a simple site for my friend, and he asked me to link to his other site. I need to have the link to a specific search. For example, if I search for "Heathrow," I need to be able to link a button on the other site so that it can be clicked and directed to the search results on this page. Problem is that this is apparently all Java (which I know nothing of) and how to just copy a link to the results page.
I don't see any nodes that I add. Not sure why getting this error.
duplicate found Exception in thread "main" java.lang.NullPointerException at binarysearchtree.delete(binarysearchtree.java:111) at binarysearchtree.main(binarysearchtree.java:196) Java Result: 1 public class node<T>
I'm trying to run the following java program by using the instructions provided here URL....The program tries to connect to LDAP directory, searches for an objectGUID and returns sAMAccountName...But when I compile the java program I get 19 errors as given below.
/a1/utils/seek.java:2: cannot find symbol symbol : class string location : class seek public static void main (string[] args) {
I am having the hardest time trying to figure out how to display an array in a 1-window GUI.
I can display 1 book separately, by basically ignoring the array and creating a new object for each book, but I need all 5 books to display in one window, and that's where I'm lost. I'd really like to use the arrayI built to generate the books in the GUI. The information of each book appearing horizontally, and the different books appearing vertically.
// Bookstore.java // This program displays information on multiple books
i am trying to turn an int number etc. 6 into 6 symbols the result would be "------". how can i transform int=6 into "------"? what function do i have to use to do this count?
public class Diagram { public static void skrivDiagram() { Random rand = new Random(); int[] frequency = new int[13]; {
for (int roll = 1; roll <= 100; roll++)
[code]....
Here i want to transform the frequency[face] into "-".
I've recently started programming with lwjgl, playing around with some 3D graphics. I've built a house and now I'm trying to render a view looking straight onto the center of the roof, but with current configuration it's slightly off.
As you can see in the image the edges on the roof aren't perfetly straight which would be the case if I was looking straight to the center from a point on the roof normal vector. I'm using gluLookAt to get the view, using the following code:
Well, I have a list inside of a java class then i want to call that list into the jsp to show the results. That list has results from a query, everything is ok in java class because it shows me just one result in jsp, i read that it can be do with a for or enhanced for but been honest i have try everything and nothing work.
I can now call the DB on the query I want and return results. What I know want to do is build an array of the data, forward it to the JSP page and display the bits individually.
Is there a way that I can save a binary search algorithm to a text file or something, so that it will always contain more information? The reason why I ask this is because I have BST like project which is supposed to act the game Twenty Questions, were it asks a person 20 Q's until it guess the answer. However, although my project does not require you to save stuff to a file, I find it rather very useful and cool if I could do that.So for example it would start out something like this:
Think of an animal and I will guess it. Does it have legs? YES Is it a cat? YES I win! Continue? YES
Think of an animal and I will guess it. Does it have legs? NO Is it a snake? YES I win! Continue? YES
Think of an animal and I will guess it. Does it have legs? NO Is it a snake? NO I give up. What is it? EARTHWORM Please type a question whose answer is yes for an earthworm and no for a snake. DOES IT LIVE UNDERGROUND? Continue? YES
Think of an animal and I will guess it. Does it have legs? NO Does it live underground? NO Is it a snake? NO I give up. What is it? FISH Please type a question whose answer is yes for an earthworm and no for a snake. DOES IT LIVE IN WATER? Continue? NO Good-bye.
However, if the user exits the program then everything will be lost and go to waste. So once again, is there a way that I can save all of these inputs to a file or something and then read it in again?
When I try running the program it wont output the determineWinner method, I think there is something wrong with the way i called results. But I am not exactly sure?
public class rpsGame { public static void main( String [] args ) { String userName = getUserName(); String playerChoice, computerChoice; computerChoice = getComputerChoice();
I've been working on a program where you can interact with the computer and play a guessing game of numbers between 1 and 100. It's mainly finished, I just need to add in my comments and stuff. My one problem about it that I cannot figure out is trying to get the results to give the correct int. At the end of the game, it's supposed to return the user information about how well they did like this:
Overall results: total games = int total guesses = int guesses/game = double best game = int
best game should give you the least amount of guesses you had during a particular round of the game. Here is what I have so far:
import java.util.*; public class Guess { public static final int MAX = 100; public static void main(String[] args) { intro(MAX); Scanner console = new Scanner(System.in); int tempBestGame = 0;
I am using a GUI to display search results based on user's input server name. I am using MS Access as DB and I have the DSN set up correctly.But the search results are displayed for the first typed value in text filed. I am getting same result set every time though i input different server names .
import java.sql.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.table.DefaultTableModel; public class SearchResult implements ActionListener{
I'm trying to print out the results of a program that calculates the number of seats the parties will get in an election.I have to print the partial results and the national results.
I can print te number of seats per party in each constituency, but how can i sum all seats per party in each constituency and print the national results?I'm working with vectors, which I know it might not be the best option, but everything is working, except the fact that I can't loop throuhg the vector and retrieve the total sum per party.Like, adding the seats for labour party in Constituency A and B and C, etc, and print the sum. And do the same for conservative party.Is it possible, or doIhave to create a method in Parties class to solve the problem?
This is what I have now.
for (Parties p : h.geral) { show += String.format("Constituency - %5s - %5s - %d%n", p.getConstituency(), p.getParty(), p.getNum_seats()); }
I have one problem regarding Running Multiple queries parallely and storing results in resultsets . I have multiple queries but I need to executing all at a time without having to wait for one query to complete execution and then run another as there are 2 queries say query1 takes 10 mins and hence query2 should also start simultaneously and not wait for query 1 for completion.
String query1="select * from knowledge_rep"; String query2="select * from events"; ResultSet rs=null; PreparedStatement ps =con.prepareStatement(query1); rs=ps.executeQuery(); ps =con.prepareStatement(query2); rs1=ps.executeQuery();
[Code] ....
The above one is time consuming and second implementation using branch i wont be able to resolve it to result set using execute batch. Considering there are multiple select queries and the number of queries to be executed are dynamic and unknown and all the data from the queries are needed. Any leads to perform all these by running multiple threads simantaneously.