peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Would you mind to share it? You may possibly help somebody in the future with same/similar issue....

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I want to work the textfields of my registration form the the list of options

Your reply doesn't make any sense. If you cannot take time reply properly why should any one care to answer your question?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I see no reason why you got wind-up. I answered to my best knowledge and ask you not to double post. If you are not capable take friendly meant criticism well then that is bad.
Choice of staying or leaving is your. Nevertheless if you stay you are expected to adhere forum rules where keep it organize clear state "Do not post the same question multiple times"

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I have no idea why your Eclipse is so slow that is not normal. If you want you can try IntelliJ Idea 10 Community Edition that has now support for Android. As for what version of Java you should use, it doesn't matter.

PS: Next time please do not create new thread just because you did not receive fast reply.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

As JavaEE5 documentation states in HttpServlet class description
doGet()

Called by the server (via the service method) to allow a servlet to handle a GET request.
Overriding this method to support a GET request also automatically supports an HTTP HEAD request. A HEAD request is a GET request that returns no body in the response, only the request header fields.

When overriding this method, read the request data, write the response headers, get the response's writer or output stream object, and finally, write the response data. It's best to include content type and encoding. When using a PrintWriter object to return the response, set the content type before accessing the PrintWriter object.

The servlet container must write the headers before committing the response, because in HTTP the headers must be sent before the response body.

Where possible, set the Content-Length header (with the ServletResponse.setContentLength(int) method), to allow the servlet container to use a persistent connection to return its response to the client, improving performance. The content length is automatically set if the entire response fits inside the response buffer.

When using HTTP 1.1 chunked encoding (which means that the response has a Transfer-Encoding header), do not set the Content-Length header.

The GET method should be safe, that is, without any side effects for which users are held responsible. For example, most form queries have no side effects. If a client request is intended to change stored data, the request should use some other HTTP method.

The GET …

mani2 commented: thanks.. +0
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You failed to specify what JSP or better said what functionality you want that may require use of JSP...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Make sure you close any stream you open, JME is very sensitive in this.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You should know better then just post error message without any code....

From what you provided we can only observe
java.rmi.MarshalException

"A MarshalException is thrown if a java.io.IOException occurs while marshalling the remote call header, arguments or return value for a remote method call. A MarshalException is also thrown if the receiver does not support the protocol version of the sender.

If a MarshalException occurs during a remote method call, the call may or may not have reached the server. If the call did reach the server, parameters may have been deserialized. A call may not be retransmitted after a MarshalException and reliably preserve "at most once" call semantics. "

org.xml.sax.SAXParseException

"This exception may include information for locating the error in the original XML document, as if it came from a Locator object. Note that although the application will receive a SAXParseException as the argument to the handlers in the ErrorHandler interface, the application is not actually required to throw the exception; instead, it can simply read the information in it and take a different action."

So I would say SAXParseException is thrown while working with XML. Check out your server side processing

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You cannot, because you need WTK compiler

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

If you actually tried and search this forum you would have definitely came across this post

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Organizing content in tables shows you how to add data in table and then positioning with Adding content at absolute positions

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

iText has PageSize class, nice sample can be found here

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Can you give me a absolute starting point to canvas. I did some j2me programing but not canvas.(i Don't know whether that sounds ridiculous). Searching in the internet doesn't help at all!

Sorry I do not know any good online resource, as all of them take only small portion of what is Canvas in MIDlet. The best collection I seen so far is from Kicking Butt with MIDP and MSA: Creating Great Mobile Applications by Jonathan Knudsen where in section 4 he has following chapters (link to safari book copy)

  • Chapter 9. Creating Custom Screens
    • Section 9.1. Getting Information about the Display
    • Section 9.2. How Painting Works
    • Section 9.3. Making Colors
    • Section 9.4. Drawing Lines and Shapes
    • Section 9.5. Drawing Text
    • Section 9.6. Measuring Text
    • Section 9.7. Creating Images
    • Section 9.8. Drawing Images
    • Section 9.9. Keeping Resources Small
    • Section 9.10. Drawing on Images
    • Section 9.11. Getting Your Fingers on the Bits
    • Section 9.12. Clipping
    • Section 9.13. Event Handling
    • Section 9.14. Controlling Command Placement
    • Section 9.15. Summary
  • Chapter 10. Custom Items
    • Section 10.1. Custom Item Sizing
    • Section 10.2. Painting
    • Section 10.3. A Pretty Wait Indicator
    • Section 10.4. Handling Events in Custom Items
    • Section 10.5. Internal Traversal
    • Section 10.6. An Interactive Example
    • Section 10.7. Summary
  • Chapter 11. Using the Game API
    • Section 11.1. Tight Looping with GameCanvas
    • Section 11.2. Building Scenes with Layers
    • Section 11.3. Tiled Layers
    • Section 11.4. Sprites
    • Section 11.5. Detecting Collisions
    • Section 11.6. Assembling a Game Scene
    • Section 11.7. A Blocky Example
    • Section 11.8. …
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

There been talks about mobile manufacturers providing JavaFX enabled devices, but I'm not sure if it actually happen. Reason is simple, Android took over after success of iPhone and people slow down sales on "simple" phones

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

OK, I snipped name from this http://www.daniweb.com/forums/showthread.php?p=1468528#post1468528 was it anywhere else?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You said

put code for insert flash object in out.print("like html code")

there is no need for because flash can be put in <objec></object> directly inside HTML. Beside creating view pages through out.print is out of date approach that been recommended not to use for good 5years if not more

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

@jonsca yes you correct that we do not like people just drop in their assignments and expect our members to provide solution. One of the announcements says We only give homework help to those who show effort however that doesn't mean we will punish people if they provide full solutions.

@caut_baia we do appreciate that yo do take your time to help people, but really is it worth to give whole solution without original poster sweating little more with it, working on given clues/advice. How much would they learn without trying by simple copy and paste of solution? Maybe perhaps in the future you can provide just snipped to get assignment moving forward then whole solution.

I hope this is solved in satisfactory for each side.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

As far I'm aware Apple did not open development for other platforms then Mac. Few people try to use dev tools on crack OS X running Intel machines, but did not succeed. You do have to have Mac machine to run these dev tools

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

just put code for insert flash object in out.print("like html code").....it works

You should pick up either some better book or search for better tutorial in regards of Java Web development. There is no need for out.println , this is part of HTML and better handled by it

@ruchi18 you can still do that, but you will have to do it with Flash own Action Script that is more or less JavaScript. If it is so then this should be asked in our Graphics and Multimedia Forum as it is not directly related to Java web development

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Here is easy to read book Processing XML with Java, have look on JDOM which is very easy to use (after that you will have no problem to find some better/more suitable library)

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

@mKorbel you are a programmer that is different. If you are student with no previous experience in the field then I would recommend to take it from command prompt. In the short time since I started openly participating in programming forums I seen one to many idiots coming asking questions what is wrong with their IDEs when the error in 99% was their bad code

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

This is Java section. You either have to create new thread there (and please "Mark As Solved" this), or tell me now and I can move whole this thread to one of the sections.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

@jon.kiparsky agree notepad for win!

@ztini you would be first person that I met using BlueJay in industry, or perhaps you are still student...
UML diagrams
>I would say rather rarely used as their take hell of time to create and people do understand them differently in what they supposed to mean

rapid deployment of test classes and debugging
>Any IDE can do it so you missed point here

Why anyone would suggest not using an IDE is beyond me.
>Simple, to understand basics. To get hang of errors that compiler throws at me and be able to deal with them no matter what IDE I may use or be forced to use (there are still some companies that persist on use of Eclipse or NetBeans, mostly because management decided so 10 years ago). To be able compile robust program from command line (you never know when you will be on client side trying to debug server application but you cannot not connect with your beloved desktop/laptop or install your favourite IDE because of complicated security measurement company put in place to protect their network/servers).
Call me crazy or stupid but while learning Java I did 3-4months only notepad with console, after that I used JCreator LE (his is free version, nice GUI, only syntax highlighting, no auto suggestion/completer) for good 2 years.


It's like telling an art student they can't use acrylic paint, paint brushes, or a canvas---they …

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Java doesn't support this. You need to do it in C or C++

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Thanks friend, you have solved the problem it was ',' and not ';'. It works perfectly now!
P.S.
It's awfull when you are convinced that the problem is something else! :)

Problem is that you did not posted precise copy of code that you been trying to execute. Out of the two lines there nobody would have been wise...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

>>So it's the || operator that doesn't verify its second parameter ?
Not exactly. It is combination of what you want to check for and what would be next step after you pass this test.

>>Ok, but the problem still persists because it's the string returned that is null. So why didn't struts initialised it? It initialised the second parameter, why not the first?
There isn't much I can help as I do not have knowledge of Struts, only logical thing I can advice is to have closer look on your Project object and see why it wasn't populated. Check how you are populating it, check that you are are storing data into database. Testing frameworks are your best friend...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Well lets have small show&see

public class NullObjectTest{

	public static void main(String[] args){
		Project test = new Project("T-E-S-T");
		Project empty = new Project("");

		System.out.println("Validate initialize project by Peter");
		validateByPeter(test);
		validateByPeter(empty);
		validateByPeter(null);

		System.out.println("\n\nValidate initialize project");
		validate(test);
		validate(empty);
		validate(null);
	}

	public static void validate(Project project){
		if(project !=null && project.getName().length()==0){
			System.out.println( "Name is required." );
		}else{
			System.out.println("Name is "+ project.getName());
		}
	}

	public static void validateByPeter(Project project){
		if(project ==null || project.getName().length()==0){
			System.out.println( "Name is required." );
		}else{
			System.out.println("Name is "+ project.getName());
		}
	}

	static class Project{
		private String name;

		public Project(String name){
			this.name = name;
		}

		public String getName(){
			return name;
		}
	}
}

Can you tell me what are the results?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

How I read that statement is: If project is not null and length of project name is equal to zero add error message.

Real time test: What happens if project is null? Well I'm project and I'm null therefore "not null" statement is not me, lets check if name length is equal to zero. Bang NullPointException

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I expect that you already have database installed on sever (MySQL/Oracle/Postgres). What you can always try is to create backup or export of existing DB in SQL or any convenient format to you and then try to import it on server side database

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Are you sure you wanted to use if(project !=null && project.getName().length()==0) and not if(project ==null || project.getName().length()==0) (sort of crude check actually)

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

This question is not well formed.
Are you asking how to install database, then check this
If you ask how to proceed when you want to connect midlet with database through servlet is a have servlet waiting for GET/POST request, some logic to take care of getting through received parameters and calling appropriate method which will talk to database, then return results to midlet.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Nobody can advise without seeing code...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Yes, your best chance is to get some hosting plan so IP would remain same. Then provide a way to access database, PHP/Java/.NET service that accept request and some parameters, runs the query and return results back to device

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

That tutorial is exactly what you need because your "local" database is local only to your laptop and not to any other device. And if you want to share that database you would have to provide means to do so like acquiring static IP for your laptop so you could connect to it from anywhere in the world.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

If either of you(ashok5, saqib_604) bothered to look at the link I provided you would found that these and many other resources are already recommended there

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Top of this forum section Starting "Java" [Java tutorials / resources / faq] isn't that enough?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

And I already told you that this parameter can be set up directly in constructor of Chunk, Phrase or Paragraph or it can be added at any point through processing by using method setLeading().

So what do you don't understand about it?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

And the reply you got is for Java. So what is point of your reply?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Apparently iText is using little inconvenient name for line spacing "leading" based on PDF spec. So depending on where you want to change spacing Chunk/Phrase/Paragraph you can either use constructor to do it on start or a method setLeading() later in the process

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You need to explain more in details as what you tried to do. Otherwise we may waste time on suggestions you did try. This also enable to see us if you made any mistakes.

PS: What did you gain by installing MySQL through WAMP. I see it as waste, since you are using Java therefore you will not use PHP and use of Apache HTTP server is questionable since Tomcat (Jetty, JBoss) is satisfactory in most cases

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Depends on the type of database you using. For example MySQL documentation here explain how you can set internationalization for server/database/table/column/string

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

If you want to get some return values then you need to change "void" in methods you calling for whatever return type you need boolean/int/string/etc.

@javaAddict you been 1 second faster LOL

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Nope, wrong. As I said in my first post PRINT will be executed statement of inner for loop to print character and PRINTLN will follow after inner for loop to just print new line

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

That is fine you just need second print for new line after inner for loop

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster
for (initialization; termination; increment) {
    statement(s)
}

Meaning on what value you wish to start like int i = 0 , termination is like while statement i < 10 and increment can go either way like i++ or i-- .

So in your scenario you need to create nested for loops where the outside one will print new line (println) and inner will print character number of time on the line (print)

Does it make a sense?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Little of google search and you would find this nice entry from Code Ranch

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Yes that is fine and you can use. Your only "problem" would be checking each element to find out if it is instance of number or something else as I showed in my first reply.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Not sure if I understand your last question, so correct me if I'm wrong. Object is not use frequently (in direct), and you would used it only at the point of generalization. For example whole Jira project up till version 4 was infamous for it extensive use of Object collections and then manual checking what you are actually receiving. Which was a mad house. After that they started to deprecate this stuff and start dealing in specific types

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Yes you could do something like that, but then you would have to run a validation on object retrieved from array to find if it is instance of obejct A or object B

if(myArray[n] instanceOf Book){
//code here
}
else(myArray[n] instanceOf Movie){
//code here
}