~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Yes, as already mentioned, they can be found in the bin directory of your JDK. Plus, let's not forget the overhead for each object, the native libraries linked to the JVM executable, the thousands of .class files loaded etc.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Not directly related to the content but I'll "get if off my chest" anyways. We need an easy way to access past newsletters and a pretty visible link at the top so that new members can click and read some old stuff, interviews etc. I think that this feature has been missing for quite some time.

And to be a bit more on-topic, I think a brief extract/gist of the latest and greatest discussions which happen in the community feedback forum, area 51 needs to go in that newsletter to make it a bit more spicy (please do ignore is this is already the case).

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

/me checks his left shoulder

Damn, I'm old...

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Sorry to be a party-pooper but the changes don't look good enough. Not sure how it looks on your computer, but on mine, the profile looks pretty bland. There is no visual difference between the item (e.g. Join Date) and its corresponding value (e.g. 6 years ago). Maybe have the keys be shown in a different font/style from the corresponding values?

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Reinventing oneself after 10 years doesn't sound that bad. ;)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You need to post the entire self-contained code which can be used to re-produce the issue. I really see no reason why nested elements wouldn't work.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

^ +1; what this guy said.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Suppose I want retrieve values froma table that are greater than 10, should I first store all the values in a list and then check condition of ">10" using any language or should I just just retrieve all values directly from databse using query :

Almost always the latter. Let's consider a scenario:

  • You write the code to load in all the values from the table into your program memory
  • It works great for a couple of hundred rows so you leave it as it is
  • The number of rows in your table keep growing from a few hundred to thousands
  • Now, just for a single request you need to load the entire table in memory and perform the filtering
  • The number of clients keep increasing and suddenly BOOM :)

The problems with loading everything in-memory are:

  • Memory issues for all practical purposes which result from loading everything in-memory
  • Increased I/O cost which will basically lock up a connection till the entire data is transferred from the database server to the client

You shouldn't shy away from off-loading the processing to a database since pretty much every industry strength database (PostgreSQL, Oracle etc.) handles heavy row crunching/processing like a champ esp with indexes enabled on selected columns. Processing stuff at the data source is almost always efficient rather than bringing the data to a new location (a different process / machine) and then processing it.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

After searching around a bit, it seems that there are weird issues related to SQLite JDBC working fine on 32 bit Windows but not on 64 bit. Also, noteworthy is the point that the LIB file packaged inside the sqllite JAR is compiled against 32 bit Windows.

I would suggest either trying out a different driver or making sure you don't open up two simultaneous connections which result in this exception.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

free command is IMO not a good way to measure total memory in use since it also includes the "garbage" currently held by the VM before GC. Plus if no max or min heap sizes are provided, then the JVM will reserve a certain amount of memory in advance which depends on the architecture/OS. Also notice that it's not just 400K strings but also the assisting data structures like Node instances which are created during the lifetime of the application. If you want to be really sure, make sure you put a limit on the maximum memory used by your application by using the -Xmx JVM switch; initially set it to 100 MiB.

For proper profiling you need to either use the management extensions of Java (JMX memory bean) or an external tool like Visual VM which exists inside the JDK bin directory starting Java 5+.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Can you give me more information about how to get Tomcat log files that contain the entire stack trace. Which diercory should I look into?

The Tomcat logs are in the "logs" directory inside the Tomcat installation.

As to directory struction of any JBuilder project, it has been working with Tomcat 3.2 and 4.0, and 6.0.18. It should work under 7.0.28, isn't it?

Ideally it should, but it doesn't seem to be. I think JBuilder team is the only one who can authoritively answer as to why this isn't working as expected and provide a fix/workaround. Also, have you tried replacing Tomcat 7 with Tomcat 6 and checked if it still works?

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

There is no entire stack trace for the exception

An exception always carries the entire stack trace. If not on the console, it's getting logged to some Tomcat log file. Anyways, with the single file you posted along with the short trace, the only obvious problem I see is that Apache Ant libraries are missing from the runtime classpath (though the question as to why they are required still remains). One suggestion might be to try this deployment outside JBuilder (manually create a web application directory structure), copy it to Tomcat's webapp directory and then try to run your application.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Nothing suspicous in the code itself apart from the non-standard imports for which I assume you have already added the JAR's to the classpath. Can you post the entire stack trace for the exception which occurs when compiling the JSP without trimming anything?

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

What are the contents of your JSP file?

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

JBuilder has different directory structure of web applications from other IDEs. It works in Tomcat 3 and 4. There should be a way to work it out in Tomcat 7, correct?

I'm afraid that's a question more suited for the JDeveloper support forums.

Another example is IBM RAD (Rational Application Developer). It has directory structure as follows:

That's the IDE project directory structure; when you deploy an application to the servlet container, it has to conform to the servlet specification. In case of RAD, it's quite possible that it copies the contents inside the WebContent directory without copying the directory itself.

You need to have a look at the directory structure of your deployed application which exists in Tomcat to understand what funny stuff JDeveloper does under the hood after deploying your application.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

IIRC, the Scanner class is notorious for consuming insane amount of memory due to it's regex based implementation and other implementation details. Try replacing it with a simple BufferedReader when reading the file contents.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Too little information to actually help you out:

  • Which Java version?
  • Which database and what version?
  • Which database driver are you using?
  • Is it possible for you to post the exact stack trace?
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The project structure seems problematic and definitely doesn't resemble a regular web app. A normal web app looks like:

app/index.jsp
app/WEB-INF/web.xml
app/WEB-INF/classes

If you want to access FileUpload.jsp, it should be accessible if you add defaultroot after whoznextdoor in the URL though that would be really ugly or maybe add a redirection in the web.xml file.

I'd strongly recommend following the Java EE 5 tutorial if you want to learn about good JSP practices and an IDE like Eclipse. Also, have a look at how they structure their sample applications.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

And i assume the suggestions have the same problem?

No, really. Right now your code is inefficient and complicated because:

  • You are reading the entire file in memory; this is obviously going to cause problems in case multiple clients request several big files concurrently which would result in an OutOfMemoryError
  • If your only aim is transfer a file, there are simpler ways of knowing when a file ends; the trick is that read returns -1 when there is no more data to be read.
  • The actual code/algorithm is much simpler that what you have right now:

    • When client requests a file, open the file using FileInputStream on the server
    • Create an intermediate buffer as I have in my sample code snippet posted in my previous post
    • Keep reading data from the file input stream by passing in the buffer.
    • If there is more data to be read, read method call will always return the number of bytes read from the file. If end of file is reached, read returns -1 in which case you know you need not read any further.

Changing the code which you have should be as simple as just using the copy method on both the client and server piece of code. The only difference is where you get those streams from. In the case of client, the InputStream will be the input stream from the Socket which you created and the OutputStream will be the output stream for the new …

Krokcy commented: Informative, concise and understanding. +1
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Per your suggestion, I also tried http://localhost:8080/whoznextdoor/FileUpload.jsp, it does not render the web page based upon the JSP file, either. Nothing came up.

One possible case of blank page is when the JSP blows up when it is been rendered. You'll have to hunt the log files and look at the console logs. Or maybe you need to add an indication in your JSP, something like printing "hello" to sysout when the JSP is hit.

Any other suggestions?

One possible solution would be to ditch the JBuilder for the time being and deploy the project to Tomcat manually. This will help us know whether it's the JBuilder doing something strange or a problem with your project. Also, you still haven't posted the directory structure of your web application...

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The code you posted is extremely confusing and doesn't make a whole lot of sense. What is numArrays? Why are you looping that many times? Why is each loop converting the file to an array? Why are you writing length to the stream on every iteration? Is that outDataStream variable of type DataOutputStream? If yes, why not simple OutputStream which you get from the established socket connection?

Also, more importantly, have you incorporated the suggestions provided in the thread which simply transfer across the data from one stream to another without assuming the file size and by using a single byte array?

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I have attached the full message that comes in my console.

I don't see any attachments?

I am trying to hit the URL http://localhost:8080/FileUpload.jsp.

Are you sure that's the right URL to be invoked? Don't you need the application name in there, something like http://localhost:8080/myapp/FileUpload.jsp? How would the servlet engine know which application's FileUpload.jsp to invoke?

I am not sure what you mean by the structure of my project in Tomcat. Can you elaborate?

I'm assuming that you are copying the project to the webapps directory of tomcat in which case you need to tell me the directory structure of how your project looks like.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

My JSP does not come up engined by the web server as usual due to that warning message

Like I mentioned, it is just a warning message and shouldn't affect normal execution of JSP's/Servlets. The problem must lie somewhere else. Have you looked at all the log files and the logging done on the console? What is the URL you are trying to hit? What is the structure of your project which is deployed in Tomcat?

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

This is not an error but just a warning message that the parameter -nonaming is not supported by the Bootstrap class as you can see from the source code. Any problems you are facing because of this?

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

At the moment i'm not using buffered streams. I have never worked with them before. Should i use buffered streams for the network streams as well or just the file I/O?

I havn't been able to find another way to load the file than the Files.readAllBytes(Path) which doesnt allow me to split it up.

Reading the entire file in-memory is almost always a bad solution unless you always know you are dealing with really small files; streaming is the way to go. The de-facto solution is the one mentioned by James; have a small buffer which reads data from source and writes it to the destination. A helper method which might find helpful is:

public static long copy(InputStream from, OutputStream to, int bufsz) throws IOException {
    final byte[] buf = new byte[bufsz];
    long total = 0;
    int len = -1;
    while ((len = from.read(buf)) != -1) {
        to.write(buf, 0, len);
        total += len;
    }
    return total;
}

There are of course other efficient ways of doing it if you are really hard-pressed for performance (using Java NIO) but are a bit complicated.

I dont know how slow it acually is. It took about 12min+- to send a 75mb file from my harddisk to a flash drive...

I/O operations on flash drives are dog slow when compared to regular disk I/O hence the slowdown. But FWIW, sending across 70 MiB of file from disk to flash drive took me around 2:30 mins. Your code is …

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I may be mistaken but I believe you have to by QT

Jim, Qt has dual licensing of which one is LGPL which in turn in quite suitable for developing proprietary applications. The Python binding for Qt, PySide is again licensed under LGPL so developing with Qt (QtCreator) + PySide doesn't cost you anything. But I do agree that it doesn't buy you a lot if you are conversant with VB.NET and are free to use your language/tools of choice.

The first actual GUI app I developed was a Load Advisory Program for our control centre (in C under OS/2). No tools, and all GUI elements had to be coded by hand. It was brutal

TBH, I have always found UI development to be a bit brutal with varying levels of brutality depending on the toolkit you use. The trick IMO is to get into a comfortable zone with a few of them to the point that the quirks end up looking like features. ;)

Nice to see you back. I hope the move went well.

Yup, feels good to be back! :)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Based on my experience, Python is an outstanding first language and it maintains its appeal even to veteran programmers. But if your goal is to develop any kind of serious GUI, be prepared to invest a lot of time in learning details which you should not have to be concerned about.

A conclusion I don't agree with. IMO you are not comparing languages but the tooling support. There isn't anything inherent in VB.NET or Python as a language which makes one superior over the other when it comes to developing UI's. It's just that the tooling support for VB.NET is excelllent (Visual Studio) which makes it a breeze to create UI's. If you want to experience something similar with Python, take a look at Nokia's Qt (with QtCreator) and the corresponding Python bindings (PyQt and Pyside). Sure, the experience might not be the same as Visual Studio but is pretty decent when compared to creating UI's by hand.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

When i write my code, in the if statement the compiler gives me an error. It says that initialize enum

Whenever you declare a method scoped variable, you need to assign a value to it at least once before using it. In your code, the variable myStatus is not initialized before use. Either give it a default initial value or add an else to your existing if construct. Something like:

if (number != answer){ 
    myStatus = Status.CONTINUE;
} else {
    myStatus = Status.WIN;
}

You might also want to move the part where you accept user input inside the loop. Another good way of avoiding repetition would be to use a do...while loop.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I think your right actually, I don't think I need multiple outputs

Given that this query is out of the way, I'd recommend you give the new design a go and post back if you still have problems after modifying the getOutput method and the Operation interface.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Welcome aboard folks!

Nice to see Gribouillis on the team for whom Tony has been pushing for a long time. And with the addition of James and now NormR1, I'm convinced that Java forum members are pretty much geared up to take over the moderator team. ;)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I like the idea here, the problem is that an Operation may have multiple outputs which can be of different types so this interface would not work

I'm not sure I understand. How can a single operation have multiple outputs? Aren't those lines in the diagram just sending across the same output to multiple other operations?

I have attached my entire NetBeans project

I don't see any attachment. Plus I'm not sure if I would have the time to look at the entire project in depth though attaching it won't hurt; I'll have a look if I get some time.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The code is turning out to be confusing for me given that I'm completely out of context but I'll try.

The code you posted requires you to have special knowledge about the types is the code inside the for loop. If using some way you can make sure that all BufferValue objects implement a getFloat method and also make sure that the type parameter for the Buffer to be returned is passed in the method, you can achieve a good enough level of generic nature. Something like:

public Buffer<T> getOutput(String output, Class<T> outclass) {
   // something here
}

Also, make sure that the Operation class also has a type to represent the type of the output buffer. Something like:

 abstract class Operation<R> { 
     public abstract Buffer<R> getOutput(String s);   
 }
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Unfortunately, not enough information. For e.g. you missed out the most important part as to how do you plan on using it? How does the code which interacts with Operation and the other classes posted above look like or is supposed to look like?

Also, the usage of Buffer class in the above code doesn't look right, mainly because it completely ignores the type parameters required. Try to move the Comparable part of the interface inside the BufferValue instead of placing it on Buffer assuming you want to compare the values and not the actual buffer.

Generally speaking, when you throw in generics in the mix of class/application design, you need to make sure you see it through till the end otherwise you are in for a world of pain. If you are using generics, restrictions can be easily applied by using type parameters but then again, it all depends on what you mean by "the buffer is the right type for the needed operation".

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Congratulations indeed; welcome to the moderator team folks! :)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

That reply was triggered by the following posted by Deceptikon:

I'm not sure the backslash is an "official" solution. Unfortunately I'm not in a place where I can peruse the code at the moment, but I don't recall any provisions in the parser for such a thing, so it may simply be an unintended feature that could potentially go away after upgrade

If it is here to stay, all well and good.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

However, what I mean is that, in 99.999999999% of cases

Right, my point is that let's just leave that backslash support around for those 0.000000001% of the cases instead of simply not supporting them.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I'm at a bit of a loss to understand why is a strong justification required to use backslash when escaping stuff in Markdown. Backslash used for escaping is a part of the Markdown specification and hence was quoted as a solution by me to Niek's query.

If there's not any blessed method in our current version of extended Markdown to disable parsing of a "tag", I can work on adding that capability

If you folks are using a Markdown parser, there is no need of adding something. A parser supporting Markdown knows how to do this. Of course, the home grown modified Markdown parser for the client side rendering might be a bit problematic.

I think I'm still confused why any additional functionality is required. How many use cases are necessary in which one would need to add backticks to inline code in such a case where using the backslash to escape the backtick is too inconvenient?

It just isn't about backticks. Pretty much any special character which starts Markdown parsing needs to be escaped if you want a literal for that character; this includes braces, brackets, underscores etc. Reference: http://daringfireball.net/projects/markdown/syntax#backslash

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

That's a valid but logically incorrect JSON representation of the data. Given that JSON objects are "string: value" pairs, having the same "string key" for all items will result in only one item being returned when you try to get all "STORE" elements.

For e.g. try pasting the following JSON in this validator and press validate: http://jsonlint.com/

{
    "STORE": [
        {"storeName":"<store name>"},
        {"emailAddresses": ["<email address1>","<email address2>"]}
    ],
    "STORE": [
        {"storeName":"<store name>"},
        {"emailAddresses": ["<email address1>","<email address2>","<email address3>"]}
    ],
    "STORE": [
        {"storeName":"<store name>"},
        {"emailAddresses": ["<email address1>"]}
    ]
}

As you can see, only the last element showed up. A better representation would be an array of stores keyed by "stores"; something like:

{
    "stores": [
        {
            "storeName": "<store name>",
            "emailAddresses": [
                "<email address1>",
                "<email address2>"
            ]
        },
        {
            "storeName": "<store name>",
            "emailAddresses": [
                "<email address1>",
                "<email address2>",
                "<email address3>"
            ]
        },
        {
            "storeName": "<store name>",
            "emailAddresses": [
                "<email address1>"
            ]
        }
    ]
}

As far as reading the JSON file is concerned, the simplest way I know of is to use the data binding offered by the Jackson JSON library. Download the library from: http://wiki.fasterxml.com/JacksonDownload under the Download 2.x section (all 3 jars).

To use the auto binding functionality, we need to create classes corresponding to the Stores and Store. Something like:

public class Stores {        
    private List<Store> stores;    
    public List<Store> getStores() {
        return stores;
    }    
    public void setStores(List<Store> stores) {
        this.stores = stores;
    }    
}



public class Store {        
    private String storeName; …
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

@Nick: Did that work or are you still facing issues?

@Dani: Won't it be a good idea to add the escaping related help topic to the "Formatting help" page under "Advanced"?

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

At least Ad Blocker Plus doesn't load the page before blocking it, that would be a bad way of "disabling ads" I think. From the Adblock Plus FAQ:

How does Adblock Plus block addresses?

The hard work here is actually done by Gecko, the engine on top of which Firefox, Thunderbird and other applications are built. It allows something called "content policies". A content policy is simply a JavaScript (or C++) object that gets called whenever the browser needs to load something. It can then look at the address that should be loaded and some other data and decide whether it should be allowed. [snip]

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

IIRC, you also need a script blocker for complete blocking because these things are Javascript based.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Depends on what you plan on "escaping" but pre-pending something with backslash (\) usually does the trick given that we are dealing with a Markdown variant here.

For e.g.

`my_var` => my_var but
\`my_var\` => `my_var`

EDIT: Highlighting is a bit broken when it comes to escaping stuff as you can see if you try to edit this post so try not to be confused by the in-consistent coloring when escaping.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I don't know exactly how you propose to use the given interfaces or how they fit in the big picture of your application so take this as a generic observation/food for thought about the way current code stands. :)

IMHO you are facing problems here with structuring code since the abstraction is leaking out a little bit. You create BufferValue class to abstract out how buffers work for floats, colors etc. but expose the internal type T when doing operations. Your operations return T which make it difficult to chain opeartions or work at an involved level with the returned results since there is no bound specified for T. With the current design, you'll also face issues when interoperating with different BufferValue's since the return type is T which is different for FloatBufferValue and AwtColorBufferValue.

Now back to your question: the lerp method sounds like a good candidate for the helper class which normally accompanies a widely used interface. For e.g. java.util.Collections used for manipulating and housing utility methods of the java.util.Collection classes. For e.g. one implementation can look like:

class BuffersValues {
    public static <T> BufferValue<T> lerp(double a, BufferValue<T> first, BufferValue<T> second) {
        // something here
    }
}

Now we have a problem here; we need a way for double values to interact with the containers of the BufferValue class, namely Float and Color. There are a few solutions which spring to mind:

  • Wrap the double value in a DoubleBufferValue and use the mul/add/etc. methods
  • Change double …
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

@deceptikon
Gah, my bad for forgetting about this thread. Really nice to see another Daniweb member who is an anime fan. As a welcome gift to my virtual Daniweb anime club, I award you a new nick -- "decepti-kun". Hope you like that because I'll be using that to address you. :P

Anyways, here is the breakdown of my impressions about the current ongoing season:

  • Fate/Zero 2: Visually stunning anime with a nice story and very polished action sequences. Must recommended for those who saw the previous installation of Fate/Zero or someone who is into "fantasy" action anime. An awesome watch.
  • Kimi To Boku 2: Sequel to the original slice of life/school anime Kimi to Boku. As always, the pacing is pretty slow and might be downright boring for some. But it personally suits my taste as it's a soothing school anime with a bit of humour thrown in. A good watch.
  • Haiyore! Nyaruko-san: Nothing exceptional but the occassional humour makes this a watchable anime. An OK watch.
  • Tsuritama: A fishing anime; yup, you heard that right, a fishing anime with a bunch of aliens involved. The story is surprisingly good and different from the other stock anime out there. The suspense as to why the aliens have grabbed hold of our protagonist still remains. A good watch.
  • Lupin the Third - Mine Fujiko: Sex, action and adventure; this anime has it all. I haven't seen the older Lupin series but this anime with its unique art has captivated …
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Post the entire stacktrace. Also, which tutorial are you referencing when writing your RMI programs? Do you have sufficient permissions to bind to the port 1099 (default rmiregistry port)?

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

How are you invoking the java executable and how are you passing it the JAR file? Are you using the -jar switch? Do you have a Main-Class entry in the manifest file?

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I was able to upvote it; you just have to do it real quick. ;)

But jokes aside, I wasn't able to upvote once the rep comment box comes up after on-hover.

pritaeas commented: I have a slow mouse ;) +0
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

What exactly is this bug about?

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Both are free as long you run it with public repos, as soon you want private repo you have to pay

Bitbucket allows you to have unlimited private and public repositories for upto 5 colloborating users. I always recommend Bitbucket to folks since you can pretty much host all your code privately and even run a small business (with < 5 programmers) for free!

peter_budo commented: Didn't know that +15
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Its just a simple question , but i m totally confused that why php and asp hosting are cheaper then jsp

One reason might be the widespread use and acceptance of PHP and ASP by hobby programmers/beginner web developers. Java based applications have always been associated with an "enterprisy" setup hence the steep prices (enterprises can shell out more as compared to hobby programmers). Another interesting read in the comments here.

Also what jsp provide which are not provided by php and asp?

This eventually boils down to a platform/language based comparison. Can you make do with the features offered by the PHP langauge? Is there something specific you had in mind when you decided to include Java?

A pragmatic answer here depends a lot on what exactly do you want to do. Are you planning on creating a web application or a web site? Is budget a big constraint here?

If you are short on budget, are planning on creating a hobby website and have a familiarity with PHP, going the PHP route would be the simplest and cost-effective solution. If you are creating a critiical web application for a customer, the criteria would be to choose a combination which best suits your expertise since you would want to create a robust solution. In this case, go with the language you are most comfortable and well-versed in.