peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

@PBoucher Also consider moving stuff in some reasonable methods that puts close related stuff together.

  • Try to use meaningful names, stuff like "m_bS2Bypass" that is presumably IDE generated variable name is just rubbish.
  • Simplify if/else statements as this is disaster and can easily lead logical flows
    if(!m_bBypassIso 
                    && ((m_bS1Power && m_bS1Switch && !(m_bS1BypassPos||m_bS2BypassPos))
                            || (m_bS2Power && m_bS2Switch && !(m_bS1BypassPos||m_bS2BypassPos)))
                        || ((m_bS1Power && m_bS1BypassPos && m_bS1Bypass)
                            || (m_bS2Power && m_bS2BypassPos && m_bS2Bypass))    )

    Wouldn't be easier to establish when to use black colour instead of this complex statement for red?

  • Check for repeating patterns
    //Source 1
                g2d.drawLine(220, 0, 210, 10);  //   /
                g2d.drawLine(210, 10, 220, 20); //   \
                g2d.drawLine(210, 10, 95, 10); //   -
                if(m_bBypassIso)
                {
                    g2d.drawLine(75, 10, 105, 10); //   -
                    g2d.drawLine(85, 0, 75, 10);  //   /
                    g2d.drawLine(75, 10, 85, 20); //   \
                    g2d.setColor(Color.black);
                }

    and replace them with simple method calls where you just pass some data for computation

    drawLines(g2d, Arrays.asList(new DrawPoints(220, 0, 210, 10), new DrawPoints(210, 10, 220, 20), new DrawPoints(210, 10, 95, 10));
    
    
    public void drawLines(Graphics2D g2d, List<DrawPoints> list){
        for(DrawPoint each : list){
            g2d.drawLine(each.getX1(), each.getY1(), each.getX2(), each.getY2());
        } 
    }
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

And what has to do with Java? Besides we do not like to see discussions on illegal activities even if you are trying to tell us that it is your equipment.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

It is sad how people can be lazy or ignorant (any popular service that is accessible to public programatically is likely have some Java API available). This could have been sorted by simple Google search. You would have found immediately facebook-java-api and facebook-java-api examples

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

@Bal I just not what send you off. Your first post was fine intending to provide info. Then came jholland1964, provide more info and suggested that original poster follow a link on our forum that will guide the person in how to provide more info in order to help out with the issue.

Your second post is just out off blue accusation/attack in way "how you dare to reply since I already provided link". This was absolutely uncalled for and got you bad attention. Why don't you calm down and think about whole thing. We are here to help or receive help, and we like to discus things in friendly manner.

jingda commented: Nice one Peter. +9
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I think the punishment is too harsh. And he said he DID post a link to the website! I think you should un-ban him and apologize! abelLazm is a nice person, and I do not see a serious offence, if he posted the link to the original web-site! And whats up with downvoting people who are defending him! You are so mean! abelLazm is a great contributer to this forum! Just look at his points:
Total Up-Votes Received: 161
Total Down-Votes Received: 7
And I think this should also tell us something about unfair copyright laws, but I will not go there ;)

There was opportunity to learn from first mistake. We can't take responsibility for someone who is negligent to his position and involvement in community, ignoring community rules and do same thing again.
Beside abellazm is arrogant enough to come back create multiple accounts and continue posting same way as he did in his original account, also he is lame enough to up vote these accounts to get him self more reputation. So do not give me lectures about this not being fair.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You can download SDK and as far I remember you should have some basic platforms Android 1.0, 1.1 and 1.5 if I'm not mistaken, but not the latest one. For that you would need internet connection and then execute tools/android update sdk from your SDK installation directory. So seriously you should consider get internet access for that machine. There is only so much you can learn from books and then you will need internet to search for solutions either way

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Did you tried the troubleshooting option with manual download?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Don't copy and paste your rules here .... just tell me what is brick marketing and it will be over ?

I don't know, but I guess that you cannot tell my match about Java garbage collection. Difference is that in my own words I can explain this and if necessary I can provide additional links, where you are not able to give general idea/explanation without direct quoting.

Do you get now what is the main difference?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Then how can I check my current infraction points(if I have any)?

1) Quick check, does your user info on any of the posts sports something like this "Infractions: 1/1 (5)" ? (not at the moment)
2) Detailed check, top of the page right side "Control Panel" or by clicking on your user name of any of the posts

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

@ajst doing little of your own "homework" would have already got you there

SocketAddress addr = new InetSocketAddress("192.168.0.23", 10123);
Socket socket10123 = new Socket(addr);

just need to be written as

Socket socket10123 = new Socket(InetAddress.getByName("192.168.0.23"), 10123);
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

This might help:
http://download.oracle.com/javase/tutorial/uiswing/TOC.html

Please read original post before posting to avoid embarrassed entries like this. Question was about Jython not about Java GUI components and designs

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

method String.replace required char[] data type in arguments. Try:

url.replace(" ".toByteArray(), "".toCharArray());

P.S.: sorry my english

Bad advice exactly showing that you did not read whole thread otherwise you would have seen that original poster then said that Java Microedition API was in use. Unlike J2SE JME has limited classes and that also mean less methods to use.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You need to look for java decompiler, however be aware that you will not get exact code as you do see in java file

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You need to ask specific question as we are not here coding service on demand.

javaAddict commented: Absolutely Right +13
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

@samueal post moved to new thread

@rminator Do not hijack old threads by posting a new question as a reply to an old one

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

not only is it not a question. it is an advertisement and closer to spam than any question gets.

Yes you right it is not question. However you are wrong about advertisement as it is highly unlikely that sneaker and Jim Waldo is the same person (plus he already denied that). I had quick peek on book and as sneaker hinted it is not reading for beginner (so you may not appreciate it) and it something to read if you want to know more of internal stuff, but nothing heavy to get your head spinning...

@sneaker you more then welcome to copy original post and add it to Starting "Java" [Java tutorials / resources / faq] you can also add either of the links to Google books or O'reilly

Hope that now situation is clarified.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Dear Experts i want to know about the date schedule and syllabus for SCJP exams of java.
>>You need to book your test through Prometric website, syllabus - SCJP Sun Certified Programmer for Java 6 Study Guide

Kindly provide me link to scjp.
>> Is so hard to use google or search oracle website? I guess yes, so here is direct link

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I'm liking this Intellij IDEA one for now. Thanks guys.

Good choice ;)

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Thread closed. Please follow discussion here

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You best learn by trying and failing. So why don't you start with coding? Besides it is your assignment and you need to prove you learn, not us...
Second question is more easier so start with that.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

NETBEANS7.0 is the best IDE so far

O really?!
NetBeans 7 same as version 4 few years back is buggy. And if you have no conclusive answer just to shout "xyz IDE is the best" then it is better if you stay quite.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Simple code to see if array of primitives has duplicates. The aim is to only check if there are any duplicates, but not to check what element is repeated, or its position etc.

PS: Do you know some handy snippet? Don't way, post it!

mKorbel commented: no idea == no solution, +8
Majestics commented: A Challenge +5
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

@mKorbel you forgot to mention another major IDE, Intellij IDEA by jetbrains (my tool of choice ;) )

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Once you done with that you may want to look on Head First - Servlets & JSP that will give you good start for web development and some basic of database connectivity. However in the mean time nothing is stopping you from creating some applications calculator, CD/DVD/book application, your sport activities manager(what activity you did, when started, how long, what distance etc) and of course it is good participating in forums try to answer questions and while helping others to help your self learn something new

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

My guess is you declared "package" at the start of the file. Compile will work fine and place the "class" file in subdirectory of the "java" file that been used for compile. You can confirm this by "dir" command (that should be equivalent of unix ls command). Anyway to execute this class you need to give it path to class file. Example

package com.daniweb;

will be as

java com/daniweb/FloodClient
mKorbel commented: nice to see you here http://forums.oracle.com/forums/forum.jspa?forumID=950 +8
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Would have been nice if you posted/explained what is actual problem or error message and not just generic request.
Since we do not know how you created table we can guess that you either declared "id" value to be sequence/auto increment in which case providing NULL value is OK, but it is not necessary. If "id" is not sequence then error is obvious as id is NULL.
For few tips on sql:update you can check this article

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Make it long story short JUnit is testing framework used for "obviously" testing. In ideal circumstances you would first decide what feature you wish to implement, write basic failing test and then write what ever code you need to get this working. Test doesn't have to test whole feature, you may use incremental process.
So what you do is provided input data you need to work with.

As per linked example author takes two values, calls method for calculation and asserts result from method with what ever he expected. If the test fails that mean something is not correct

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

too much is too bad for anything. 12 hours weekend?, that sounds insanity, and as far as i know i never seen anyone getting addicted to gym.

Then you do not know any professional athlete ;)

jingda commented: Are you a professional athlete, peter? +0
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Jingda I appreciate your voting, but you have to be careful with wording. As "Want to play with me?" has double meaning. It is safer to say "would you care to join me..."
Besides, why shouldn't mods/admins play games, watch movie, read book ? :D

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Neither of them. I disliked COD series after COD2 since they moved to small maps and no vehicles. Just camp and spray. COD-OU was bes, because of that I prefer larger map based games and obviously with vehicles like BF2, Quake Wars - Enemy Territory, BF-Bad Company 2 or new up coming Battlefield 3

jingda commented: I did not know a mod play games as well. Want to play with me? +0
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Should we have a hall of fame.
>> We already award every month one active and helpful member with "Featured Poster" badge, that used to be visible with every post (still visible if you roll-over member's name next to a post or visit member profile)

That shows the mods and admin community.
>> Already exists, but not many people are aware of it http://www.daniweb.com/forums/showgroups.php

Those who sponsor to daniweb and posters who are active all the time.
>> Sponsor badge visible in same way as "Featured Poster", activity of members can be checked through "Top Members by Rank" on top of the page

Should we?
>> Do we need anything else? Yes, people contributing material code snippets/tutorials/news stories/product reviews and less lazy students dumping their assignments on the site expecting to be magically solved for them without them doing anything else. Plus I would say less "know it all types" that tries to reply stuff they have no understanding/ study background

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Dean if you actually looked at the top of this section you would have found Starting mobile development [SDK / tutorials / resources / faq] that also holds tops for starting with Android

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

No need if we talking about 4 people. It would be different if we spoke of thousands or millions.
However you need to understand that at the moment you are just on local/private network. This wouldn't work if your friends try to access it remotely.

arshi9464 commented: This person has a lot of knowledge about programming. Hats off +2
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

@apc00008, that is because you just copied and pasted code without checking actual code. Otherwise you would have spotted there is package alok.examples; You have two options:
A)Observe package requirement and create relevant folder structure
B)Remove package from start of program

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

1) OP in his Dragon Fire "support" post said

You simply write your C++ code and test it with the built in iPhone emulator and send the code of to Zimusoft, who made DragonFire SDK. The code is then fiddled with, until it can be compiled on a Mac machine which uses the full iPhone SDK.

So for me it is plain that it would be better to have Mac machine then let someone fiddle with my code especially if I want to make profit out of this application at the end of day.

2) Plenty of books to choose from, but since you are experienced Java developer there is no point, in my opinion, to go for something like Head First iPhone Development: A Learner's Guide to Creating Objective-C Applications for the iPhone. I would go for Beginning iPhone 4 Development: Exploring the iOS SDK, speed approach with iPhone Cool Projects: Ten Great Development Projects for Your iPhone.
Please note that I didn't any iPhone/iPad development so take my advice at your own risk :twisted:.

javaAddict commented: Thank you for your time +7
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Use default: numWordString =""; Also you are missing break points after cases break; If not sure what I mean by that have look on Oracle Switch Statement tutorial

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

If you already learned about Array you can substitute that long switch statement with String[] numbers = {"zero", "one", "two"}; and then just call System.out.println(numbers[YOUR_INPUTED_NUMBER]);

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Guess Java Communications is what you looking for

phycoCoder commented: Magical all encompassing knowledge of javas APIs Hes my hero ; ) +0
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

I also got the empty page. This page also turns up blank. He only posted an hour ago on all these threads, twice on the first blank page.

Because it is same thread :D

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Closing thread as OP will only come back, if ever, in 6 months and hopefully solve her personality and behaviour issues in the mean time

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Closing thread as it is going off topic thanks to spoonlicker. You now have official warning about hijacking other people threads.

@Sundayy if you still need help with your work please create new thread and I'm sure people who been helping you and other who are willing to help will help.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

@Transcendent and @spoonlicker it doesn't mean that you two can go on with abusing reputation system

@OTHERS no need to down repute either of them, both made mistakes hopefully they will learn from it

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

KEEP IT PLEASANT

@Transcendent mind the language

@spoonlicker do not post if you do not know answer or if you do not have reasonable suggestion. Also do not post to attack people. Next time read carefully reply "It's ok. Thanks for trying." is nothing personal, Transcendent was actually polite thanking you for even looking at his problem.

Take this as unofficial warning, next misbehaviour will come with "reward" according to forum rules.

AndreRet commented: Whip them, yeah! +6
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

1. Just because you didn't get answer in 24 hours you feel like you are entitled to create another new thread?
2. Why are you misusing JSP for something that is not supposed to do? Do document manipulation in servlet and just forward necessary data to page view.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

If you read our forum rules carefully you will find out in Keep It Legal section that we ask

Do not ask for help to pursue any illegal activity including, but not limited to, hacking and spamming

Providing links to copyrighted material is illegal, therefore forbidden. End of discussion.

Thread closed

Rashakil Fol commented: Ironically, you just linked to copyrighted material in this post... +9
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

@beejay321 as you may have already found from personal message sent to you, your behavior is inappropriate. If you want help you need to cooperate and investigated recommended resources. If you believe answer from another member is inappropriate then use "Flag Bad Post" button let the moderators/admins know there is a possible issue, instead of "taking law in your hands" and abuse supposed offender

PS: WaltP was correct in saying that two dimensional array is wrong and you been right it will compile. The thing is that WaltP is right because you are supposed to used arrays of same size. In this scenario so far it is harmless since random array size is smaller then sorted, but if you start using array size method instead of hard coding number of loops in for statement (10) you will get in trouble since there will be null values in last set

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

1. Database connectivity form page view (JSP) - bad, read JSP database connectivity according to Model View Controller (MVC) Model 2to get basic idea of better approach
2. Absolute file path - bad, tell your web application through web.xml or other configuration file, if using framework, where to find directory and just swap relative path to file
3. Absolute file path for Windows - very bad! There is only 10% if not less Java web applications running in Windows environment. 90% is run on various flavours of Unix

javaAddict commented: You came to the rescue +7