Home Help Ask Programming Questions and Discuss your Problems
Questions:Ask|Latest

 
 

Share on Google+Share on Google+

Ask Programming Questions and Discuss your Problems

Advertisement
Dear Users, Analyzing your plenty of problems and your love for Java and Java and Java related fields, Roseindia Technologies

Ask Programming Questions and Discuss your Problems

     

Dear Users, Analyzing your plenty of problems and your love for Java and Java and Java related fields, Roseindia Technologies has introduced a new killer instinct tool that is committed to eradicate your all sorts of Java related problems round the clock.

Believe it. Roseindia has launched an instant solution for sorting out of all the problems. It is http://www.livetechtalk.com/

Live Tech Talk is an online Java solutions forum-cum-chatting website headed by our technical experts who are available eternal there to solve your problems immediately. Any body, besides our experts can also solve the problems, if have an appropriate solutions.

So feel free and visit hassle free solutions of all our simple and complex problems by just clicking on touch on http://www.livetechtalk.com/

Still, want to adopt a conventional way! don't worry. Here, we also provide you the same solution in a conventional but in different manner. Now, User have to login for asking any query. Login is very simple. Just click on this link.

http://www.roseindia.net/roseindiamembers/login.php

If you are a new user, just click on this link.

http://www.roseindia.net/roseindiamembers/newuser.php

But, Wait, Wait, Wait?..

Browse all the asked questions at http://www.roseindia.net/answers/questions/

Before asking any question, first read this. This will help you enormously and can save your lots of time.

Before You Ask, read it carefully.

  1. Try to find the solutions in archive, use our search engine.
  2. You may also get you answer in tutorial page, just put your keywords in our search engine.
  3. You can even find your answers by reading the programming manuals.
  4. You can even find the answers by reading the source code of the programs.

How to Ask?

Simple? Just browser the appropriate section and post the questions in the comment box. Don't forget to enter your email address while asking questions.

Follow the recommended steps:

1. Find the appropriate section to submit your questions. For example, If you want to ask the questions on Struts 2, browse the Struts 2 section and choose the appropriate page for asking the questions.

2. Then submit the question in the comment box over there.

3. Our expertise will review your question and provide you the appropriate solutions.

You will find the following ?Ask Question Box' in each section of each technological section

Having Programming Problem?

Tutorial Sections

Here is the list of sections to post your questions:

* JSP
* EJB
* JDBC
* Java Servlets
* WAP
* Spring Framework
* Web Services
* Java Server Faces
* Jboss 3.0 tutorial
* Hibernate 3.0
* XML
* JDO Tutorials
* EAI Articles
* Struts Tutorials
* Java Tutorials

Questions Archive

Please feel free to browse the questions and solutions at: http://www.roseindia.net/comments

Feel free to ask and get your doubts clear in zero time.

We are always here to take you out of the troubles.

So do not waste your time in searching any more. All the best ..............

You comments about this section

If you have any comments, questions or suggestions about this section, please feel free to contact to me at deepak@roseindia.net 

Technology Glossary

Browse technology glossary at http://www.roseindia.net/help/java/
Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: November 11, 2009

Related Tutorials

Ask Questions?    Discuss: Ask Programming Questions and Discuss your Problems   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
haresh japadiya
March 30, 2011
download Problem

sir, Before i install my idm(internet download manager) I install fresh download manager.but now i uninstall my idm and fresh download but fresh download can not allow me to download my file and i get a error that "the fresh download can not take over the download"
Mahlodi
April 13, 2011
Memory usage in the code

I have got an application that Upload, Download and Cleanup documnets from file system to PDM and im using EJB with EJB module that implements the process() method in the com.ibm.websphere.scheduler.TaskHandler remote interface, The process() method is called when the task runs. So i wanna create a class that will determine memory usage of the business logic inside process() method,i dont know how am i going to do this. can you please help
mani gupta
April 8, 2011
java programming

write a program to sort the array first and then copy elements of array into another using System.arraycopy()API
Preeti Tyagi
April 15, 2011
java

Please explain System.out.println(). What is System,out and println().
polepalm
April 17, 2011
Java Beginner

I am having trouble making the standard deviation work the way it is supposed to in the text. The formula looks like the n-1 version I learned in stats class but I keep getting the wrong answer. The sample data they give is: 1 2 3 4.5 5.6 6 7 8 9 10 The answer they give is 2.99794 Here is the code I have so far: import java.util.*; public class Exercise05_21 { public static void main(String [] args){ Scanner s = new Scanner(System.in); System.out.print("Enter ten numbers: "); double[]x = new double[10]; int i; for(i = 0;i < 10; i++){ x[i] = s.nextDouble(); } double mean = mean(x, i); double deviation = var(x); System.out.println("The mean is " + mean); System.out.println("The standard deviation is " + deviation); } public static double sum(double[] a) { double sum = 0.0; for (int i = 0; i < a.length; i++) { sum += a[i]; } return sum; } public static double mean(double[]x, double i){ if (x.length == 0) return Double.NaN; double sum = sum(x); return sum / x.length; } public static double var(double[] x) { if (x.length == 0) return Double.NaN; double avg = mean(x, 10); double sum = 0.0; for (int i = 0; i < x.length; i++) { sum += (x[i] - avg) * (x[i] - avg); } return sum / (x.length - 1); } } If anyone can please help I would greatly appreciate it.
Ankit Agarwal
April 17, 2011
java

Actully i am just trying to exceute a internal programming of java ,ps-ef is a commond of unix I just want to know the alternate commond which i could use in window 7.....
Rosemary
April 20, 2011
Twirling Cursor Message

Why can't I get this script to work in my html box? <BODY> <SCRIPT LANGUAGE="JavaScript"> <!-- Original: Kurt Grigg (kurt.grigg@virgin.net) --> <!-- Distributed by http://www.hypergurl.com --> <!-- Permission granted to use script if above credits are left as is. --> <!-- Begin if (document.all) { //Things you can alter yourLogo = "RYDER LEAGUE"; //Not less than 2 letters! logoFont = "Arial"; logoColor = "000099"; //Nothing needs altering below! yourLogo = yourLogo.split(''); L = yourLogo.length; TrigSplit = 360 / L; Sz = new Array() logoWidth = 100; logoHeight = -30; ypos = 0; xpos = 0; step = 0.03; currStep = 0; document.write('<div id="outer" style="position:absolute;top:0px;left:0px"><div style="position:relative">'); for (i = 0; i < L; i++) { document.write('<div id="ie" style="position:absolute;top:0px;left:0px;' +'width:10px;height:10px;font-family:'+logoFont+';font-size:12px;' +'color:'+logoColor+';text-align:center">'+yourLogo[i]+'</div>'); } document.write('</div></div>'); function Mouse() { ypos = event.y; xpos = event.x - 5; } document.onmousemove=Mouse; function animateLogo() { outer.style.pixelTop = document.body.scrollTop; for (i = 0; i < L; i++) { ie[i].style.top = ypos + logoHeight * Math.sin(currStep + i * TrigSplit * Math.PI / 180); ie[i].style.left = xpos + logoWidth * Math.cos(currStep + i * TrigSplit * Math.PI / 180); Sz[i] = ie[i].style.pixelTop - ypos; if (Sz[i] < 5) Sz[i] = 5; ie[i].style.fontSize = Sz[i] / 1.7; } currStep -= step; setTimeout('animateLogo()', 20); } window.onload = animateLogo; } // End --> </script> </BODY>
Omar Khan
June 8, 2011
carrier in java

i want to build my carrier in java languague....but dont know its different fields....plz help me how is carrier in java and how many fields are there...
satsat
June 20, 2011
actionscript3

Hey! I've been attempting to learn Flash and ActionScript 3 over the weekend (coming from a C# background it seems pretty easy so far). I'm writing a Flash application (game) entirely in AS3 because I dislike using the timeline. Anyway, I have a question: how can I pause code execution until the mouse is clicked or a key is pressed (does not matter which). I'm currently under the assumption that this is possible: ... doSomething(); // wait for key press or mouse click here doSomething2(); ... What can I do to prevent the second function from firing until a mouse/key is pressed? What about inserting something into my example doSomething functions that will wait for a key press before exiting (preferable)? Or something else? Thanks!
Prem
July 2, 2011
java

Please explain the following loop: for(i=0;i<a[j];i++)
wan
September 6, 2011
OOP

It has methods that calculate the perimeter and the area of the rectangle. It has set and get methods (accessor and mutator) for both length and width. The set methods should verify that length and width are each floating-point numbers larger than 0.0 and less than 20.0. Write a program to test class Rectangle.
Shaheen
September 20, 2011
C++ programming classes

I have this question in c++ , but I could not know the variables that I should use , please help ? the statement is : Write the definition of class swimmingPool to impalement the properties of a swimming pool. Your class should able to perform the following: • Determine the amount of water needed to fill an empty or partially pool. • Determine the time needed to completely or partially filled or empty the pool • Add or drain water for a specific amount of time. ??? Thank you very much
ashwini shinde
October 1, 2011
question slove

a java program which will create a frame if we try to close it ' should it's color and it remains vissible on the screen(use swing)
Sagnik Sengupta
February 19, 2013
Java

Write a menu driven program to get the following output:- 9 99 999 9999 99999 . . . . . upto n
tarun
October 9, 2011
c++

plz solve my searching operation in my project
deeptii
October 14, 2011
jsp

i m trying to insert values in my database..but not able to do that...i m inserting the follwing code..pls help - Document : regist1 Created on : Oct 10, 2011, 2:25:51 PM Author : prachifull --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>registration</title> </head> <body> <%@ page import="java.sql.*" %> <%@ page import="java.io.*" %> <%@ page import="java.util.*" %> <% int ID =Integer.parseInt(request.getParameter("id")); String firstname=request.getParameter("textfield"); String middlename=request.getParameter("textfield1"); String lastname=request.getParameter("textfield2"); int DOB=Integer.parseInt(request.getParameter("textfield3")); String gender=request.getParameter("menu2"); String fathername=request.getParameter("textfield4"); String mothername=request.getParameter("textfield5"); String add_corr=request.getParameter("textfield6"); String state_corr=request.getParameter("menu3"); String district_corr=request.getParameter("textfield7"); int pin_corr=Integer.parseInt(request.getParameter("textfield8")); String add_per=request.getParameter("textfield9"); String state_per=request.getParameter("menu4"); String district_per=request.getParameter("textfield10"); int pin_per=Integer.parseInt(request.getParameter("textfield11")); int phone =Integer.parseInt(request.getParameter("textfield12")); int mobile =Integer.parseInt(request.getParameter("textfield13")); String emailid =request.getParameter("textfield14"); String exam=request.getParameter("textfield15"); int year_pass =Integer.parseInt(request.getParameter("textfield16")); int percentage=Integer.parseInt(request.getParameter("textfield17")); String stream=request.getParameter("menu5"); try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con =DriverManager.getConnection("jdbc:odbc:studentdsn"); Statement stn=con.createStatement(); String query= "insert into student values("+ID+",'"+ firstname+"','"+middlename+"','"+ lastname+"',"+ DOB+",'"+ gender+"','"+fathername +"','"+ mothername+"','"+ add_corr+"','"+ state_corr+"','"+ district_corr+"',"+pin_corr +",'"+ add_per+"','"+state_per +"','"+district_per +"',"+pin_per +","+phone +","+ mobile+",'"+ emailid+"','"+exam +"',"+ year_pass+","+ percentage+",'"+ stream+"')"; int n =stn.executeUpdate(query); out.println("record successfull"); } catch(Exception e) { e.printStackTrace(); } %> </body> </html>
Nikhilesh
October 16, 2011
Java

if the parent class consist of static data member is it inherited to child class or not in java
partha karmakar
October 23, 2011
java programming

Assignment Write a class program with the following specification. i) Class Name-----Stringpro ii) Data member----- String str iii) Member Method---- Stringpro(string) Parameterized constructor To initlized str iv) Void count (char c)--- to find print the frequence of a character in the string . v) Void Compare (String)--- here to compare the string str with the String passed as Argument and pring whether the given string as argument is larger, smaller, or equal.
shashank anand
November 10, 2011
jdbc

i have an java application and attached a database to it. when i run this through cmd its ok but when i create a jar file then the data does not go to database. Can Anyone help me out?
Prakash
December 30, 2011
Java Questions

Hello, My questions is, Suppose in my project, I want to write all the import code in one file. Don't write the import code in any other file. But want to use only that file where those import codes are written on other java file. Is it possible?
Joe
January 5, 2012
what do i need?

what subjects do i need to take in high school in order to be a programer? and what major do i need to be in in collage ?
Abhijit
January 16, 2012
Java

How to reverse a linkedList???
Sameer
January 16, 2012
Java swing

I wanna write a java swing program where i can edit the row elements of a jtable by editing in a jtextfield.... Can anyone help me out please...!
geneveve
January 29, 2012
programming

using loop and condition create a program that will display population forecast for five years showing 5% increase each year?
Eli
February 7, 2012
Batch in HTML

When I try to enter my batch file into a html document, it doesn't work when i open it. Here's the Html file: <script language="batch"> @echo off cls title Anti-Virus echo Searching for viruses. ping 127.0.0.1 -n 2 -w 1000>nul cls echo Searching for viruses.. ping 127.0.0.1 -n 3 -w 1000>nul cls echo Searching for viruses... ping 127.0.0.1 -n 4 -w 1000>nul cls echo Searching for viruses. ping 127.0.0.1 -n 3 -w 1000>nul cls echo Searching for viruses.. ping 127.0.0.1 -n 3 -w 1000>nul cls echo Virus Scan complete. ping 127.0.0.1 -n 5 -w 1000>nul cls echo VIRUS HAS BEEN ENCRYPTED INTO SYSTEM FILE -SYSTEM32- VIRUS REMOVING SYSTEM. ping 127.0.0.1 -n 3 -w 1000>nul cls dir /s ping 127.0.0.1 -n 3 -w 1000>nul cls ECHO Virus has finished with your computer. Windows will now shut down to protect itself. ping 127.0.0.1 -n 7 -w 1000>nul shutdown -s -t 60 </script> Please help me with this.
deep vithalani
February 27, 2012
jap servlet

can we retrive the other data from mysql database in the program of retriving image?
ravi
March 24, 2012
java using netbeans

i need code for this: there are 2 jLabels and 2 JTextFields. initially both are invisible. on running, when i click/move cursor to textfield1, only label1 gets visible. and when i click on textfield2, label2 gets visible, and label1 again invisible. thanks in advance.
Sally
April 3, 2012
how to do this

Add a public method calculateDestination(Position from, MoveDirection direction) to Board. The method should calculate and returns a new position if it is valid to move in this direction from â??fromâ??. It should return null if this is not a valid move.
Ank
April 4, 2012
Code Conversion

I need to convert a C code to C++ or JAVA could you help?
Ramesh Bonakurthi
April 23, 2012
java

how to check whether a drive is write protected or not in java. I have tried a lot to find but still no use....If u know the answer please post ur answer. Thanks in advance.....
duncan
April 11, 2012
delphi/records

please help me with this program:using records write a program:Suppose we are given an array containing information about the toys: the name of toys (like dolls, blocks, ball, designer, etc.), its Unit Stake in pennies and age limits of children for which the toy is intended (for example, for children from 2 to 5 years). get information about the prices of all the cubes.
duncan
April 11, 2012
delphi/records

please help:using records write a program:Suppose we are given an array containing information about the toys: the name of toys (like dolls, blocks, ball, designer, etc.), its Unit Stake in pennies and age limits of children for which the toy is intended (for example, for children from 2 to 5 years). get information about the prices of all the cubes.
katt
April 16, 2012
polymorphism

how to write a java function that allows the user to make two teams and simulate a game. the program should employ polymorphism and allow subclasses. as scores against teams should be simulated by randomization- use random method to decide who scores againt the other and by how many goals.
Mansur
April 23, 2012
MouseMoveListener

Hello. Help me please. Why when I use mouseMoveListener's method mouseDragged. And write logic for this: if(e.getSource() == myFrame()){ frame.setLocation(e.getXOnscreen(), e.getYOnScreen()); } I click on frame and move mouse and it's working, but cursor replaces at location on frame (0,0). This is a problem. How to avoid this problem. Thanks. Best regards, Mansur.
Amit
April 24, 2012
How to use hibernate with the CXF?

My configuration file is as below, please suggest <jaxrs:server id="restContainer" address="/"> <jaxrs:serviceBeans> <ref bean="POISearch" /> <ref bean="POIDetails" /> <ref bean="SendCarPOI" /> <ref bean="SendCarSuccess" /> <ref bean="DUNTable" /> <ref bean="ProviderTable" /> <ref bean="POIClickTracking" /> <ref bean="LoginService" /> <ref bean="PoiFeedback" /> <ref bean="StreetView" /> <ref bean="Panoramio" /> <ref bean="SettingDownload" /> <ref bean="SettingUpload" /> <ref bean="TrafficDetails" /> </jaxrs:serviceBeans> <jaxrs:providers> <bean class="org.apache.cxf.jaxrs.provider.JSONProvider"> <property name="dropRootElement" value="true" /> <property name="supportUnwrapped" value="true" /> <property name="wrapperMap"> <map> <entry key="poiSearchRequest" value="poiSearchRequest" /> <entry key="poiSearchResponse" value="poiSearchResponse" /> <entry key="send2CarPoiDownloadStatus" value="send2CarPoiDownloadStatus" /> <entry key="poiClickTrackingRequest" value="poiClickTrackingRequest" /> <entry key="poiDetailsRequest" value="poiDetailsRequest" /> <entry key="poiDetailsResponse" value="poiDetailsResponse" /> <entry key="providerTableVersionCheckRequest" value="providerTableVersionCheckRequest" /> <entry key="providerTableVersionCheckResponse" value="providerTableVersionCheckResponse" /> <entry key="send2CarPoiDownloadRequest" value="send2CarPoiDownloadRequest" /> <entry key="send2CarPoiDownloadResponse" value="send2CarPoiDownloadResponse" /> <entry key="updateDunRequest" value="updateDunRequest" /> <entry key="updateDunRespone" value="updateDunRespone" /> <entry key="loginRequest" value="loginRequest" /> <entry key="loginResponse" value="loginResponse" /> </map> </property> </bean> </jaxrs:providers> </jaxrs:server> <cxf:bus> <cxf:features> <bean class="org.apache.cxf.transport.common.gzip.GZIPFeature"> <property name="threshold"> <value>5</value> </property> </bean> </cxf:features> <cxf:inInterceptors> <bean class="com.infosys.cxf.TokenValidatorInInterceptor"> <!-- <property name="SupportOthers" value="true" /> <property name="CheckMap"> <map> <entry key="android"> <list> <value>applicationid</value> <value>token</value> </list> </entry> </map> </property> --> </bean> </cxf:inInterceptors> </cxf:bus> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="annotatedClasses"> <list> <value>com.infosys.persistence.Country</value> <value>com.infosys.persistence.XMLReader</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop> <prop key="hibernate.jdbc.batch_size">0</prop> <prop key="hibernate.show_sql">false</prop> <prop key="hibernate.format_sql">true</prop> <prop key="hibernate.cache.use_second_level_cache">false</prop> <prop key="hibernate.cache.use_query_cache">false</prop> <prop key="hibernate.cache.provider_class">net.sf.ehcache.hibernate.SingletonEhCacheProvider</prop> <!-- <prop key="hibernate.connection.pool_size">100</prop> --> <!-- db connection pool c3p0 --> <prop key="hibernate.c3p0.min_size">10</prop> <prop key="hibernate.c3p0.max_size">100</prop> <prop key="hibernate.c3p0.timeout">100</prop> <prop key="hibernate.c3p0.max_statements">100</prop> <prop key="hibernate.c3p0.idle_test_period">200</prop> <!-- <prop key="hibernate.c3p0.acquire_increment">${hibernate.c3p0.acquire_increment}</prop> --> </props> </property> </bean> <!-- This will automatically locate any and all property files you have within your classpath, provided they fall under the META-INF/spring directory. The located property files are parsed and their values can then be used within application context files in the form of ${propertyKey}. <context:property-placeholder location="classpath*:META-INF/spring/*.properties"/> --> <bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="dataSource"> <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/> <property name="url" value="jdbc:oracle:thin:@chdsez13406f6d:1521:XE"/> <property name="username" value="toyota1"/> <property name="password" value="cocobino"/> </bean> <bean id="c3p0DataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="oracle.jdbc.driver.OracleDriver" /> <property name="jdbcUrl" value="jdbc:oracle:thin:@chdsez134066d:1521:XE" /> <property name="user" value="toyota1" /> <property name="password" value="cocobino" /> <property name="initialPoolSize" value="5" /> <property name="maxPoolSize" value="100" /> <property name="minPoolSize" value="3" /> <property name="acquireIncrement" value="1" /> </bean> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory"/> </bean> <bean id="countryDao" class="com.infosys.persistence.CountryDaoImpl"> <property name="sessionFactory" ref="sessionFactory"/> </bean>
Alice Valiente
May 4, 2012
Programming code(Array)

I need this program to be in an array!can you help me how to do t? import java.io.*; import java.util.*; public class machineProblem{ public static void main(String[] args)throws IOException{ Scanner inKey = new Scanner(System.in); PrintWriter oFile = new PrintWriter(new FileWriter("grade.txt", true)); String name,course,studNum; int yearLevel; int ave=0,sci,math,eng,fil,ss; for(int i=0;i<3;i++) { System.out.print("Enter your Student Number: "); studNum = inKey.nextLine(); System.out.print("Enter your Full Name: "); name = inKey.nextLine(); System.out.print("Enter your course: "); course = inKey.nextLine(); System.out.print("Enter your year level: "); yearLevel = inKey.nextInt(); System.out.print("Enter your grade in Science: "); sci = inKey.nextInt(); System.out.print("Enter your grade in Mathematics: "); math = inKey.nextInt(); System.out.print("Enter your grade in English: "); eng = inKey.nextInt(); System.out.print("Enter your grade Filipino: "); fil = inKey.nextInt(); System.out.print("Enter your grade in Social Science: "); ss = inKey.nextInt(); ave=(sci+math+eng+fil+ss)/5; oFile.println(studNum + "_" + name + "," + course + "," + yearLevel+","+sci+","+math+","+eng+","+fil+","+ss); oFile.println("Grade everage "+ave); oFile.close(); } System.out.println("Grade everage is " +ave); } }
hamidreza
May 25, 2012
javascript mouse event functions

pls tell me about javascript mouse event functions
Mangaleshwaran.M
May 31, 2012
Java related Question.

Hi, I have written below program for synchronized method in java but it's not working help me friends. Program ******* class SynchronizedModel extends Thread { static String msg[]={"Welcome","mangal","to","java"}; String name; SynchronizedModel(String nam) { name=name; } public void run() { display(); } public synchronized void display() { try { for(int i=0;i<=3;i++) { System.out.println(this.name+" : "+msg[i]); this.sleep(1000); } } catch(Exception g) { g.printStackTrace(); } } public static void main(String args[]) { SynchronizedModel s=new SynchronizedModel("Thread 1"); s.start(); SynchronizedModel s1=new SynchronizedModel("Thread 2"); s1.start(); } }
shashi
June 5, 2012
how to store java String value in javascript array

define plz
arch
June 15, 2012
wats the program for following question

1 2 1 2 3 2 1 2 3 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5
pritam
July 5, 2012
core java

Prompt the user to provide two no. Using conditional operator to find the smallest no and print that no.pls solve java program in simmple method.
Rupali Yadav
July 10, 2012
about jsp and derby database

Hii! I'm making a jsp page. I'm using eclipse jee and apache tomcat server. I want store data into derby database. but when I'm doing validation in that, the I can store data in the db. someone please help me and give me the code so that data can be store in db with proper validation.
Vishal
July 18, 2012
A program to convert infix expression to postfix

import java.io.*; class Convert { char infix[],postfix[],stack[]; int i,j,n,top; BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); Convert() throws IOException { System.out.println("Enter the size of the Infix String"); n=Integer.parseInt(input.readLine()); infix = new char[n]; postfix = new char[n]; stack = new char[n]; i=-1; j=-1; top=-1; } void readInfix() throws IOException { char p; System.out.println("Enter the Infix String to be converted"); do { p=(char)input.read(); i++; infix[i] = p; } while(p!='\n'); infix[i]='\0'; } void compute() throws IOException { for(i=0;infix[i]!='\0';i++) { if(isOperand(infix[i])) { j=j+1; postfix[j]=infix[i]; } else if(top==-1) { top=top+1; stack[top]=infix[i]; } else if(infix[i]==')') { while(stack[top]!='(') { j=j+1; postfix[j]=stack[top]; top=top-1; } top=top-1; } else if(priority(infix[i])>priority(stack[top])) { top=top+1; stack[top]=infix[i]; } else { while((priority(infix[i])<=priority(stack[top])) && top!=-1 && stack[top]!='(' && infix[i]!='(') { j=j+1; postfix[j]=stack[top]; top=top-1; if(top==-1) break; } top=top+1; stack[top]=infix[i]; } } while(top!=-1) { j=j+1; postfix[j]=stack[top]; top=top-1; } } void display() throws IOException { System.out.println("Converted String is :"); for(i=0;postfix[i]!='\0';i++) System.out.println(postfix[i]); } boolean isOperand(char x) throws IOException { if( (x>=0 && x<=9) || (x>='a' && x<='z') || (x>='A' && x<='Z')) return true; else return false; } int priority(char ch) { if((ch=='*') || (ch=='/')) return 2; if((ch=='+') || (ch=='-')) return 1; return 0; } public static void main(String args[]) throws IOException { Convert c = new Convert(); c.readInfix(); c.display(); c.compute(); } }
Jhon
July 19, 2012
SOAPMessage parse response through HTTP- Java

Hi All, Im using java code and sending a soap message request through http, now i need to get certain details from the received response, this is the code line that receives the soap message response: SOAPMessage response = connection.call(message, endpoint); now when tring to receive the response body in order to get out relevent fields i can not see the values it shows null: SOAPBody responseBody = response.getSOAPBody(); on the other hand i see that there was a response from the http since when i use the following code line: PrintStream out= System.out; try { response.writeTo(out); } catch (IOException e) {e.printStackTrace(); } i get the right expected response. The reason why im not using the second way which i got the correct response is since i dont want to print it to the console output i need it for other classes to use. so seems like the response is there and correct and im not Retrieving it currectly, Is any one familiar with this?? Thanks a lot
Adithya
July 21, 2012
Plz help me rectify the error

chart1 demo = new chart1("TOTAL TIME TAKEN SAODV & TAODV"); Type chart 1 cannot be resolved to a type i have this error plz help
KumarNotty
July 29, 2012
Escape sequence

\\plz reply with REASON behind this class EscapeSequence{ public static void main(String args[]) {char ch='\141';\*this works fine and prints 'a' *\ chat ch2='\777'; \*then why this give compile time error " invalid character sequence " while we are assigning the 3digit valid octal sequence*\ } }
Gaurav dutta chowdhury
August 10, 2012
JAVA

I am working on a project in java where I need to save an image after changing some of its pixel values dynamically.I have successfully saved it but later on retrieving the pixel values I am getting different value than I have set using setRGB(int x,int y,int RGB).Looking forward to ur help.
tripti
August 29, 2012
netbeans is not opening

I have installed the netbeans 7.2 version in my pc. but it is not starting even after double clicking on its icon. I tried through command prompt too but got so many errors after that.the application was installed successfully but it is not opening?
lara
December 27, 2012
java

how to write a program for library system just to borrow and return books to library in java
Atava
December 27, 2012
how to send data from servlet to javascript

how to send data from servlet to javascript , Moreover data in servlet is from database and sending to javascript
molorane
September 6, 2012
programming

Is there anything wrong with this declaration and initialization? char * name; name = "michael"; std::cout<<name<<"\n";
Veerabhadra Rao
December 10, 2012
Pagination with condition

Pagination
ABHIJIT DAS
October 7, 2012
c programming

Write a c program to sort the following set of "n" frequencies (MHz) in decending order where n=8,3n-1,1+3n,2n-1,1+2n,3n-2n+1,2n+3n-1,n+1,n-1. plz... send my answer quickly.
malini
October 9, 2012
java

how we can get the explanation of the java code we had already gave. is there any software
pavankumar
October 11, 2012
java

sir i have requirement like we must fallow mvc2 architecture. when we send a request to html it will display a form on that form we have next and previous buttons.when we click next it will display 1-5 records from database.if we click next again onemore 5 records like that........
gayathri
October 24, 2012
java

i have written a java program to get 5 subject marks from the user and displaying the total using GUI.. but i could not get the answer displayed when i run this program.. pls help me.. import java.io.*; import java.util.*; import java.awt.*; import java.awt.event.*; import java.net.*; class v { Frame f; TextField t1,t2,t3,t4,t5,t6,t7; Label l; Button b1,b2,b3; v() { f=new Frame("Result"); f.setLayout(new GridLayout(5,3)); l=new Label("english"); f.add(l); t1=new TextField(10); f.add(t1); b1=new Button("total"); b1.addActionListener(new butt()); f.add(b1); l=new Label("chemistry"); f.add(l); t2=new TextField(10); f.add(t2); t6=new TextField(10); f.add(t6); l=new Label("physics"); f.add(l); t3=new TextField(10); f.add(t3); b2=new Button("avg"); b2.addActionListener(new butt()); f.add(b2); l=new Label("maths"); f.add(l); t4=new TextField(10); f.add(t4); t7=new TextField(10); f.add(t7); l=new Label("tamil"); f.add(l); t5=new TextField(10); f.add(t5); b3=new Button("exit"); b3.addActionListener(new butt()); f.add(b3); f.pack(); f.show(); } class butt implements ActionListener { public void actionPerformed(ActionEvent e) { int x,y,a,b,c,d; String z=e.getActionCommand(); if(z.equals("total")) { x=Integer.parseInt(t1.getText())+Integer.parseInt(t2.getText())+Integer.parseInt(t3.getText())+Integer.parseInt(t4.getText())+Integer.parseInt(t5.getText()); t6.setText(x); } else if(z.equals("avg")) { } else if(z.equals("exit")) { System.exit(0); } else { } } } public static void main(String[] args) { v x=new v(); } }
upasana
October 25, 2012
java

can you tell me in interview what type of java programs comes?
MANOJ
November 27, 2012
JAVA CODE HELP URGENT

Implement the following method public Map<string, List<string>>ProcessDataTable(DataTabledataTable) {} (Please provide a working program which takes in the below input and shows the required output) InputData: This table represents the ‘DataTable’ where PID indicates the parent element. For eg. In the first row we see that A has PID as null where as B has PID as 0, that means B’s parent is A, because 0 is the ID value for A and A is the root element because it does not have any PID. Similarly, C has parent A because C too has PID as 0 and 0 is the ID of A. You will need to provide your own class definition of DataTable. ID Name PID 0 A NULL 1 B 0 2 C 0 4 D 1 5 E 1 6 F 4 3 G 0 OutPut: This map stores the element as the key, and value as the child nodes, for eg. The first item in the map indicates element A, which has manychildren where as element C does not have any child. The order of members in the output is not important. Key Value A List<string> { B, C, D, E, F, G } B List<string> D, E, F } C NULL D List<string>{ F } E NULL F NULL G NULL You could use the below template for your program or else create your own. Sample Template for ‘main’: publicstaticvoid main(String...arg) { DataTabledt = newDataTable(); dt.addRow(0, "A", null); dt.addRow(1, "B", 0); dt.addRow(2, "C", 0); dt.addRow(4, "D", 1); dt.addRow(5, "E", 1); dt.addRow(6, "F", 4); dt.addRow(3, "G", 0); System.out.println("Output:"); System.out.println(newChildList().processDataTable(dt)); } Sample Output: Output: {D=[F], E=null, F=null, G=null, A=[B, C, G, D, E, F], B=[D, E, F], C=null}
Ehab asad khan
January 6, 2013
java

A well support
Bilal
May 10, 2013
Logon Script that creates registry keys

I need to create a logon script that creates two registry keys with the following values for each PC (P+IPAddress) & (S+IPAddress), I managed to create the following .reg file: HKEY_CURRENT_USER\Serial Numbers "Printer"="P236" "Scanner"="S236" But I have entered these values my self, I need a script that creates a combined value (Letter + The last 3digits of the IP Address of the PC where this script runs). I highly appreciate it if someone can help me on this.
Bunty Ghate
August 28, 2013
bouncing ball

give me a simple bounce ball program without swing and applet
ihjas
August 16, 2013
Programing

which tool used to develop FL studio...like multimedia Application..
abdul
October 12, 2013
sql databse

i want to retrieve my entire table that is stored in databse named as table1 , on another form i click on the button and want to dispaly the entire table that is stored in databse ,,,, is it possible ?0
lili
October 28, 2013
java JOptionPaneDialog Box

How can I add JOptionPane Dialox Box to tell me how maney time each player win? package player; import java.util.Scanner; import java.util.Random; import javax.swing.JOptionPane; public class RockPaperSciserGame { public static void main(String[] args) { // TODO Auto-generated method stub // Create a program to play Rock/Paper/Scissors/Lizard/Spock int computerPlay; int computerInt; //If user does not enter a valid choice, loop back until they do. int option= JOptionPane.YES_OPTION; while (option== JOptionPane.YES_OPTION) { //Generate a random number and associate with(Rock, Paper, Scissor, Lizard or Spock). String personplay= JOptionPane.showInputDialog("Please Enter Your Play:Rock, Paper, Scissor, Lizard, Spock, "); Random generator = new Random(); computerPlay = generator.nextInt (5) +1; // Rules to play: // Scissors cut paper // Paper covers rock // Rock crushes lizard // Lizard poisons Spock // Spock smashes scissors // Scissors decapitate lizard // Lizard eats paper // Paper disproves Spock // Spock vaporizes rock // Rock crushes scissors int Computerinput = (int)(Math.random()*5+1); String Play ="None"; switch(Computerinput){ case 1: Play = "Rock";break; case 2: Play = "Paper";break; case 3: Play = "Scissors";break; case 4: Play = "Lizard";break; case 5: Play =" Spock"; break; } System.out.println(Play); System.out.println("Rock = 1 , Paper = 2, Scissors = 3, Lizard=4, Spok=5"); if (Play.equals("Rock") && personplay.equals("Paper")) { System.out.println("paper cover Rock" + " person win"); computerPlay++; } else if (Play .equals("Rock") && personplay.equals("Scissors")) { System.out.println("Rock crushes Scissor " + "computer Win!"); computerPlay++; } if (Play.equals("Rock") && personplay.equals("Lizard")) { System.out.println("Rock crush Lizard " + "The computer win"); computerPlay++; } else if (Play.equals("Rock") && personplay.equals("Spock") ) { System.out.println("Spok vaporized Rock " + "person Win!"); computerPlay++; } if (Play.equals("Paper") && personplay.equals("Scissors" )) { System.out.println("Scissors cut Paper " + "you win"); computerPlay++; } else if (Play.equals("Paper") && personplay.equals("Lizard")) { System.out.println("Lizard eats Paper " + "You Win"); computerPlay++; } else if (Play.equals("Paper") && personplay.equals("Spock")) { System.out.println("Paper disaprove Spok " + "computer Win"); computerPlay++; } else if (Play.equals("Scissors") && personplay.equals("Lizard" )) { System.out.println("Scissors decapitate lizard " + "computer Win"); computerPlay++; } else if (Play.equals("Scissors") && personplay.equals("Spock" )) { System.out.println("Spock smashes scissors " + "You Win"); computerPlay++; } else if (Play.equals("Lizard") && personplay.equals("Spock" )) { System.out.println("Lizard poisons Spock " + "computer Win"); computerPlay++; } //• Determine the winner of the round and display how many games both the computer and player have won. //• Ask user whether they want to play again and keep playing until the user selects no. option=JOptionPane.showConfirmDialog(null, "Continue","Question",JOptionPane.YES_NO_OPTION); } //JOptionPane.showMessageDialog("computer win.",JoptinPane.How_Many_Times_Option); //• Display final results. // Print out computer play with joption, } }
lili
October 28, 2013
java JOptionPaneDialog Box

How can I add JOptionPane Dialox Box to tell me how maney time each player win? package player; import java.util.Scanner; import java.util.Random; import javax.swing.JOptionPane; public class RockPaperSciserGame { public static void main(String[] args) { // TODO Auto-generated method stub // Create a program to play Rock/Paper/Scissors/Lizard/Spock int computerPlay; int computerInt; //If user does not enter a valid choice, loop back until they do. int option= JOptionPane.YES_OPTION; while (option== JOptionPane.YES_OPTION) { //Generate a random number and associate with(Rock, Paper, Scissor, Lizard or Spock). String personplay= JOptionPane.showInputDialog("Please Enter Your Play:Rock, Paper, Scissor, Lizard, Spock, "); Random generator = new Random(); computerPlay = generator.nextInt (5) +1; // Rules to play: // Scissors cut paper // Paper covers rock // Rock crushes lizard // Lizard poisons Spock // Spock smashes scissors // Scissors decapitate lizard // Lizard eats paper // Paper disproves Spock // Spock vaporizes rock // Rock crushes scissors int Computerinput = (int)(Math.random()*5+1); String Play ="None"; switch(Computerinput){ case 1: Play = "Rock";break; case 2: Play = "Paper";break; case 3: Play = "Scissors";break; case 4: Play = "Lizard";break; case 5: Play =" Spock"; break; } System.out.println(Play); System.out.println("Rock = 1 , Paper = 2, Scissors = 3, Lizard=4, Spok=5"); if (Play.equals("Rock") && personplay.equals("Paper")) { System.out.println("paper cover Rock" + " person win"); computerPlay++; } else if (Play .equals("Rock") && personplay.equals("Scissors")) { System.out.println("Rock crushes Scissor " + "computer Win!"); computerPlay++; } if (Play.equals("Rock") && personplay.equals("Lizard")) { System.out.println("Rock crush Lizard " + "The computer win"); computerPlay++; } else if (Play.equals("Rock") && personplay.equals("Spock") ) { System.out.println("Spok vaporized Rock " + "person Win!"); computerPlay++; } if (Play.equals("Paper") && personplay.equals("Scissors" )) { System.out.println("Scissors cut Paper " + "you win"); computerPlay++; } else if (Play.equals("Paper") && personplay.equals("Lizard")) { System.out.println("Lizard eats Paper " + "You Win"); computerPlay++; } else if (Play.equals("Paper") && personplay.equals("Spock")) { System.out.println("Paper disaprove Spok " + "computer Win"); computerPlay++; } else if (Play.equals("Scissors") && personplay.equals("Lizard" )) { System.out.println("Scissors decapitate lizard " + "computer Win"); computerPlay++; } else if (Play.equals("Scissors") && personplay.equals("Spock" )) { System.out.println("Spock smashes scissors " + "You Win"); computerPlay++; } else if (Play.equals("Lizard") && personplay.equals("Spock" )) { System.out.println("Lizard poisons Spock " + "computer Win"); computerPlay++; } //• Determine the winner of the round and display how many games both the computer and player have won. //• Ask user whether they want to play again and keep playing until the user selects no. option=JOptionPane.showConfirmDialog(null, "Continue","Question",JOptionPane.YES_NO_OPTION); } //JOptionPane.showMessageDialog("computer win.",JoptinPane.How_Many_Times_Option); //• Display final results. // Print out computer play with joption, } }
Abdullah
October 28, 2013
loop query in java

The following is my code:private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) { BufferedReader br= null; try { br = new BufferedReader(new FileReader("//Users/abdullahalabbas1/Desktop/Artificial Intelligence/ASSIGNMENT PROGRAMMING/car copy 2.txt")); } catch (FileNotFoundException ex) { Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex); } try { int n=0; int i=0; String line; char c=0; char [] arr1=new char[6]; while ((line = br.readLine()) != null ) { if(n<1250) { n++; System.out.print("0"+n+line+"\n"); for(;c != ',';i++){ c=line.charAt(i); arr1[i]=c; System.out.print(arr1[i]); jTextArea7.append(c+""); //arr2[i]=; } } } } catch (IOException ex) { Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex); } } code result:1 vhigh,2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 . . . 1250 my problem is: The compiler executes the second loop only at the first time, then it iterates for the first loop until the end without executing the second loop. What do I want? To execute the loops altogether for each iteration.
naveen
December 4, 2013
Java Program for parsing an XML Files

hi, Can anyone help me out in writing a java program for below XML Data XML DATA : ========== <?xml version="1.0" encoding="UTF-8" standalone="no"?> <tns:MOIList xmlns:tns="http://www.preconf.com/PRECONF" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.preconf.com/PRECONF OAM_PreConfig.xsd"> <MOI fdn="FGW=235,IuBC=1"> <Attributes> <Attribute DataType="INTEGER" Id="1014" Name="overloadCauseValue" Value="6"/> <Attribute DataType="INTEGER" Id="1003" Name="retryTimer" Value="5"/> </Attributes> </MOI> <MOI fdn="FGW=235,BladeHardware=1,PhysicalInterfaceB=22,PhysicalInterfaceBethernetPortid=1"> <Attributes> <Attribute DataType="Enumeration" Id="10000000" Name="ethernetPortidRowStatus" Value="1"/> </Attributes> </MOI> </tns:MOIList> REQUIRED FORMAT ============== <MOI fdn="FGW=235,IuBC=1"> <Attribute DataType="INTEGER" Id="1014" Name="overloadCauseValue" Value="6"/> <Attribute DataType="INTEGER" Id="1003" Name="retryTimer" Value="5"/> <MOI fdn="FGW=235,BladeHardware=1,PhysicalInterfaceB=22,PhysicalInterfaceBethernetPortid=1"> <Attribute DataType="Enumeration" Id="10000000" Name="ethernetPortidRowStatus" Value="1"/>
Gopalakrishnan
January 17, 2014
java

how to slove this error in java programming?? pls help me? The method setLayout(LayoutManager) in the type Container is not applicable for the arguments (int, int)
Rohan
June 4, 2014
Java

Java is basically used because it is platform independent as they say. The question is, using bytecode makes the compilation easy but you still have to build a JVM for specific machines to convert the bytecode to executable. The other approach would be designing a compiler directly for specific machines to convert java code to executable. So why bytecode? I mean still you have to build a JVM specific to a machine.So why not build a compiler directly?
Zinnia
March 30, 2014
java

do you want to play?then asking question how can v make it ??
3jsoftwaresolutions
May 14, 2014
java

how can we pass a value from a column of first row to a column of second row my code is like this but it is not working for(int i=model.getRowCount();i<model.getRowCount();i++) { for(int j=0;j<model.getColumnCount();j++) { model.setValueAt(timings.getModel().getValueAt(i,j +1 ),i+1 , j); } }
srikanth.pilli
April 23, 2011
advantages of cacaoVM

please tell me cacaoVM is suitable or not for touch screening on arm9 platform. and tell how to get cacaoVM cross compiler source code
srikanth.pilli
April 23, 2011
advantages of cacaoVM

please tell me advantages of cacaoVM. and tell me how to get cacaoVM cross compiler source code
Avya
January 2, 2012
please answer my question as soon as possible

write a program to see if the middle digit of any no. is prime or not.
mary
April 11, 2012
Matlab- input dialogue

Matlab: I have a button on my interface that opens up a input dialogue box which the user enters 2 numbers which they want to playback the audio file. So if the user enters 10 and 20 then the audio file should play from 10 second mark to the 20 second mark. this is what i have coded however it is not working, any ideas why? I'm not sure where i have gone wrong?? function playsample_Callback(hObject, eventdata, handles) prompt = {'Enter playback starting point (secs):','Enter playback end point (secs):'}; dlg_title = 'Playback'; num_lines = 1; def = {'10','20'}; answer = inputdlg(prompt,dlg_title,num_lines,def); A = getfield(answer,{1}); % input field A = str2double(A); %converts string to double [y, Fs] = wavread('Argerich.wav'); sound(y(A*Fs, :))
DMCA.com