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

Not much details to help you out. Please post the shortest possible compilable code which showcases your problem and mention "what exact" errors or problems you are facing (with complete stacktrace or message if any).

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

> Here is latest version of loader: https://github.com/nikelin/Redshape-...cesLoader.java

A few observations:

  • Line 20; don't work with raw string paths. As soon as the user passes in a root directory, create a File object out of it or better yet ask the user to pass in a "real" directory in the form of a File object rather than a "string" path.
  • Line 36; this will fail on Windows platform since the path separator is not ":" but ";". That line can be better written as: System.getProperty("java.class.path").split(System.getProperty("path.separator"))
  • Line 41; similarly for "searchPath"; don't work with raw strings treating them as path.
  • Line 67; "/" is a path separator on *nix platforms while on windows it is "\". That line can be better written as: File someFile = new File(rootFile, fileNameString)
  • Line 87, loadData method; you don't close the input stream! Plus, if your aim is to read textual data line by line, use a Scanner instead. Scanner in = new Scanner(myFile); . Strings in Java are immutable and hence the concat() on line 95 will end up creating new String objects each time a concat is done. Better use a StringBuilder for incrementally creating strings. Don't manually append "\n" since the EOL (end of line) character is different for *nix, Win and Mac. You need to use the system property, line.separator.
  • Line 101; why "\0"? If you want to ignore non-printable characters, why not "" (a blank string)?

Throughout the code, …

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

> I REALLY hope to see everyone there!!!!!!!! <3

I won't be able to make it but hope you have a great birthday bash with our fellow Daniweb members; party hard! :)

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

> Ever quest 2 seems like a nice game. @ Sos, what version are you playing?

I'm playing the F2P version (free to play) also known as EQ2 Extended. You can get a streaming download client from this page: http://www.everquest2.com/free_to_play

The initial subscription level for each new member is by default "bronze" which doesn't require you to pay anything upfront but has a few limitations. For a one time $10 payment, you are upgraded to silver which is a good enough compromise if you are not into monthly payment for games.

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

I've edited out your post so that it only contains the relevant part to comply with the site rules.

Anyways, the important portion in the text above is "may not catch". It doesn't say "won't catch" or "would not catch". It's just that the textbook assumes that a lot of compilers out there won't catch this issue but it's a fact that Sun JDK 1.5+ does catch this issue. I don't have a *nix box handy right now but I'll check with some other compilers (jrockit, gcj etc.) and see if they issue the same error.

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

Well i do have the latest edition of their book. Purchased a copy. They said the compiler does not catch the error.

What is the name of the book? SCJP Sun Certified Programmer for Java 6 Exam 310-065? If yes, are you "very sure" it specifically says "does not catch"? Can you paste the exact wordings the text uses?

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

> Would the usage of something other than PrintWriter work?

No, because all writers/streams would end up writing the CR character without giving consideration as to how it is displayed. You can only rely on the way text editors end up displaying the CR character. Or the simplest solution would be to "gobble" or "ignore" the previous characters in case you encounter a CR character. This way, the characters before CR won't be written to the text file and users of your text file won't be able to see it. But this again means that the contents of your text file would be different from the actual data (since you end up ignoring a line).

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

It is working perfectly fine when I use:

System.out.print

but when I use

outputStream.print

The function of \r starts behaving like \n.

You have got to understand that "carriage return" is a control character and the behaviour of "returning the carriage" only makes sense for some devices. From the wikipedia entry:

In computing, the carriage return (CR) is one of the control characters in ASCII code, Unicode, EBCDIC, or many other codes. It commands a printer or other sort of output system such as a display to move the position of the cursor to the first position on the same line.

In a text editor, it makes little sense to again "move" to the beginning of the line and hence almost all text editors display it as a new line. Try this program:

public class Test {

	public static void main(String[] args) throws Exception {
		final File f = new File("c:/a.txt");
		final String cr = "\r";

		final PrintWriter pw = new PrintWriter(f);
		pw.print("Hi there, how are you?");
		pw.print(cr);
		pw.print("I'm fine good sir\nThank you");
		pw.close();
		
		final InputStream in = new FileInputStream(f);
		int i = -1;
		while ((i = in.read()) != -1) {
			System.out.print((char)i);
		}
	}

}

View the output file generated by the program in a text editor and compare it with the output printed on the console. What do you see?

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

If you want to distribute your application to users, just package your JAR along with shell scripts for specific platforms, just as it is done for applications like Tomcat etc.

If you are using such shell scripts, it would be pretty simple to put in the sudo in the script and all the user will see is a password prompt. Something like:

# runserver.sh
sudo java -jar httpserver.jar

This way, your users won't be aware of "sudo" in the script and would just have to type in the password, as intended.

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

AFAIK, you require "superuser" (also called as "root") privileges for binding to ports below 1024 and `sudo` does exactly that, run the program as a "superuser". From the sudo wikipedia entry:

By default, sudo will prompt for a user password but it may be configured to require the root password, and will require it only once every 15 minutes per pseudo terminal, or no password at all.

As you can see, it by default happily accepts the logged in user's password (just to confirm you really are you) before running commands as root. This can of course be configured differently to make sure sudo actually requires 'root' password but that's a different story.

Also, though admin users are almost like "superusers", there are a few areas wherein you actually require a superuser and you have stumbled upon one of them. The solution? When testing use a port which is above 1023, something like 8080. I don't do my development on a *nix box but there is a thread on SO which talks about the same stuff, maybe you can draw some inspiration from there but using a different port would be the easiest.

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

I am not observing the output in a display. I am dumping the output in a file and when I open it, I find that the behavior of /r is like /n.

On some platforms (namely Mac), `\r` is a newline character. It is quite possible that the editor you are opening the file in is "inferring" the end of line character and displaying it as a "newline" character. Which editor are you opening the file in?

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

This seems like a display issue. Where exactly are you observing this behaviour? If in an IDE console, can you try running the same code from command line and check whether it works or not?

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

> My question is whether this has been a new feature added to java 6 or am i missing something ?

This compiler enhancement was added in Java 5. The above code compiles fine in Java 1.4. I'd recommend getting the most recent version of the SCJP book if you plan on giving SCJP 6 to avoid such inconsistencies.

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

A few months back Google had acquired an organization which specialized in created UI builders for Swing / SWT (the toolkit which powers Eclipse) and open sourced it. Not sure how good it is but worth a try if you are into creating drag-n-drop UI's.

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

Depends on how good your preparations are. Kathy Sierra books are pretty good when it comes to certification preparation, for e.g. this one for SCJP 6(called something else now but doesn't matter AFAIK).

The secret is to not just "read" the book but also try out the examples "without" blindly copying them from the textbook. I do know that this might be a far cry for someone who wants to give the certification ASAP but still worth a try. Google around for "SCJP 6 mock exams" for practice problems.

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

And... anyone here play any good MMO like Ragnarok etc.?

I used to play Ragnarok a long time back but botters/harvesters/powerlevellers have ruined the game IMO. Plus the community isn't *that* great (I'm talking about iRO here).

I started playing EQ2 a few months back and am finding it pretty good. :-)

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

And here I was wonder what that weird image was for. Good work. :-)

Another caveat is that once the vote has been undone, you have to *again* refresh the page in case you want to play around with up/down neg/pos reputation again.

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

As you both have already observed, there are a few limitations with the current voting system. These are:

  1. You can't add a comment without adding/removing reputation
  2. You can't "undo" a up/down vote or reputation. Once an up/down arrow is clicked, closing the window which pops up just removes the ability to add a reputation comment. The up/down vote remains.

Both these are pretty much implementation details and can be much better explained by Dani but AFAIK these are on the TODO list. :)

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

You are by default capable of awarding x and y number of points to the user where x and y is your power to influence a fellow Daniweb member's reputation in a positive and negative manner respectively. For e.g. you can positively influence by +4 and negatively by -1. AFAIK, these values come from your current reputation points you have (which is 47 right now).

Daniweb doesn't have the concept of awarding "varying" reputation wherein you can award selective number of points. Also not sure if it was a typo, but in your case you are awarding 4 reputation points and not 1. Another concept which comes into play here is the "upvotes" and "downvotes". This metric is something which is helpful for measuring the usefulness of a user's post. You can't add reputation without influencing the vote count by +1 and -1 for up and down votes respectively. But you can of course just "upvote" a post and not add any reputation to it (there by remaining anonymous). Again, this value isn't customizable and would never change (as opposed to rep power). No matter your reputation, up/down votes would always influence the total up/down vote count of a user by 1.

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

There is no "pure Java" way of doing that. There are a couple of "curses" bindings floating around for Java but that's it. The mess of outputting a bunch of line feeds is nothing compared to considering using a full fledged JNI-dependent third party library just for a better console support.

But if you still insist, I'll leave this here. http://sourceforge.net/projects/javacurses/

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

If you want to modify a `List` while iterating on it, the simplest solution would be to use a list iterator as opposed to a regular iterator. List iterators allow destructive updates on the list while iterating over it.

public static void main(String[] args) throws Exception {
	List<String> lst = new LinkedList<String>(Arrays.asList("a,b,c,d".split(",")));
	for (ListIterator<String> iter = lst.listIterator(); iter.hasNext(); ) {
		if (iter.next().equals("b")) {
			iter.add("OMG_THE_MIDDLE!!11!");
		}
	}
	System.out.println(lst);
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Because the two of them are logically equivalent; hence assigning <?> to <? extends Object> and vice versa works. Even though <? extends Object> is non-refiable, it is still a generic declaration and something which is equivalent to <?> .

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

If you are *really* creating *that* app, the icon should be the least of your concerns... ;-)

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

I have deleted the groups since they didn't have a lot of members to begin with. I'll probably kick off a discussion in the mod forums related to this since this is pretty close to deleting threads on demand, which we don't allow right now. I'm sure you would exercise caution when creating your next group and not assume you would be able to delete them as required.

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

IRC channels work in a different way. The trick here is to join the channel and continue with the stuff you were doing. If someone pops in, drop a casual "hello"; if someone else is interested in carrying on with the discussion, fine. If not, back to work. The mistake folks make is to join the channel, steady their hands on the home row of their keyboard and eagerly wait for someone to type something enlightening, which of course doesn't happen. :)

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

> Morning? Its afternoon...

Frigging timezones, how do they work? :-)

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

> Last summer, we came up with tshirts with the slogans that a lot of you came up with in the discussion thread that Nick Evan referenced

Hey, you could at least post the pics of the shirts for the community if you are using their slogans ya know. :-)

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

I think we've got a celebrity with us. :)

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

> But when you need quick answers you always want to get in touch with someone who is online.

This more or less amounts to " paid consulting" (if you want to get things done your way) and there are quite a few sites which engage in this sort of activity. This is one of the reasons why beginners get flamed on well known technical IRC channels. They join the channel expecting "quick help" but are disappointed when they are told off by the regulars there.

Of course, not saying that such places absolutely don't exist, it's just that if you need quick online help, folks would expect you to shell some money.

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

Those are not really required, it's just another different (more verbose?) way of drawing the roof. My code snippet referenced on the first page works fine with one polygon.

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

> Geek's Lounge isn't the friendliest.

Depends on who you are trying to be friendly with. :) Anyways, Davey's point was that you can try earning rep by focusing on the low hanging fruits in any of the sections which match your current expertise (Operating Systems, Browsers, Programming etc.)

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

Ah, it completely slipped my mind. You need to be a member for at least 5 days and should have a reputation of around 15 to create a social group. This requirement was added to cut down on spammers creating social groups for the sole purpose of spamming.

blackcathacker commented: Thanks. I was looking all over, couldn't find out how. :) +0
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You can create a group here. Just make sure that you search the existing groups out there to see if there already exists one (or pretty close to)suiting your needs. Also, any self-promotional groups would be immediately deleted.

EDIT: Drats; this is what you get for working against an old copy of the thread...

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

> Some links are no longer active.. Cheers!!

If you can point me to specific sections, I can get them fixed.

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

This seems like a direct-copy paste of http://letshare.it/blog/regular-expression-beginner.html

Do you own that content?

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

Looking forward to the new G1 collector which claims to be better than the CMS collector used by JDK 6. Also, it seems that they fixed the `TreeSet' to throw an exception when a non-comparable item is added to it (previously the the exception was thrown when you tried adding a second non-comparable/comparable item to the set). BTW, those who are interested in what *exactly* invokedynamic is, read the blog post by jRuby developer.

Then there is this one interesting addition to the networking stack, called the Socket Direct Protocol. Mmmm, fun stuff! :-)

and another release intent on making Java a clone of C#, Ruby, and C++ all at the same time.

JDK releases aren't just about the language. Sure, Java is trying to play catch with other languages out there but at least I'm more interested in the VM enhancements which would enable other languages built on top of the JVM to perform better.

peter_budo commented: Thanx for sharing +16
kvprajapati commented: :) +15
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I'm sorry, but that's BS! A button that is clearly labeled multi-quote as it is on numerous other forums is not confusing & frustrating.

Sorry, I don't agree with this. If I press a button and it just "glows" up without doing anything, it is confusing. Sure, it's useful when you know what it does, but confusing nonetheless. And this is coming from someone who had trouble figuring it out on the first try. :)

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

Then check the name of the class and the constructor declaration and see if there are any typos. Paste the class here if possible.

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

I can't help you with Minecraft specific issues but this error normally comes up when there is a mismatch between the name of the class and the constructor. Is the ItemChain class your own class?

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

That proves the code checks for the resources before running only and any resource added during runtime doesn't count. So what I was thinking is it possible to run two java programs from one jar file one after the another like we can do with batch files?

What kind of resources are we talking about here? What is the exact exception message?

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

Oh, you are right indeed, a typo there, and a fatal one! :)

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

Markup generator tools (MS Frontpage) and technologies like JSF are the prime contenders when it comes to emitting atrocious markup. Another possibility might be developer stringing together markup elements in an ad-hoc manner when developing dynamic web pages.

In any case, I'm don't think you can convince them to redo the site (or at least the design) just because your validator can't handle the errors; cost justification etc. :-)

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

The way I see it, the steps are as follows:
In top level directory of your project (the main directory), place the file named COPYING there having the contents as mentioned here.

And now follow the given instructions (taken from the gnu site):

For programs that are more than one file, it is better to replace “this program” with the name of the program, and begin the statement with a line saying “This file is part of NAME”. For instance,

    This file is part of Foobar.

    Foobar is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Foobar is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Foobar.  If not, see <http://www.gnu.org/licenses/>.

This statement should go near the beginning of every source file, close to the copyright notices. When using the Lesser GPL, insert the word “Lesser” before “General” in all three places. When using the GNU AGPL, insert the word “Affero” before “General” in all three places.
sergent commented: Thanks +0
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

From the Javadocs:

Causes the currently executing thread to sleep (cease execution) for the specified number of milliseconds plus the specified number of nanoseconds. The thread does not lose ownership of any monitors.

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

Which version of HttpClient are you using? 3.x? Also, I could have sworn the default port for HTTPS was 443...

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

Moved the thread.

BTW, consider the possibility of your account being compromised and some third party entity already knowing your current user name and password. You should ASAP get your password changed and then think of finding out *how* exactly this happened.

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

Adding on to others, it also pays to know that cloning in Java is pretty much broken and for practical purposes you are better off using other alternatives (hand rolled copy constructor).

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

There are a lot of websites out there which provide source code hosting. Few of them are Google Code (supports svn, hg, git), Github (git) and Bitbucket (hg + private repositories).

Github is pretty famous (in terms of activity) and Bitbucket is the only one AFAIK which provides unlimited private repos.

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

Glad it worked out well for you, good luck with your project! :-)