Christopher Nortje

Greenhorn
+ Follow
since Jul 09, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Christopher Nortje

Clearly you did not read what I suggested you read.
You can try any variation of escape sequences it won’t work.
If you really need to write only c:\\tmpdir then use:
13 years ago
The colon is used as an optional separator for key value pairs.
Have a look at the API (load method), when you load the input into the properties file you would get your original value back.
http://download.oracle.com/javase/1.4.2/docs/api/java/util/Properties.html
have a look at the list method.
13 years ago

A method that declares a return type (in your case a String) can only return one value.
You should concatenate the values and return a single String.
The compiler is warning you that the JVM won’t reach the second return statement

because as soon as the first return is reached the execution would stop for that method and return to the caller.
Have a look at java return value.
http://download.oracle.com/javase/tutorial/java/javaOO/returnvalue.html
13 years ago
Just add a newline (line feed) character instead of the space " " use "\n"
13 years ago

But the application is a console, I just have one System.out to print reports :-)


Why don't you just write to the OutputStream directly instead of building up a StringBuffer. If you’re not manipulating the String you’re just wasting memory.

Something like this should drastically reduce your memory requirements. You could pass System.out as the OutputStream parameter.
Before I forget make sure that you synchronize the write to System.out, you don’t what anther thread writing to System.out while you’re in the middle of writing a document.
13 years ago
If the input is "Shirt @ 2" and you split using "@" you would have an array like this:
qty1[0] ="Shirt ";
qty1[1] =" 2";
You need to access the second value at the second index instead of the first:
Example
qty1[1]
Remember to trim() your String as your numeric value contains a space.
13 years ago
Hi you can't force the JVM to return the memory to the OS directly, you can change the min and max heap size that is allocated to that java instance.
Just look at the JVM arguments for your JVM example:
-Xms128m -Xmx256m (min and max heap size).
-Xms<memory_size> Sets the initial amount of memory allocated to the Java heap.
-Xmx<memory_size> Sets the maximum amount of memory allocated to the Java heap.
Please note that in your case you are using up memory and freeing the memory that has been allocated to the JVM not the OS directly.
It seems like you are starting up three different java processes, they all have memory allocated to them, they don't share that memory.
Can't you use the same java process and spawn new thread for each file that you would like to process?
Have a look at “Tuning Garbage Collection” for your relevant JVM.
13 years ago
When people discuss String GC and memory the following comes to mind.
Might be worth while reading this.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4513622
13 years ago
Aggregate the data, instead of reporting every 5 second report ever X amount of minutes. Unless the graph is HUGE the users won't be able to notice that the data has been aggregated. If the need to drill down onto seconds just re render the chart with that data set (filter data for example that day).
13 years ago
Remember that System.out is an variable the refers to an OutputStream, so just write to the stream as soon as the "text" become available.
13 years ago
It depends on the reason why you need to navigate from one web app page to another web app’s page. If they are highly dependent on each other you could restructure your project as multiple modules and package it as a single application (this allows you to have a shared session). An alternative would be to pass context as part of the URL. If no context needs to be passed you could simply redirect to another application page. Could you provide an example?
Are these portlets on tomcat, what portal are you using (liferay on tomcat)?
13 years ago
The most common technology used to integrating with 3rd party applications is by Web Services.
Since the booking process is the core part of the hotel application, you would have them expose a secure web service with operations that allow you to perform a booking.
Example of these operations would be:
get all suites (retrieves a list of suites)
get availability (this allows you to identify the availability of a suite)
reserve suite (reserves a suite for customers, payment is unconfirmed)
confirm reservation (confirms that payment has been made)

Yes payment can be made via a payment provider; the provider would have a payment service that you should be able to use. The travel app is only acting as an intermediary, if commission to travel app is applicable you should negotiate the terms with the hotel and establish how commission would be payed back to travel app; either after the fact or whether the payment should be made to the travel app and then the travel app would pay the hotel.

design patterns involved


This highly depends on your interaction with other systems.

Things to think about: make sure that the customer has been authenticated, you don't want bookings to be made and customer not paying for the suite, leaving the hotel fully reserved with no one staying at the hotel.
13 years ago
Hi Hai,

When you create a primitive array and specify the length, you are basically saying this array has X amount of values.
Example:

you are expressing the the array named card has 13 values.

The first value of an array is always at index 0
Example:

The last value of an array is always at index (length - 1)
Example:


In your case you need to increase your card size to 15, since your adding to the 14th index.
Example:


The same goes for your suits, even though your only adding four values to that array, your starting at the second index suits[1] and ending at an unallocated index of suits[4], you would have to increase your suit size to 5.

your application is most likely throwing an java.lang.ArrayIndexOutOfBoundsException
See http://download.oracle.com/javase/1.4.2/docs/api/java/lang/ArrayIndexOutOfBoundsException.html

Have a look at this tutorial java arrays, this explains it in more detail.
http://download.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html

Also note each time the method is executed that array is created.
If your using java 1.5 or greater you could read up on java enumeration.
http://download.oracle.com/javase/tutorial/java/javaOO/enum.html
13 years ago
Hi Brendon,
Could you please elaborate:

How are you integrating with these providers, are these “hotel's application” Web Services?

What is your main concern, determining what service to call (selecting the correct provider)?

The payment mechanism depends on what service has been provided to you.

Not sure on what you are asking here.
13 years ago