Please help me with these java puzzle ?
Dear all,
My friend send me typical java puzzle about java.util.ArrayList
which is getting messy. Please help me out. It's not a homework.
Please help me with these java puzzle ?
Dear all,
My friend send me typical java puzzle about java.util.ArrayList
which is getting messy. Please help me out. It's not a homework.
import java.util.*;
public class MyInt ______ ________ {
public static void main(String[] args) {
ArrayList<MyInt> list = new ArrayList<MyInt>();
list.add(new MyInt(2));
list.add(new MyInt(1));
Collections.sort(list);
System.out.println(list);
private int i;
public MyInt(int i) { this.i = i; }
public String toString() { return Integer.toString(i); }
________ int ___________ {
MyInt i2 = (MyInt)o;
return ________;
}Hints , fill the underlines with below :
implements
extends
Sortable
Object
Comparable
protected
public
i = i2.i
i
i2.i=i
compare(MyInt o, MyInt i2)
compare(Object o, Object i2)
sort(Object o) sort(MyInt o)
compareTo(MyInt o)
compareTo(Object o)
Dear all,
My friend send me typical java puzzle aboutNotwithstanding your pathetic protestations typicial
of all your posts this is NOT a typical java "puzzle"
but is indeed a typical homework puzzle.
And it's damn easy if you spent 30 minutes with a
tutorial.
DO YOUR OWN HOMEWORK!
Hey i did it.
import java.util.*;
public class MyInt implements Comparable {
public static void main(String[] args) {
ArrayList<MyInt> list = new ArrayList<MyInt>();
list.add(new MyInt(2));
list.add(new MyInt(1));
Collections.sort(list);
System.out.println(list);
private int i;
public MyInt(int i) { this.i = i; }
public String toString() { return Integer.toString(i); }
public int compareTo(Object o){
MyInt i2 = (MyInt)o;
return i;
}E:\>javac MyInt.java
Note: MyInt.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
E:\>java MyInt
[1, 2]
Similar Messages
-
Please HELP me with installation - java.lang.noclassdeffounderror:
Please Help! For school we need to install JAVA. I installed JDK 5.0 and id did not work. I got exception in thread "main" java.lang.noclassdeffounderror: hello. I was using Texpad to write, compile, and run it. In short I deleted all JAVA 5.0 using My Computer program removal. I installed JAVA 1.4..2_10 and I am still getting that same error. I want the JAVA 1.4..2_10 to be installed and not JAVA.5.0.
My System Variable CLASSPATH still shows C:\Program Files\Java\jre1.5.0_03\lib\ext\QTJava.zip. My System Variable PATH has nothing as far as JAVA in it. MY PATHEXT has JS and JSE amoung other things in it. My System Variable QTJAVA still has Files\Java\jre1.5.0_03\lib\ext\QTJava.zip in it.
Please tell me step-by-step how I can fix this. I never updated these variables before. What do I need to type and where? What do I need to get rid of or change?
PLEASE HELP!
Thanks,
JimI left my System variable classpath --> C:\Program Files\Java\jre1.5.0_03\lib\ext\QTJava.zip I left my QT JAVA --> C:\Program Files\Java\jre1.5.0_03\lib\ext\QTJava.zip I added Path --> ;C:\j2sdk1.4.2_10\bin and then restarted my computer. I added hello file in C:\j2sdk1.4.2_10\bin and tried to compile it under a new name and it would not compile. it gave me the error below. I was able to compile other java program in my other folder in a different directory. I am still getting the same error messages/ Anything else I should try? IS there anyplace or person I can call who would come and fix this? Something is wrong. This should not be giving me this much trouble. All The Java directions on other websites tell me to do different things. I am so confused... please help.
I get this during the compilenow:
javac: invalid flag: C:\j2sdk1.4.2_10\bin\helloa.txt
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are used
-classpath <path> Specify where to find user class files
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-help Print a synopsis of standard options
Tool completed with exit code 2
Jim
If you can fix this I will give you 14 points. I hope it is enough. I just want this to work for school. -
Can someone please help me with a java assignment
Hey all,
I have a favor to ask I have a program that I need for my java class, I have the just of it but I can't figure out the rest, can anybody please help me here is the directions:
Let's revisit fibonacci numbers, looking at it as a process involving iteration and arrays. Create an array fib[] of 101 elements. Make fib[0] = 0 and fib[1] = 1. Then, in an iterative process going from 2 to 100, compute fib[k]. These numbers get quite large; make it an array of double.
Then, let the user select a number (such as 7) and have the application display the corresponding finbonacci number (in this case 13). Do this as often as the user wants. If a number larger than 100 is provided, display an error message, but don't terminate the program.
Here is what I have so far: Please add on and feel free to return to me please, thank you:
// This is an application that transforms numbers into their Fibonacci number
import javax.swing.*;
public class Fibonacci {
public static void main( String args[] ){
int k; //simple counter
int numSize; // how many numbers were entered
int theNum; // the number entered by the user
String response; //response of the user
// define the array
double fib[] = new double[ 101 ];
// read in the numbers into an array
k = 0;
response = JOptionPane.showInputDialog( "Enter the first number" );
theNum = Integer.parseInt( response );
while (theNum > 0){
if (theNum > 100)
k++;
fib [ 1 ] = 1;
fib [ 2 ] = 1;
response = JOptionPane.showInputDialog( "Enter the next number, negative to end" );
theNum = Integer.parseInt( response );
} // end while
numSize = k;
// terminate
System.exit( 0 );
}// end main
} //end class FibonacciTry this program..Hope it helps
import javax.swing.*;
public class Fibonacci
static double fib[];
public Fibonacci()
fib = new double[ 101 ];
fib[0] = 0;
fib[1] = 1;
for(int i = 2; i < fib.length; i++)
fib[i] = fib[i -1] + fib[i - 2];
public static void main( String args[] )
boolean end = true;
String response = "";
int theNum = 0;
new Fibonacci();
while(end)
response = JOptionPane.showInputDialog( "Enter the number. 999 to end" );
try
theNum = Integer.parseInt( response );
if(theNum == 999)
end = false;
else if(theNum <101)
String Message = "The Fibonacci number at "+ theNum + " is : "+ fib[theNum - 1];
JOptionPane.showMessageDialog(null, Message, "Fibonacci Number", JOptionPane.INFORMATION_MESSAGE);
else
JOptionPane.showMessageDialog(null, "Input should be less than 100", "Error", JOptionPane.ERROR_MESSAGE);
catch(NumberFormatException ex)
JOptionPane.showMessageDialog(null, "Enter Numeric values", "Error", JOptionPane.ERROR_MESSAGE);
System.exit(0);
}// end main
} //end class FibonacciVish -
Please help me with these errors...if you can...
Ok, I downloaded the Safari for windows. I start the browser and I get this message
"Safari can’t open the page “http://www.apple.com/startpage”. The error was: “unknown error” ((null):10061) Please choose Report Bugs to Apple from the Help menu, note the error number, and describe what you did before you saw this message."
Other browsers work perfectly.
The other error I have is with Itunes (I know this is not the place to post that, but if you have any idea, maybe you can help with that one too). Itunes runs fine, it tells me there is a new version of firmware for my ipod nano, when I hit update, it tells me the apple server cannot be found. My internet connection is working perfectly.
Any ideas?
Thank you in advance!
Bobby-I have been facing these very same problems (“unknown error” ((null):10061) and the i-Tunes one) and I am surprised to see that even after two months of the first posting of these problems, no apple afficiando has condescended to post a cure for us lesser souls!
There were some other posts as well posting the same problems (“unknown error” ((null):10061) ) - and all they have been advised is to go back to IE! What a shame!
Any higher apple souls listening? -
Please help me with JACOB: Java-Com Bridge
While experimenting with Jacob 1.13, I am not even able to run the sample code that comes with the source package. I get an error as below:
Exception in thread "main" java.lang.UnsatisfiedLinkError: createInstanceCan you help?
And, is there another way to access MS Word? Basically what I want to do is search and find some text in Word documents and apply some styles to it.
Thanks in advance for your advice!I am guessing that underneath the code you see, it uses the MS Word DLLs to emulate MS Word. So if you don't actually have Word installed in your machine you won't be able to do this.
-
Please help me with two Java problems
Hello,
I have 2 Java problems to work on and wondered if someone can help please?
1. I've created an array, but I have to now create a text file and write a program to read the array from the file. I have no idea where to start the program!
2.public class SumExample1 {
/* To determine if a number lies between 1 and 1000
* @param args the command line arguments
public static void main(String[] args) {
int num;
System.out.print("Enter a number: ");
num = TextIO.getInt();
if ((num >=1) && (num<=1000))
System.out.println("OK");
else
System.out.println ("Not OK");
Ive used a GUI to create some fields and buttons to press. How can I make it perform this little program?
Many thanks,
KI recommend you read the tutorials on basic (file) IO and Swing (and Event Listeners if you want to make your GUI alive). Perhaps have a look at the Scanner class and BufferedInputStream. That should give you enough to start and write the program yourself. Try working in the command prompt first, should be easier, then once the logic works wrap it in a Swing GUI.
You can find the tutorials here:
http://download.oracle.com/javase/tutorial/
Swing:
http://download.oracle.com/javase/tutorial/uiswing/index.html
Basic IO:
http://download.oracle.com/javase/tutorial/essential/io/index.html
Hope this helps.
PR -
Please Help trouble with error Java 34
I'm working on a basic program that uses JButton and JFrame for display/activity, I have been able to get the rest of the program running but I get this error when trying to Register a button event listener.
.java:34: non-static variable this cannot be referenced from a static context
createAction = new ButtonHandler();
^
The code I used to create this Button is
JButton create;
ButtonHandler createAction;
create = new JButton("Create");
createAction = new ButtonHandler();
create.addActionListener(createAction);
Does anyone know why I am getting this error? I tried removing Static from my class main declaration but then the program terminates with this error
java.lang.NoSuchMethodError: main
Exception in thread "main"
----jGRASP wedge2: exit code for process is 1.
Edited by: Grudairian on Oct 25, 2007 3:39 PMGrudairian wrote:
I'm working on a basic program that uses JButton and JFrame for display/activity, I have been able to get the rest of the program running but I get this error when trying to Register a button event listener.
.java:34: non-static variable this cannot be referenced from a static context
createAction = new ButtonHandler();
^
The code I used to create this Button is
JButton create;
ButtonHandler createAction;
create = new JButton("Create");
createAction = new ButtonHandler();
create.addActionListener(createAction);
Does anyone know why I am getting this error? I tried removing Static from my class main declaration but then the program terminates with this error
java.lang.NoSuchMethodError: main
Exception in thread "main"
----jGRASP wedge2: exit code for process is 1.
Edited by: Grudairian on Oct 25, 2007 3:39 PMWhat you are trying to do is so overwhelmingly wrong that there is absolutely no way you have any idea what you are doing. You most certainly should not be trying to build GUI applications; have you gone through the Sun tutorial? Do you understand what the static (notice that it is all lowercase, because java is a case sensitive language) keyword means? How about the "this" keyword? Do you know what an instance is? Do you know the difference between a class and an object? If the answers to ANY of those questions is "no", then you need to go through the basic java tutorial:
http://java.sun.com/docs/books/tutorial/ -
Please help me with the following two questions, very urgent
Hi All,
Please help me with some scenerios about what are the common problems when modifying a standard script such a standard Invoice script and how can we overcome them.
What are the common problems encountered when working with SAP SMARTFORMS and how to overcome them?
Please help me with these questions, its very urgent.
Thanks in advance.
MD.hi
hope it will help you.
reward if ehlp.
How to create a New smartfrom, it is having step by step procedure
http://sap.niraj.tripod.com/id67.html
step by step good ex link is....
http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Build_SMARTFORMS/How_To_Build_SMARTFORMS.html
Here is the procedure
1. Create a new smartforms
Transaction code SMARTFORMS
Create new smartforms call ZSMART
2. Define looping process for internal table
Pages and windows
First Page -> Header Window (Cursor at First Page then click Edit -> Node -> Create)
Here, you can specify your title and page numbering
&SFSY-PAGE& (Page 1) of &SFSY-FORMPAGES(Z4.0)& (Total Page)
Main windows -> TABLE -> DATA
In the Loop section, tick Internal table and fill in
ITAB1 (table in ABAP SMARTFORM calling function) INTO ITAB2
3. Define table in smartforms
Global settings :
Form interface
Variable name Type assignment Reference type
ITAB1 TYPE Table Structure
Global definitions
Variable name Type assignment Reference type
ITAB2 TYPE Table Structure
4. To display the data in the form
Make used of the Table Painter and declare the Line Type in Tabstrips Table
e.g. HD_GEN for printing header details,
IT_GEN for printing data details.
You have to specify the Line Type in your Text elements in the Tabstrips Output options.
Tick the New Line and specify the Line Type for outputting the data.
Declare your output fields in Text elements
Tabstrips - Output Options
For different fonts use this Style : IDWTCERTSTYLE
For Quantity or Amout you can used this variable &GS_ITAB-AMOUNT(12.2)&
5. Calling SMARTFORMS from your ABAP program
REPORT ZSMARTFORM.
Calling SMARTFORMS from your ABAP program.
Collecting all the table data in your program, and pass once to SMARTFORMS
SMARTFORMS
Declare your table type in :-
Global Settings -> Form Interface
Global Definintions -> Global Data
Main Window -> Table -> DATA
Written by : SAP Hints and Tips on Configuration and ABAP/4 Programming
http://sapr3.tripod.com
TABLES: MKPF.
DATA: FM_NAME TYPE RS38L_FNAM.
DATA: BEGIN OF INT_MKPF OCCURS 0.
INCLUDE STRUCTURE MKPF.
DATA: END OF INT_MKPF.
SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.
SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.
MOVE-CORRESPONDING MKPF TO INT_MKPF.
APPEND INT_MKPF.
ENDSELECT.
At the end of your program.
Passing data to SMARTFORMS
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZSMARTFORM'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = FM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
if sy-subrc <> 0.
WRITE: / 'ERROR 1'.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
call function FM_NAME
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
GS_MKPF = INT_MKPF
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
Smartform
you can check this link here you can see the steps and you can do it the same by looking at it..
http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Build_SMARTFORMS/How_To_Build_SMARTFORMS.html
SMARTFORMS STEPS.
1. In Tcode se11 Create a structure(struct) same like the Internal table that you are going to use in your report.
2. Create Table type(t_struct) of stracture in se11.
3. In your program declare Internal table(Itab) type table of structure(struct).
4. Define work area(wa) like line of internal table.
5. Open Tcode Smartforms
6. In form Global setting , forminterface Import parameter define Internal table(Itab) like table type of stracture(t_struct).
7. In form Global setting , Global definitions , in Global data define Work area(wa) like type stracture(struct).
8. In form pages and window, create Page node by default Page1 is available.
9. In page node you can create numbers of secondary window. But in form there is only one Main window.
10. By right click on page you can create windows or Go to Edit, Node, Create.
11. After creating the window right click on window create table for displaying the data that you are passing through internal table.
12. In the table Data parameter, loop internal internal table (Itab) into work area(wa).
13. In table there are three areas Header, Main Area, Footer.
14. Right click on the Main area create table line by default line type1 is there select it.
15. Divide line into cells according to your need then for each cell create Text node.
16. In text node general attribute. Write down fields of your work area(wa) or write any thing you want to display.
17. Save form and activate it.
18. Then go to Environment, function module name, there you get the name of function module copy it.
19. In your program call the function module that you have copied from your form.
20. In your program in exporting parameter of function pass the internal table(itab).
SAP Smart Forms is introduced in SAP Basis Release 4.6C as the tool for creating and maintaining forms.
SAP Smart Forms allow you to execute simple modifications to the form and in the form logic by using simple graphical tools; in 90% of all cases, this won't include any programming effort. Thus, a power user without any programming knowledge can
configure forms with data from an SAP System for the relevant business processes.
To print a form, you need a program for data retrieval and a Smart Form that contains the entire from logic. As data retrieval and form logic are separated, you must only adapt the Smart Form if changes to the form logic are necessary. The application program passes the data via a function module interface to the Smart Form. When activating the Smart Form, the system automatically generates a function module. At runtime, the system processes this function module.
You can insert static and dynamic tables. This includes line feeds in individual table cells, triggering events for table headings and subtotals, and sorting data before output.
You can check individual nodes as well as the entire form and find any existing errors in the tree structure. The data flow analysis checks whether all fields (variables) have a defined value at the moment they are displayed.
SAP Smart Forms allow you to include graphics, which you can display either as part of the form or as background graphics. You use background graphics to copy the layout of an existing (scanned) form or to lend forms a company-specific look. During printout, you can suppress the background graphic, if desired.
SAP Smart Forms also support postage optimizing.
Also read SAP Note No. 168368 - Smart Forms: New form tool in Release 4.6C
What Transaction to start SAP Smart Forms?
Execute transaction SMARTFORMS to start SAP Smart Forms.
Key Benefits of SAP Smart Forms:
SAP Smart Forms allows you to reduce considerably the implementation costs of mySAP.com solutions since forms can be adjusted in minimum time.
You design a form using the graphical Form Painter and the graphical Table Painter. The form logic is represented by a hierarchy structure (tree structure) that consists of individual nodes, such as nodes for global settings, nodes for texts, nodes for output tables, or nodes for graphics.
To make changes, use Drag & Drop, Copy & Paste, and select different attributes.
These actions do not include writing of coding lines or using a Script language.
Using your form description maintained in the Form Builder, Smart Forms generates a function module that encapsulates layout, content and form logic. So you do not need a group of function modules to print a form, but only one.
For Web publishing, the system provides a generated XML output of the processed form.
Smart Forms provides a data stream called XML for Smart Forms (XSF) to allow the use of 3rd party printing tools. XSF passes form content from R/3 to an external product without passing any layout information about the Smart Form.
SmartForms System Fields
Within a form you can use the field string SFSY with its system fields. During form processing the system replaces these fields with the corresponding values. The field values come from the SAP System or are results of the processing.
System fields of Smart Forms
&SFSY-DATE&
Displays the date. You determine the display format in the user master record.
&SFSY-TIME&
Displays the time of day in the form HH:MM:SS.
&SFSY-PAGE&
Inserts the number of the current print page into the text. You determine the format of the page number (for example, Arabic, numeric) in the page node.
&SFSY-FORMPAGES&
Displays the total number of pages for the currently processed form. This allows you to include texts such as'Page x of y' into your output.
&SFSY-JOBPAGES&
Contains the total page number of all forms in the currently processed print request.
&SFSY-WINDOWNAME&
Contains the name of the current window (string in the Window field)
&SFSY-PAGENAME&
Contains the name of the current page (string in the Page field)
&SFSY-PAGEBREAK&
Is set to 'X' after a page break (either automatic [Page 7] or command-controlled [Page 46])
&SFSY-MAINEND&
Is set as soon as processing of the main window on the current page ends
&SFSY-EXCEPTION&
Contains the name of the raised exception. You must trigger your own exceptions, which you defined in the form interface, using the user_exception macro (syntax: user_exception <exception name >).
Example Forms Available in Standard SAP R/3
SF_EXAMPLE_01
Simple example; invoice with table output of flight booking for one customer
SF_EXAMPLE_02
Similar to SF_EXAMPLE_01 but with subtotals
SF_EXAMPLE_03
Similar to SF_EXAMPLE_02, whereby several customers are selected in the application program; the form is called for each customer and all form outputs are included in an output request
Advantages of SAP Smart Forms
SAP Smart Forms have the following advantages:
1. The adaption of forms is supported to a large extent by graphic tools for layout and logic, so that no programming knowledge is necessary (at least 90% of all adjustments). Therefore, power user forms can also make configurations for your business processes with data from an SAP system. Consultants are only required in special cases.
2. Displaying table structures (dynamic framing of texts)
3. Output of background graphics, for form design in particular the use of templates which were scanned.
4. Colored output of texts
5. User-friendly and integrated Form Painter for the graphical design of forms
6. Graphical Table Painter for drawing tables
7. Reusing Font and paragraph formats in forms (Smart Styles)
8. Data interface in XML format (XML for Smart Forms, in short XSF)
9. Form translation is supported by standard translation tools
10. Flexible reuse of text modules
11. HTML output of forms (Basis release 6.10)
12. Interactive Web forms with input fields, pushbuttons, radio buttons, etc. (Basis-Release 6.10) -
Very Urgent Please Help Me with XML parsing(DOM parser)
Hi
Please help me with the following code.
I have an XML file
<catalog>
<book id="101">
<title>First Ex With ID 101</title>
<ID>500</ID>
<author>RAJU</author>
<price>39.95</price>
</book>
<book id="121">
<ID>501</ID>
<title>First Ex With ID 121</title>
<author>RAJU1</author>
<price>19.95</price>
</book>
</catalog>
By using DOM parser I have to retrive ID values .After getting this ID values i have to pass these values in someother method of someother class.What i suppose to do?Can anyone help me with this regards ,if possible plese write the code..
Regards
Raju GWell first up all create a parser class where u parse the document using DOm and get the id node and assigen it to a String sat str.
Now whatever processiong u want to do , u write in a separate class (say Process.java) in one method say doProcess(String str)
Now from parser class u just call the doProcess() method with passing str as a parameter.
eg.
Process p = new Process();
p.doProcess(str);
Hope this will help u.
....yogesh -
Hello, Honestly I just updated my 4s and my iPad 3 to iOS 6 and when try to press on the Music app or the iTunes app it says "cannot connect to iTunes Store" Could you please help me with this thank you so much, Charbel from Lebanon
See these previous discussions help.
App Store Updates (but only Updates)...: Apple Support Communities
Apps suddenly don't update: Apple Support Communities -
Please help me with an error 1418...
OK I have iPod mini 4GB and I have the latest iTunes installed 7.02 or something I don't know anymore.
Anyway a sad iPod icon displayed on my screen a few days ago and I managed to restart it and to put it in a disk mode and then iTunes finally recognized iPod and I clicked on Restore and then Restore and Updated and after a few seconds during the restore process it says:
An iPod 'iPod' couldn't be resoterd. An unknown error occurred (1418).
I am desperate and i don't know what to do.
I read almost everything about this but nothing helped.
Please help me with any kind of solution...I did a Support Search for that error number and this is what I got. I hope one of these links helps:
http://docs.info.apple.com/article.html?artnum=304508
http://docs.info.apple.com/article.html?artnum=304996 -
Please help me with the homework given to me by my teacher
hello,i am new in java programming please help me with the home work given to me by my teacher at school, help me to build an interface that can work with this code.i can build an interface but i dont just understand this code.
//references:
//http://forums.techguy.org/development/570048-need-write-java-program-convert.html
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
public class Translate
public static void main(String [] args) throws IOException
if (args.length != 2)
System.err.println("usage: Translate wordmapfile textfile");
System.exit(1);
try
HashMap words = ReadHashMapFromFile(args[0]);
System.out.println(ProcessFile(words, args[1]));
catch (Exception e)
e.printStackTrace();
// static helper methods
* Reads a file into a HashMap. The file should contain lines of the format
* "key\tvalue\n"
* @returns a hashmap of the given file
@SuppressWarnings("unchecked")
private static HashMap ReadHashMapFromFile(String filename) throws FileNotFoundException, IOException
BufferedReader in = null;
HashMap map = null;
try
in = new BufferedReader(new FileReader(filename));
String line;
map = new HashMap();
while ((line = in.readLine()) != null)
String[] fields = line.split("\\t", 2);
if (fields.length != 2) continue; //just ignore "invalid" lines
map.put(fields[0], fields[1]);
finally
if(in!=null) in.close(); //may throw IOException
return(map); //returning a reference to local variable is safe in java (unlike C/C++)
* Process the given file
* @returns String contains the whole file.
private static String ProcessFile(Map words, String filename) throws FileNotFoundException, IOException {
BufferedReader in = null;
StringBuffer out = null;
try {
in = new BufferedReader(new FileReader(filename));
out = new StringBuffer();
String line = null;
while( (line=in.readLine()) != null ) {
out.append(SearchAndReplaceWordsInText(words, line)+"\n");
} finally {
if(in!=null) in.close(); //may throw IOException
return out.toString();
* Replaces all occurrences in text of each key in words with it's value.
* @returns String
private static String SearchAndReplaceWordsInText(Map words, String text) {
Iterator it = words.keySet().iterator();
while( it.hasNext() ) {
String key = (String)it.next();
text = text.replaceAll("\\b"+key+"\\b", (String)words.get(key));
return text;
* @returns: s with the first letter capitalized
String capitalize(String s)
return s.substring(0,0).toUpperCase() + s.substring(1);
}... here's the head of my pirate_words_map.txt
hello ahoy
hi yo-ho-ho
pardon me avast
excuse me arrr
yes aye
my me
friend me bucko
sir matey
madam proud beauty
miss comely wench
stranger scurvy dog
officer foul blaggart
where whar
is be
are be
am be
the th'
you ye
your yer
tell be tellin'Heres your answer. Run it in on your pc.
public class Annoy
public static void main(String[] args)
System.out.println("I am a triple poster.");
System.out.println("I can not understand why I can not understand the help I have receved to date on the java forums.");
} -
Please help me with user-exits or baids for TCode : FOE2 & FOE1
Hi Experts
Please help me with user-exits or baids for TCode : FOE2 & FOE1.
I found these but not picking values from VIMI01,VIOB03 and VIOB41.
User-exits
FVCH0001 CH-specific enhancements: Esp. POR
ISRE0001 Determine bank procedure account no.
ISRE0002 IPD reporting data retrieval
Business Add-in
FVD_HANDLE_FORMULA Processing of Condition FormulasHi,
ASk your basis regarding the CI_CSKB table active issue, and first of all i dont see any table with the name CI_CSKB.
And check this exit-COOMKS03 whether it works for your screen exits.
Cheers!!
VEnk@
Edited by: Venkat Reddy on Nov 4, 2008 5:59 PM -
Please help me with spry bar menu
I have laid out my page with the div tags in Dreamweaver. I defined the different sections by putting colors in them until i am ready to put stuff into them however when i insert the spry menu bar into my navigation section, the area below it is behaving like a drop down box of color. What i mean is that the area below which is supposed to stretch from left to right as a single box is now broken up by a different color box the width of the spry bar and goes down to the next box. When i preview it in the browser the page appears normal. How can i get rid of the intruding box in dreamweaver.
HI
I am practicing for the webmaster design course pratical exam. The web page i will be asked to construct will consist of a home page with two or three other pages pages in the site it will have to link to. I know how to do most of the steps individualy but i do not know in what order some of them are done. What i mean is this. ... after setting up the root folder..images..laying out the divs .. i would like to know ... at what point do i do the various things like, set up a styles folder...make a template... make the other pages of the site ..etc. I think i am able to do nearly all of these things but not sure in what order they should be done so the site will work.
I have reached the point where i have established the site and layout, i.e. the wrapper, logo, navigation,header,bodycontent,right and left columns, clearbar, footer. i would like someone to list the sequence i should follow after this. I am praticing on a trial CS5.5 which seems to simplfy to a freat extent what we learned on the course because it is a later version. The version we used on course was CS4 and if the pratical is in this version then i will need to know how it is done in this format.
Date: Sun, 22 Jan 2012 17:45:18 -0700
From: [email protected]
To: [email protected]
Subject: Please help me with spry bar menu
Re: Please help me with spry bar menu created by Nancy O. in Dreamweaver - View the full discussion
If this only happens in DW Design View, use Live View or turn off your CSS display.
View > Style Rendering > un-tick Display Styles.
Nancy O.
Alt-Web Design & Publishing
Web | Graphics | Print | Media Specialists
http://alt-web.com/
http://twitter.com/altweb
Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4157994#4157994
To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4157994#4157994. In the Actions box on the right, click the Stop Email Notifications link.
Start a new discussion in Dreamweaver by email or at Adobe Forums
For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746. -
i want to create org data profile in service scenario, with price determination from sales org, distribution centre , can any one help me with these
IF I CREATE SERVICE ORG WITH SERVICE SCENARIO ORG DATA PROFILE,
MY PRICING IS NOT GETTING DETERMINED AS IT IS LINKED TO SALES ORG AND DISTRIBUTION CHANNEL THROUGH PRICING DETERMINATION SO HOW TO DO THE CUSTOMIZATION FOR THIS SITUATION
WITH REGARDS,
SATHISHHi Satish,
Please assign the org det. rules to org det. profile with Sales and Service scenarios and then assign the org. det. profile to transaction type. The below screenshot is just for your reference.
Hope it would fix your issue.
Regards,
Maybe you are looking for
-
Five Multiple choice Questions
1. What is the aim of aggregates? This question has more than one answer. a. Balance of cost of aggregate b. Maintenance to the cost of data retrieval c. Reduce data storage requirements d. Increase query performance e. None of the above 2. In which
-
Please, please help! Photos in library disappearing before my eyes.
When I open up the iphoto library, my picture thumbnails disappear one after the next--from seemingly random places, though mostly on the right hand side)--before my eyes. My worry is that I am going to loose all my photos. History: I have never had
-
How to prevent the replication of service order from CRM to R/3
Hi, I create a service order and it displays in SMW01. Does it mean that system tries to replicate it from CRM to R/3? I have deleted the subscription in SMOEAC while publication of BUS_TRANS_MSG can't be deleted. Is there any other configuration af
-
I have a 800 MHz G4 iBook with 640 MB of RAM running OS 10.3.9. It is a month or two shy of three years old. The computer (my first Mac) is still in great shape and works fine for nearly everything I do. However, when I do things like import a video
-
White Screen No Graphics in Game ... Help !!!!!
I just installed Leopard (w/total reformat) and Boot Camp. When I install Call of Duty 2 (PC) the game loads and gives me everything except the graphics to the game??? DIrectX is updated to latest version yet I get no graphics! The sound, map, contro