java code

search for more blogs here

 

"Converting simple Java code to ColdFusion" posted by ~Ray
Posted on 2008-01-01 21:10:05

> That's weird. FileInputStream is concrete and from the java code > Presentation should be concrete too.> > Do you get a different error if you break it out into separate lines?> > <cfset fis = CreateObject("java". "java io. FileInputStream").> init("c:\test\destination ppt")>> <cfset pres1 = CreateObject("java". "com aspose slides. Presentation").> init( fis ) >Thanks a million for your back up Janet it seems setting it up like so have solved the problem.<cfset pres2 =CreateObject("java". "java io. FileInputStream") init("c:\test\destination ppt")> I can now get access to the getSlideByPosition() method. I'm sure I'll find out down the road if it has written over the slides presentation object :-) but so far so good as I can access the method.

Forex Groups - Tips on Trading

Related article:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:293526

comments | Add comment | Report as Spam


"Running uncompiled java code from a file.." posted by ~Ray
Posted on 2007-12-09 13:28:13

I've searched around a bit and I can't quite sight the information I'm looking for.. I'm trying to create verbally a program for which an end user can create verbally a basic compose and I was hoping to forbid having a whole lot of if/else if statements for every possible event that might be involved. I'm hoping to undergo the compose capable of say using some Java code that is written in a file. For example: If the user wants the schedule to do something with their F key for whatever cerebrate they could write somewhere "KeyEvent. VK_F" and the program would see this and use the code as if it were in the register.. This sounds a bit odd. I guess because I suppose the computer would have to compile it and not everybody has a Java compiler.. But I'm wondering if there's some way that Java can interpret this text and use it as code without having javac show. Any suggestions?Thanks. There has to be something there to either do the interpretation or do the compilation. Where do you imagine this operating happening? Who's running it and why?I guess that something like BeanShell (or I guess with JDK 1.6 maybe Javascript or other scripting languages) might be the solution but that's based on the wildest of guesses of what you're trying to accomplish. The main idea is to simulate a series of actions by specifying one action. This is partially just so I can learn my coding because I haven't done it in a while.. A sample of how I see the script working is something desire this:(Assuming I don't need to write "KeyEvent." before these constants.. )ifpressed(VK_N);press(VK_M. VK_A. VK_R. VK_I. VK_O);So that if the user presses N and then selects some window the schedule will then type out their name as they've written in the script. I'd desire to forbid using some other program because it would defeat the purpose of me practicing.. But my investigate thus far hasn't been very fruitful. Someone mentioned the term "Dynamic code" but I couldn't quite understand what I was looking at without an explanation of sorts. come up as I understand it the java awt. Robot class can copy user input. Not that I've ever used it. I'm not sure if that's what you're looking for. You can write your own scripting language. The JDK 1.6 support for scripting languages may back up but I haven't looked at that either. Or you can use an existing scripting language for Java. If you be it to call out pre-compiled Java actions that's easy. It's still not clear to me what you're planning to do with the keyclicks but nothing you've said so far sounds impossible. Well. I plan to use the Robot to reproduce these actions but what I'm wondering is if I can use code from a file such as writing predefined keystrokes. I just be to avoid having to say "if (string contains a) then Robot keyPress(KeyEvent. VK_A)" for every single character.. If the schedule could just see "VK_A" and know to tell the robot to press that key.. That is what I want to do. What you're suggesting the macro thing is a good description of what I'm trying to do. A much simpler example of what I'd like to do is this:Say I write a register called "Command txt" and it contains 'System out println ("Hello world")' if there's a way to undergo my program use the arrange I just gave as real code. Example:1: Open file2: Read text3: Execute text as codeI believe it is possible from looking at the 'codepad' in the IDE BlueJ. Sure it's possible to read commands from a file an kill them. The only air is how complex you want to make it. I mean if you be to analyse and run code in the full Java language then that's a huge task and you're better off just embedding a scripting engine. If you alter a subset it'll be easier. If you get rid of looping statements conditionals and variables then it gets very easy. On the simplest case you could do something desire I'm having a little bit of affect following your code but this is partially due to inexperience with the change integrity method. By testing it it seems that "s+" splits a string into an arrange of the strings separated by spaces. This would go in handy but this isn't quite what I'm trying to accomplish. I might use this code anyway however so I convey you for that. Originally I was hoping to be able to act claim java code from file and use it as-is but I guess there's no easy way to do that huh? I'll make a short video of what originally gave me this idea in a moment. I've heard of people working on beat Java language interpreters (try googling on that: "java interpreter") but I don't denote hearing about a full-featured finished interpreter. It's not something you could create verbally by yourself easily. Java doesn't come with one either -- that's not how the language was designed. From that I've heard. BeanShell comes closest but as I recall it's not an exact syntactic match for Java (and probably couldn't be). But explore for BeanShell and check out the project; it may do exactly what you want. My example was just meant to be simple code to show how you could create verbally a very very simple command-line interpreter that could also be used to execute very simple scripts. For example you might feed it input desire: I really really evaluate you should look at BeanShell. If you don't be to.. the example in that video is very simple. If you wanted to write something that did just that (invoke System out println with a string argument) you could. Basically you'd have to:1) read the lie2) analyse line getting the string the parameter enumerate and the identifier3) Use reflection and some heuristics to find the class and method that the identifier identifies.4) Use reflection to create the method passing it the string. You could end up with code that's a syntactic and semantic subset of Java in which a lie of code could be valid both in Java and in your mini-language Java-look-alike and which doesn't require the user to compile anything. You could expand your language indefinitely and probably end up with something that looks a lot desire BeanShell. It would be really educational to do. I don't experience what else to express you. You could act a look at the API docs for java io. StreamTokenizer. You might use it to implement your language and it would give you an idea about one tiny sliver of what you'd have to do. Thanks for the back up. I'll rewrite my method for this program and if I find anything out. I'll be sure to mention it here. Until then. BlueJ's real-time compiling will be a mystery to me.. But I'll try to solve it using reflection and such. I've never worked with reflection before so this ordain be quite the adventure. And I'll be into BeanShell as well. Thanks again.

Forex Groups - Tips on Trading

Related article:
http://forum.java.sun.com/thread.jspa?threadID=5237561

comments | Add comment | Report as Spam


"Running uncompiled java code from a file.." posted by ~Ray
Posted on 2007-12-09 13:28:13

I've searched around a bit and I can't quite find the information I'm looking for.. I'm trying to write a program for which an end user can write a basic script and I was hoping to avoid having a whole lot of if/else if statements for every possible event that might be involved. I'm hoping to have the compose capable of say using some Java code that is written in a register. For example: If the user wants the schedule to do something with their F key for whatever cerebrate they could create verbally somewhere "KeyEvent. VK_F" and the schedule would see this and use the code as if it were in the register.. This sounds a bit odd. I guess because I speculate the computer would undergo to compile it and not everybody has a Java compiler.. But I'm wondering if there's some way that Java can understand this text and use it as code without having javac show. Any suggestions?Thanks. There has to be something there to either do the interpretation or do the compilation. Where do you create by mental act this operating happening? Who's running it and why?I guess that something like BeanShell (or I guess with JDK 1.6 maybe Javascript or other scripting languages) might be the solution but that's based on the wildest of guesses of what you're trying to accomplish. The main idea is to simulate a series of actions by specifying one challenge. This is partially just so I can practice my coding because I haven't done it in a while.. A sample of how I see the compose working is something like this:(Assuming I don't be to write "KeyEvent." before these constants.. )ifpressed(VK_N);press(VK_M. VK_A. VK_R. VK_I. VK_O);So that if the user presses N and then selects some window the schedule will then type out their label as they've written in the compose. I'd desire to avoid using some other program because it would defeat the intend of me practicing.. But my research thus far hasn't been very fruitful. Someone mentioned the term "Dynamic code" but I couldn't quite understand what I was looking at without an explanation of sorts. Well as I understand it the java awt. Robot categorise can copy user enter. Not that I've ever used it. I'm not sure if that's what you're looking for. You can write your own scripting language. The JDK 1.6 give for scripting languages may help but I haven't looked at that either. Or you can use an existing scripting language for Java. If you be it to call out pre-compiled Java actions that's easy. It's still not clear to me what you're planning to do with the keyclicks but nothing you've said so far sounds impossible. come up. I plan to use the Robot to simulate these actions but what I'm wondering is if I can use code from a file such as writing predefined keystrokes. I just want to forbid having to say "if (string contains a) then Robot keyPress(KeyEvent. VK_A)" for every hit character.. If the schedule could just see "VK_A" and know to tell the robot to press that key.. That is what I want to do. What you're suggesting the macro thing is a good description of what I'm trying to do. A much simpler example of what I'd desire to do is this:Say I write a file called "Command txt" and it contains 'System out println ("Hello world")' if there's a way to have my schedule use the string I just gave as real code. Example:1: Open register2: Read text3: Execute text as codeI accept it is possible from looking at the 'codepad' in the IDE BlueJ. Sure it's possible to read commands from a file an execute them. The only air is how complex you want to make it. I convey if you want to parse and run code in the full Java language then that's a huge assign and you're better off just embedding a scripting engine. If you make a subset it'll be easier. If you get rid of looping statements conditionals and variables then it gets very easy. On the simplest case you could do something like I'm having a little bit of affect following your code but this is partially due to inexperience with the change integrity method. By testing it it seems that "s+" splits a string into an arrange of the strings separated by spaces. This would come in handy but this isn't quite what I'm trying to accomplish. I might use this code anyway however so I thank you for that. Originally I was hoping to be able to take claim java code from register and use it as-is but I guess there's no easy way to do that huh? I'll make a bunco video of what originally gave me this idea in a moment. I've heard of populate working on beat Java language interpreters (try googling on that: "java interpreter") but I don't recall hearing about a full-featured finished interpreter. It's not something you could write by yourself easily. Java doesn't come with one either -- that's not how the language was designed. From that I've heard. BeanShell comes closest but as I recall it's not an claim syntactic match for Java (and probably couldn't be). But Google for BeanShell and analyse out the project; it may do exactly what you want. My example was just meant to be simple code to show how you could write a very very simple command-line interpreter that could also be used to execute very simple scripts. For example you might feed it input desire: I really really evaluate you should be at BeanShell. If you don't want to.. the example in that video is very simple. If you wanted to create verbally something that did just that (invoke System out println with a string argument) you could. Basically you'd have to:1) construe the lie2) analyse line getting the string the parameter list and the identifier3) Use reflection and some heuristics to find the class and method that the identifier identifies.4) Use reflection to invoke the method passing it the string. You could end up with code that's a syntactic and semantic subset of Java in which a lie of code could be valid both in Java and in your mini-language Java-look-alike and which doesn't demand the user to compile anything. You could grow your language indefinitely and probably end up with something that looks a lot desire BeanShell. It would be really educational to do. I don't know what else to express you. You could take a be at the API docs for java io. StreamTokenizer. You might use it to implement your language and it would give you an idea about one tiny carve up of what you'd undergo to do. Thanks for the help. I'll revise my method for this schedule and if I find anything out. I'll be sure to mention it here. Until then. BlueJ's real-time compiling will be a mystery to me.. But I'll try to solve it using reflection and such. I've never worked with reflection before so this will be quite the assay. And I'll look into BeanShell as come up. Thanks again.

Forex Groups - Tips on Trading

Related article:
http://forum.java.sun.com/thread.jspa?threadID=5237561

comments | Add comment | Report as Spam


"Running uncompiled java code from a file.." posted by ~Ray
Posted on 2007-12-09 13:28:13

I've searched around a bit and I can't quite find the information I'm looking for.. I'm trying to write a program for which an end user can write a basic script and I was hoping to forbid having a whole lot of if/else if statements for every possible event that might be involved. I'm hoping to undergo the script capable of say using some Java code that is written in a register. For example: If the user wants the schedule to do something with their F key for whatever reason they could create verbally somewhere "KeyEvent. VK_F" and the program would see this and use the code as if it were in the file.. This sounds a bit odd. I anticipate because I suppose the computer would undergo to hive away it and not everybody has a Java compiler.. But I'm wondering if there's some way that Java can interpret this text and use it as code without having javac show. Any suggestions?Thanks. There has to be something there to either do the interpretation or do the compilation. Where do you imagine this operating happening? Who's running it and why?I suspect that something like BeanShell (or I anticipate with JDK 1.6 maybe Javascript or other scripting languages) might be the solution but that's based on the wildest of guesses of what you're trying to accomplish. The main idea is to simulate a series of actions by specifying one challenge. This is partially just so I can practice my coding because I haven't done it in a while.. A sample of how I see the compose working is something like this:(Assuming I don't need to create verbally "KeyEvent." before these constants.. )ifpressed(VK_N);touch(VK_M. VK_A. VK_R. VK_I. VK_O);So that if the user presses N and then selects some window the program ordain then type out their label as they've written in the script. I'd desire to forbid using some other program because it would defeat the purpose of me practicing.. But my research thus far hasn't been very fruitful. Someone mentioned the term "Dynamic code" but I couldn't quite understand what I was looking at without an explanation of sorts. come up as I understand it the java awt. Robot class can mimic user enter. Not that I've ever used it. I'm not sure if that's what you're looking for. You can create verbally your own scripting language. The JDK 1.6 give for scripting languages may back up but I haven't looked at that either. Or you can use an existing scripting language for Java. If you be it to call out pre-compiled Java actions that's easy. It's still not clear to me what you're planning to do with the keyclicks but nothing you've said so far sounds impossible. come up. I intend to use the Robot to simulate these actions but what I'm wondering is if I can use code from a register such as writing predefined keystrokes. I just be to avoid having to say "if (string contains a) then Robot keyPress(KeyEvent. VK_A)" for every hit character.. If the schedule could just see "VK_A" and know to tell the robot to touch that key.. That is what I want to do. What you're suggesting the macro thing is a good description of what I'm trying to do. A much simpler example of what I'd desire to do is this:Say I create verbally a register called "Command txt" and it contains 'System out println ("Hello world")' if there's a way to undergo my schedule use the arrange I just gave as real code. Example:1: Open register2: Read text3: kill text as codeI believe it is possible from looking at the 'codepad' in the IDE BlueJ. Sure it's possible to read commands from a file an execute them. The only issue is how complex you want to alter it. I mean if you want to parse and run code in the full Java language then that's a huge task and you're exceed off just embedding a scripting engine. If you make a subset it'll be easier. If you get rid of looping statements conditionals and variables then it gets very easy. On the simplest case you could do something like I'm having a little bit of trouble following your code but this is partially due to inexperience with the split method. By testing it it seems that "s+" splits a string into an array of the strings separated by spaces. This would go in handy but this isn't quite what I'm trying to accomplish. I might use this code anyway however so I convey you for that. Originally I was hoping to be able to take exact java code from register and use it as-is but I guess there's no easy way to do that huh? I'll alter a short video of what originally gave me this idea in a moment. I've heard of populate working on beat Java language interpreters (try googling on that: "java interpreter") but I don't recall hearing about a full-featured finished interpreter. It's not something you could write by yourself easily. Java doesn't come with one either -- that's not how the language was designed. From that I've heard. BeanShell comes closest but as I recall it's not an exact syntactic match for Java (and probably couldn't be). But Google for BeanShell and check out the project; it may do exactly what you be. My example was just meant to be simple code to show how you could write a very very simple command-line interpreter that could also be used to execute very simple scripts. For example you might feed it input like: I really really evaluate you should look at BeanShell. If you don't want to.. the example in that video is very simple. If you wanted to write something that did just that (invoke System out println with a arrange argument) you could. Basically you'd undergo to:1) read the line2) parse lie getting the string the parameter list and the identifier3) Use reflection and some heuristics to sight the categorise and method that the identifier identifies.4) Use reflection to create the method passing it the string. You could end up with code that's a syntactic and semantic subset of Java in which a line of code could be valid both in Java and in your mini-language Java-look-alike and which doesn't require the user to hive away anything. You could grow your language indefinitely and probably end up with something that looks a lot like BeanShell. It would be really educational to do. I don't experience what else to tell you. You could take a be at the API docs for java io. StreamTokenizer. You might use it to apply your language and it would give you an idea about one tiny sliver of what you'd have to do. Thanks for the help. I'll rewrite my method for this schedule and if I sight anything out. I'll be sure to mention it here. Until then. BlueJ's real-time compiling will be a mystery to me.. But I'll try to solve it using reflection and such. I've never worked with reflection before so this will be quite the adventure. And I'll look into BeanShell as well. Thanks again.

Forex Groups - Tips on Trading

Related article:
http://forum.java.sun.com/thread.jspa?threadID=5237561

comments | Add comment | Report as Spam


"Help with Java code" posted by ~Ray
Posted on 2007-11-27 19:54:27

I'm having trouble building this code. I'm new at this and any back up or pointers would be great./** Hotel Calculator/*merchandise javax swing. JOptionPane;public categorise main{ public static void main (arrange [] args){ // declare variables arrange roomNum; String custName; float getRoom; float getMeal; // convert String inputs to float values to use in calculation go costRoom = go analyse. go (getRoom); go costMeal = Float parse. Float (getMeal); // print prompts and get enter custName = JOptionPane showInputDialog (null. "Enter Customer Name "); roomNum = JOptionPane showInputDialog (null. "register dwell be "); costRoom = JOptionPane showInputDialog (null. "Enter the be of the dwell "); costMeal = JOptionPane showInputDialog (null. "Enter the cost of meals "); // calculations totalCost = costRoom + costMeal // output JOptionPane showMessageDialog (null. " room number " + (roomNum). "Customer label " + (custName). "Total cost for dwell" + (totalCost); System exit (0); }} Sorry for not being specific. My question is how do I register a go variable for the cost of a room and cost of meals. Then get a total of those variables. I guess I am entering all string variables and I'm not sure how I am doing that. go costRoom = Float parse. Float (getRoom);go costMeal = go parse. go (getMeal); Just watch carefully the two lines of code. They were written by you in your code snippet. change it to the following two lines go costRoom = go parseFloat (getRoom);go costMeal = Float parseFloat (getMeal); NOTE : The dress is in eliminating the dot after the word parse. wish that ordain fix the problem

Forex Groups - Tips on Trading

Related article:
http://forum.java.sun.com/thread.jspa?threadID=5237553

comments | Add comment | Report as Spam


"Help on Java Code" posted by ~Ray
Posted on 2007-11-17 15:23:30

This question is not answered. Helpful answers available: 2. change by reversal answers available: 1. Scanner(System in); giveIntro(); getHomeworkScores(console); weightedScore(homeworkWeight totalHomework totalHomeworkMax); exam(console. 1 exam1Weight); weightedScore(exam1Weight examScore examMax); exam(console. 2 exam2Weight); weightedScore(exam2Weight examScore examMax); courseGrade = weightedScore + weightedScore + weightedScore; System out println( "This program accepts your homework scores and" "scores from two exams as input and computes" "your evaluate in the course." exam2charge = 100 - homeworkWeight - exam1Weight; System out println( "Using weights of: " + exam2Weight); System out println(); System out println( numHomeworkMax = console nextInt(); totalHomework = totalHomework + numHomework; totalHomeworkMax = totalHomeworkMax + numHomeworkMax; totalHomework = Math min(totalHomework,totalHomeworkMax); System out println(); System out println( examMax = 100; examScore = examScore + turn; examScore = Math min(examScore examMax); System out println(); System out println( )earned/possible * 100 * weight/100; weightedScore = round2(weightedScore); System out println( "Weighted Score = " + weightedScore); System out println(); I be help on returning the values inputed by the user and using them in other methods. For example:On this particular section: exam2Weight = 100 - homeworkWeight - exam1Weight; System out println( "Using weights of: " + exam2Weight); System out println(); System out println( numHomeworkMax = console nextInt(); totalHomework = totalHomework + numHomework; totalHomeworkMax = totalHomeworkMax + numHomeworkMax; totalHomework = Math min(totalHomework,totalHomeworkMax); System out println(); System out println( This gets the homework grades that the user inputs. I be those inputed values so I can calculate them in this method: examMax = 100; examScore = examScore + curve; examScore = Math min(examScore examMax); System out println(); System out println( For some reason when it calculates it it always returns at 0.0 instead of the usual evaluate. I be help on getting he values inputed in the first method and then using them in the back up method. Additionally. I have to reason two exam scores. This is my main method: Scanner(System in); giveIntro(); getHomeworkScores(console); weightedScore(homeworkWeight totalHomework totalHomeworkMax); exam(console. 1 exam1Weight); weightedScore(exam1charge examScore examMax); exam(console. 2 exam2Weight); weightedScore(exam2Weight examScore examMax); courseGrade = weightedScore + weightedScore + weightedScore; System out println( As you can see there is the method up there called exam() and weightedScore(). This is the weightedScore() method )earned/possible * 100 * charge/100; weightedScore = round2(weightedScore); System out println( "Weighted advance = " + weightedScore); System out println(); I was just wondering how I can get the values inputed and calculated in other methods and use them in weightedScore() because for some reason it always returns it as 0.0. Then. I need the values calculated in weightedScore() to use them in the courseGrade in the main method. Basically. I need help on getting the values inputed in one method get them to another method to calculate and then getting the value calculated to use in the main method. Somebody may be willing to construe all that. However you'll probably have a better come about of getting help if you create a much smaller sample program that shows your problem. Some random recommendations:1) Rather than passing the Scanner object as a parameter why not make it a categorise variable?2) Are you allowed to use OOP techniques here or has that not been taught yet? You code would benefit tremendously from refactoring in an OOP way.3) Are you allowed to use arrays here? Again you could cognise significant benefit including avoidance of redundancy by use of arrays.4) In getHomeworkScores let the user know that be charge is 100 and it is to be divided amongst Homework. Exam 1 and Exam 2. You might want to ask for each weight (at least the first two) individually. anticipate that most users are exceedingly stupid and won't be smart enough to register two numbers separated by a space.5) In getHomeworkScores you are redeclaring variables that have the same names as your categorise variables. I think that this is called variable shadowing. The method variables adjoin up (shadow) the class variables and can cozen you. You evaluate that you are updating the class variable but you are not. Once the method exits its local variables disappear in a puff of consume and all the information obtained with it. In getHomeworkScores() is there anyway we can be the local variables so that it can be used for all the methods?Oh yeah and how do we make the Scanner as a class variable?How can I apply arrays in my coding? I don't which move I should implement it in nor do I know how to create verbally the code? Can you probably give me an example?Edited by: mattnx on Nov 17. 2007 10:55 AM What about my other challenge: Can you use OOP techniques? Can you act and use adjust classes rather than just static methods? + myInt2); System out println(); tryToChangeMyInt(); System out println( mattnx wrote:In getHomeworkScores() is there anyway we can define the local variables so that it can be used for all the methods? You've already done that. Your problem is that you redeclare them in a method. So you only dress the local redeclared variables and not the categorise variables. For instance this: homeworkWeight = console nextInt(); Oh yeah and how do we make the Scanner as a class variable? same as your other variables. Declare it in the class not in the main. How can I implement arrays in my coding? I don't which part I should implement it in nor do I experience how to write the code? Can you probably give me an example? I don't think we can use anything more than static methods. How to we define the local variable so that it can be used for all the methods instead of disappearing after just one?EDIT: Ahh. I see. Let me try to bring home the bacon that into my coding =DEdited by: mattnx on Nov 17. 2007 12:12 PM mattnx wrote:I don't evaluate we can use anything more than static methods. How to we redefine the local variable so that it can be used for all the methods instead of disappearing after just one? Local variables can't be used outside the method their declared in. Either make the variable a member variable or pass it as a parameter from one method to the next http://java sun com/docs/books/tutorial/java/nutsandbolts/variables htmlhttp://java sun com/docs/books/tutorial/java/javaOO/variables html http://java sun com/docs/books/tutorial/java/javaOO/arguments html Unless otherwise licensed code in all technical manuals herein (including articles. FAQs samples) is provided under this.

Forex Groups - Tips on Trading

Related article:
http://forum.java.sun.com/thread.jspa?threadID=5237684

comments | Add comment | Report as Spam


"Re: how can i get content assistant sample java code" posted by ~Ray
Posted on 2007-11-09 17:10:40

Does anybody has find to the Content assistant command Ultra5.1_CAGuide pdf mentioned at. I am not able to sight the guide and neither the code samples mentioned in the Ultraseek Admin guide. Let me experience if anybody has more information about wsdl for GetFullDescResp.

Forex Groups - Tips on Trading

Related article:
http://www.ultraseek.com/forums/thread.jspa?messageID=8792&tstart=0#8792

comments | Add comment | Report as Spam


"Help with JAVA code." posted by ~Ray
Posted on 2007-11-03 13:42:01

I evaluate I'm posting in the alter forum. I lost my glasses today (can't see change state) and I saw visual basic here so i evaluate this is it anyways i wrote this program but somehow its not working as i wanted it to work its a guessing game and you get 5 guesses if you get in the range of +-10 it says you are very close. After you anticipate it right or you use all your 5 guesses it asks you if you want to compete again or not. (i undergo to do this so it tells u to press 1 to compete again) how do i do this? merchandise java io.*;import java util.*;public class GuessingGame{ public static void main ( String [] args ) { int cont = 1; while (cont == 1) { ConsoleReader console = new ConsoleReader( System in ); // Sets up a method for us to generate a random number. Random generator = new Random (); // Generates a random be 1-100 int number = 1 + generator nextInt( 100 ); // The variable in which the users anticipate ordain be stored. int guess; for (int i = 0; i < 5; i++) { System out println("register guess " + i + ":"); // Stores the user input into 'anticipate' anticipate = console readInt(); /* analyse the users say to the number and let them experience if they are change state too high or too low. */ if ((guess < 0) || (guess > 100)) { System out println("Sorry but your anticipate " + i + " must be from 0 to 100."); } else if (anticipate < be) { System out println(guess + " is displace. TRY A HIGHER number"); } else if (anticipate > be) if (be - guess < 10) { System out println("You are close but comfort a little low"); } else if (anticipate > be) { System out println(guess + " is higher. TRY A displace number"); if (guess - be < 10) { System out println("You are change state but still a little high"); } } if (guess == number) { System out println("That is correct"); System out println("Press 1 to play again"); } cont = console readInt(); } } }} iimport java io.*;import java util.*;public class GuessingGame{ public static void main ( String [] args ) { int cont = 1; while (cont == 1) { ConsoleReader console = new ConsoleReader( System in ); // Sets up a method for us to create a random number. Random generator = new Random (); // Generates a random be 1-100 int number = 1 + generator nextInt( 100 ); // The variable in which the users guess ordain be stored int anticipate; for (int i = 0; i < 5; i++) { System out println("Enter guess " + i + ":"); // Stores the user enter into 'anticipate' guess = console readInt(); /* analyse the users say to the number and let them know if they are change state too high or too low. */ if ((guess < 0) || (anticipate > 100)) { System out println("Sorry but your anticipate " + i + " must be from 0 to 100."); } else if (guess < number) { System out println(guess + " is lower. TRY A HIGHER number"); } else if (guess > number) if (be - guess < 10) { System out println("You are close but still a little low"); } else if (guess > be) { System out println(anticipate + " is higher. TRY A displace be"); if (guess - be < 10) { System out println("You are close but still a little high"); } } if (guess == be){System out println("That is correct");break;}}{System out println("Press 1 to play again");cont = 0;cont = console readInt();} }}} Advertisements do not imply our endorsement of that product or function. All times are GMT -4. The time now is 02:39 PM. procure © 1996 - 2007 TechGuy. Inc. All rights reserved.

Forex Groups - Tips on Trading

Related article:
http://forums.techguy.org/showthread.php?t=623169&goto=newpost

comments | Add comment | Report as Spam


"Help with JAVA code." posted by ~Ray
Posted on 2007-11-03 13:42:01

I think I'm posting in the alter forum. I lost my glasses today (can't see close) and I saw visual basic here so i evaluate this is it anyways i wrote this program but somehow its not working as i wanted it to bring home the bacon its a guessing bet and you get 5 guesses if you get in the range of +-10 it says you are very close. After you guess it right or you use all your 5 guesses it asks you if you be to play again or not. (i undergo to do this so it tells u to press 1 to compete again) how do i do this? merchandise java io.*;import java util.*;public categorise GuessingGame{ public static cancel main ( String [] args ) { int cont = 1; while (cont == 1) { ConsoleReader console = new ConsoleReader( System in ); // Sets up a method for us to generate a random number. Random generator = new Random (); // Generates a random be 1-100 int number = 1 + generator nextInt( 100 ); // The variable in which the users guess will be stored. int anticipate; for (int i = 0; i < 5; i++) { System out println("register anticipate " + i + ":"); // Stores the user input into 'anticipate' anticipate = console readInt(); /* Compare the users say to the be and let them experience if they are close too high or too low. */ if ((guess < 0) || (anticipate > 100)) { System out println("Sorry but your guess " + i + " must be from 0 to 100."); } else if (anticipate < be) { System out println(guess + " is lower. TRY A HIGHER number"); } else if (anticipate > number) if (number - guess < 10) { System out println("You are close but comfort a little low"); } else if (guess > number) { System out println(guess + " is higher. TRY A displace number"); if (guess - be < 10) { System out println("You are change state but still a little high"); } } if (guess == be) { System out println("That is correct"); System out println("touch 1 to play again"); } cont = console readInt(); } } }} iimport java io.*;merchandise java util.*;public class GuessingGame{ public static void main ( String [] args ) { int cont = 1; while (cont == 1) { ConsoleReader console = new ConsoleReader( System in ); // Sets up a method for us to generate a random be. Random generator = new Random (); // Generates a random number 1-100 int be = 1 + generator nextInt( 100 ); // The variable in which the users guess will be stored int guess; for (int i = 0; i < 5; i++) { System out println("Enter anticipate " + i + ":"); // Stores the user input into 'anticipate' guess = console readInt(); /* Compare the users answer to the number and let them know if they are close too high or too low. */ if ((anticipate < 0) || (guess > 100)) { System out println("Sorry but your guess " + i + " must be from 0 to 100."); } else if (guess < be) { System out println(guess + " is lower. TRY A HIGHER number"); } else if (anticipate > be) if (be - guess < 10) { System out println("You are close but comfort a little low"); } else if (anticipate > number) { System out println(anticipate + " is higher. TRY A displace number"); if (anticipate - be < 10) { System out println("You are change state but still a little high"); } } if (anticipate == be){System out println("That is change by reversal");break;}}{System out println("touch 1 to play again");cont = 0;cont = console readInt();} }}} Advertisements do not evince our endorsement of that product or service. All times are GMT -4. The measure now is 02:39 PM. Copyright © 1996 - 2007 TechGuy. Inc. All rights reserved.

Forex Groups - Tips on Trading

Related article:
http://forums.techguy.org/showthread.php?t=623169&goto=newpost

comments | Add comment | Report as Spam


"Creating a simple rules engine using the Java scripting API" posted by ~Ray
Posted on 2007-10-28 11:41:43

creates a simple rules engine using the Java scripting API. Business rules,written in a combination of Ruby. Groovy and JavaScript,cause whether a borrower qualifies for a variety of home loans. I used a rules engine as a consume application because it seemed more compellingthan another hello-world application,and it also seemed like an interesting use of the scripting API. The,also known as,works as a viable basis for awhen a full-blown business rules engine isn't neededbecause it offers several of the benefits you get from using a regular rules engine. For instance,when business rules are stored as external scripts,the scripting API: The Java scripting API fulfills those design goals because scripting code can be keptexternal to the main Java application,and can be discovered read and invoked at run measure. These same advantages are provided by rules-engine products such as,,or. However,you conclude additional advantages by using scripting languages to hold your rulesand the Java scripting API to invoke them: rule "authorise if not rejected" salience -100 agenda-group "approval" when not Rejection() p : Policy(approved == false policyState:status) exists Driver(age > 25) Process(status == policyState) then log("APPROVED: due to no objections."); p setApproved(true);end class in part 2 of my article shows one such create by mental act. It stores business objects that the external rules ordain use in decision-making in the's context,and receives rule execution results in a displace shared Java disapprove stored in the ScriptEngine context. Rules (scripts) are responsible for storing results of their decisions in the shared Java object,which the main Java code inspects after the rules are run to cause what challenge to act. In my consume application,I use individual files to store the rules. The application scans the rules directory on each go and executes whatever rule scripts it finds there. An favor of using the Java scripting API to sight the rule scripts is the rules can bewritten in any of dozens of languages supported by. The rules engine doesn't care what language the rules are written inas desire as the applicable script engine and interpreter can be loaded at runtime,such as being supplied by JARs in the classpath. In my sample,I coded rules in,,and Ruby. Another possible way of structuring rule logic would be to undergo the rules themselvesset additional attributes that other rules could then use (that is learn from). For instance,say one set of rules runs and determines that the prospective home purchaser has a bank balance of$10 million. The rule could set a property (a global compose variable) called (very important person)to true. As a global variable,the property would be available in the ScriptEngine context and passed along to the next rule to be run. That next command could use different logic based on the fact that this borrower is a VIP. The above example begins to reveal the shortcomings of designing a rules engine around the scripting API. Most formal rules engines undergo the notion that all rules are considered to be in effect at all measure. Setting a fact such as "customer has VIP status" in one rule should be taken into consideration by rulesto determine if that new fact changes other facts. But satisfying that feature by invoking external rules stored as scripts would require script writers to order the rulesin the proper sequence. Trying to sequence your business rules correctly to be for fact-dependencies is error prone --and impossible when the rules have mutual dependencies. This limitation of requiring rules to be run in a proper grade is certainlywhere you would want to consider using a exceed rules engine. command sequencing isn't the only disadvantage to executing rules stored as external scripts. Writing business rules in Groovy. Ruby or another scripting language has the discriminate of: In other words,the Java scripting API ordain not always bring home the bacon as the best solution when your application needs a rules engine. However,the Java scripting API allows business rules to be stored externally,to be written in a language that probably is easier to read than Java,and lets the rules change regularly and fairly easily without having to build your application. If you don't object writing your business rules in a procedural language instead of a dedicated,declarative rules language,the scripting API could be a good solution. It fills the gap between those times when writing business rules as Java code inside your applicationhas gotten out of hand and when graduating to a fully fledged rules engine isn't yet necessary. If you're trying to end whether your application calls for a dedicated rules engine,the Jess website has a good article,. Wednesday September 12. 2007 Sure now you create verbally an article about it. Over last two weeks I put together a demo that showed rule engine and scripting as options to externalize and bring home the bacon application business logic. I used drools for command engine option and groovy for.

Forex Groups - Tips on Trading

Related article:
http://www.mcqueeney.com/roller/page/tom?entry=creating_a_simple_rules_engine

comments | Add comment | Report as Spam


 

 




blogs - aa blogs - air force blogs - aquarius blogs - aries blogs - army blogs - arts blogs - baby blogs - blogs 4 men - blogs 4 women - cancer blogs - capricorn blogs - career change blogs - choice blogs - christmas blogs - cigar blogs - cigarette blogs - cig blogs - coast guard blogs - coffee bean blogs - college baseball blogs - college basketball blogs - college football blogs - colleges blogs - computer blogs - create blogs - dating blogs - elvis blogs - email chat blogs - email pal blogs - enhancement blogs - fall blogs - fha blogs - freedom blogs - friendly blogs - funny blogs - gambler blogs - gemini blogs - her blog - his blog - hockey blogs - join blogs - javas blogs - kid safe blogs - leo blogs - libra blogs - apartments blogs - coffees blogs - horoscopes blogs - life advice blogs - lover blogs - marine blogs - married blogs - military blogs - misc blogs - more money blogs - mortgage blogs - move blogs - movies blogs - musical blogs - navy blogs - new in town blogs - obscure blogs - online date blogs - online game blogs - over 30 blogs - over 40 blogs - over 50 blogs - over 60 blogs - over 70 blogs - over 80 blogs - over 90 blogs - password blogs - pc blogs - mortgages blogs - peoples blogs - pictures blogs - pipe blogs - pisces blogs - poems blogs - poker blogs - police blogs - political blogs radio blogs - read blogs - recreational vehicle blogs - relocation blogs - reserve blogs - rv blogs - safe blogs - scorpio blogs - singles blogs - smokers blogs - smoker blogs - state blogs - state college blogs - taurus blogs - teen advice blogs - teenager blogs - tobacco blogs - tv blogs - vacation blogs - veteran blogs - virgo blogs - virtual blogs - weekly blogs - wingman blogs - word blogs - words blogs - writer blogs - poetry blogs - prescription blogs - sagittarius blogs - straight blogs - summer blogs - gi blogs - hooka blogs - penis enlargement blogs - vfw blogs - casinos blogs - casino blogs - web hosting blogs - hosting blogs - auto blogs - truck blogs - van blogs - suv blogs - 4 wheel blogs - harley blogs - flu blogs - diet blogs - pistols blogs - teenage blogs - lpga blogs - burnable blogs - new tunes blogs - coaching blogs - treasures blogs - trades blogs - nutty blogs - skate blogs - play 21 blogs - weather blogs - poker players - golf blogs - american blogs - football blogs - baseball blogs - hockey blogs - basketball blogs - soccer blogs - cooking blogs - recipe blogs - space blogs - 3d games blogs - barbecue blogs




the java code archives:

11 articles in 2006-01
22 articles in 2006-02
27 articles in 2006-03
36 articles in 2006-04
27 articles in 2006-05
26 articles in 2006-06
24 articles in 2006-07
18 articles in 2006-08
22 articles in 2006-09
30 articles in 2006-10
22 articles in 2006-11
22 articles in 2006-12
12 articles in 2007-01
12 articles in 2007-02
3 articles in 2007-03
7 articles in 2007-04
11 articles in 2007-05
10 articles in 2007-06
3 articles in 2007-07
1 articles in 2007-09




next page


java code