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

Look into a library called JAXB. It basically eases the task of XML <-> Java objects conversion. The steps would look something like this:

  1. Analyze the XML file format and create a XSD out of it (this is the difficult part)
  2. Autogenerate classes from XSD using xjc
  3. Load XML file and create objects of out it using the JAXB API
  4. Use JDBC to insert those objects in the database

One tutorial which highlights the steps above is this. Once you have the objects, inserting them into the DB shouldn't be that difficult.

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

The server is in C and it uses INADDR_ANY as local address which i always thought was 127.0.0.1 right?

I don't do C but after reading a bit, it seem that INADDR_ANY binds to all available interfaces on the host which should ideally make the server available to any machines on the network. If you are sure that all the servers are "started" in the same way and all the configurations are same, I see no reason why the some hosts should work while other don't. Really strange...

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

.my tomcat server has around 128MB runtime memory

Is that 128 MiB just for permagen space or total JVM memory? Unless you explicitly specify permagen size, a small number like I guess 64 MiB is picked up (depending on your exact JDK version, OS version/flavour etc.) which is certainly not enough for "enterprise" Java. So to be clear, permagen memory settings are different from the normal Java heap settings.

For Java versions < JDK 7, the permagen space contains the loaded classes, string pools and other metadata. When you start up a web container, it not only loads the JDK classes but also classes from the Tomcat JAR files which is by no means a small number.

Check the command line in Tomcat you are using to spawn/start the server and search around (using Google) ways to configure permagen for Tomcat.

EDIT: Maybe this link

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

That error means that your XML file doesn't conform to the XML schema specified for that particular file. So basically it's trying to say that http:basicAuthSupplier is not a valid child for the element http:conduit. I haven't worked on CXF but you should have a look at this CXF wiki page or look at the XSD schema to check the valid combination.

peter_budo commented: Well done :) +15
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

URL encoding/decoding rules are different from the HTML ones hence URL decoder should only be used for decoding URLs. HTML encoding uses ampersand encoding (&) whereas URL encoding uses % encoding.

For HTML decoding, the StringEscapeUtils class from Apache commons should be used.

somjit{} commented: good info +0
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

i don't know how to unescape that sequence into java string..could anyone please help me with this??

That's not how a normal HTML response looks like. If that service is in your control, the first action should be to investigate why you are getting hex encoded HTML entities as opposed to a normal string.

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

umm , im not sure what that meant , the class files were inside the bin , and the bin had itself vanished.

I mean when you realized that you didn't have a bin folder, instead of searching for that folder, you need to search for the .class files. Assuming your Eclipse preference is to build automatically, the class files have to be generated somewhere. If not in bin then in some other folder. Unless of course Eclipse starts acting weird and refuses to generate the class files.

regarding github practices , iv seen some people post onlythe source files , is that good ?

That's the norm; almost always, source control is for source code, config files and scripts. Except in some cases like game development in which assets are checked in too as a backup.

so far , i work alone , and i use eclipse when things get complicated , so i thought of uploading the entire project

Nothing bad about that as long as you know how an ideal project should look like. Just make sure that whenever you are uploading an Eclipse specific project, you:

  • Upload the .project file
  • Upload the .settings folder
  • Skip bin and target folder
  • check if the .classpath file contains absolute paths. If it does, no point in uploading it. Otherwise if it refers relative projects, you can upload it as long as the person checking out that project also checks out the dependent projects.
somjit{} commented: good ans , me wants to give reputaion , hence forced to make a crappy comment :P +0
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

On a related note, this is one of the reasons why you build an Ant or a Maven project since that way you don't end up uploading IDE specific stuff. Since you are already on Github, search around for other Java projects and look at how they manage project dependencies + structure using something like Maven or Gradle. The Eclips Maven plugin m2e makes it simple to create a Maven project.

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

You almost never push autogenerated class-files to your repository unless it's in the form of a JAR. Even JARs can be avoided by providing relevant ant files or maven files for that particular project in which case the user can just build the entire thing on his own.

For your particular problem, not much can be said without looking at the actual repository but if your "pushed" project to github had some absolute paths somewhere in the config, there can be issues. There are also Eclipse project configurations available which put your generated class files in a different folder as opposed to the default 'bin' folder. That might be one of the reasons. Instead of searching for 'bin' folder, you should have searched for the .class files.

somjit{} commented: valuable info +3
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Problem is that too many folks jump directly to patterns without understanding how the code looks without them or facing the problems first hand. The line of thinking goes something like this:

"I'm now creating a class which might get used from a lot of other classes, flexibility is a must. Let me use abstract factory to abstract out the creation. Oh and strategy just in case I need to change the behaviour based on composition. But what about default behaviour? Let me just create a singleton for that."

And this is all without writing a single line of code. Now you can see where this is heading to.

Design patters are not bad per se but "if all I have is a hammer, everything looks like a nail" and "flexibility of my classes is of prime importance" leads to nightmares as already mentioned above. This is the reason I strictly ask junior programmers to not put in a patter unless they can show me the problems that the current code is causing and put a solid case of listing down the benefits our project can get by using a particular pattern. Works well in most of the cases...

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

Welcome Jorge! Oh and don't believe deceptikun; he likes to scare the new mods away. ;)

JorgeM commented: no worries, I'm not scared easily +0
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

incredibly usefull to have a language that was both dynamic AND statically typed

Such languages are called optionally typed languages.

I'm not a big fan of such languages since it seems like a half assed attempt though I'm sure many swear by it. The advantages being:

  • Writing dynamic code when you don't care about the types
  • Start type annotating your code when you feel you need them

But the thing is, modern languages are immensely powerful and include a lot of features which cut down on the boilerplate code and make your life easier. That too to an extent that it makes them look like dynamic languages (since you can omit types due to type inference). As an example, consider the following snippet in Scala:

val names = List("sanjay", "vikas", "nick", "david", "alan")

// shortNames: List(nick, alan)
val shortNames = names filter (_.length <= 4)

// lengths: List((sanjay,6), (vikas,5), (nick,4), (david,5), (alan,4))
val lengths = names map (x => (x, x.length))

In the above snippet, the compiler knows that names represents a list of Strings even when you don't specify string anywhere. Similarly, map and filter operations know they are operating on list of strings. I would say that's pretty damn close to a code written in a dynamic language with all the benefits of a type system.

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

r is an instance of ResizingArrayQueue whereas the display method is part of ResizingCircularArray?

stultuske commented: guess I missed the obvious there :) +14
somjit{} commented: *facepalm* to me. +3
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I would personally start with this for a very high level view or maybe this if you are into whitepaper and stuff.

A more detailed tutorial of JAX-WS
A more detailed tutorial of JAX-RS

In short:

JAX-WS*: Enterprisy web service. Request and responses are in terms of XML payloads/envelopes. Not bound to HTTP; for e.g. you can use JAX-WS with JMS.

JAX-RS: Lightweight alternative to creating web services. HTTP only. Much simpler and recommended if you don't need the fancy stuff or catering to non-HTTP clients.

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

If you have a handy link to some suitable reference I'd appreciate it, if not don't worry, I'll find it myself.

The reason is that hyphen (or dash) character has a special meaning when used inside a character class (i.e. stuff between the square brackets) which is basically specifying the character range. You can get around it by either specifying it as the first or the last character in the character class or escaping it with a backslash. I can't find a definitive reference but this SO link covers the material in a pretty good way.

But, including it at the front or end looks cleaner

Agreed, especially given that Java doesn't have raw strings. ;)

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

Just ensure that if you need to replace the literal -, it is always either at the start or at the end of the replacement set. For e.g. txt.replaceAll("[- _?]", "*") works, txt.replaceAll("[ _?-]", "*") also works but txt.replaceAll("[ _-?]", "*") doesn't.

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

Firstly, read this: checked v/s unchecked exceptions

in line 10 the method quotient throws an exception that will be caught by the catch statement

Wrong phrasing; there is a possibility that the method quotient might throw an exception. When a method has a throws clause, it means that the method might throw that particular exception (you can have multiple exceptions but you get the point). The most confusing part with exceptions is that when you are dealing wiht unchecked exceptions (i.e. exceptions which extend the RuntimeException class), you are free to omit the throws declaration when defining methods. But, the important point is that the method can still throw an exception. As an example:

public int intDivide(int a, int b) {
  return a / b;
}

public int intDivide(int a, int b) throws ArithmeticException {
  return a / b;
}

Take a look at the methods defined above; what difference do you see? The only difference is that the second method explicitly mentions/states/informs the method consumer/user that intDivide can throw an exception. Notice that all this is orthogonal to the fact that both of them will throw an exception when passed b=0. It's just that the second method mentions it explicitly but the first one doesn't. Why is this possible? Because ArithmeticException is an uncheked exception.

Now let's consider the example of a checked exceptions:

// invalid
public int readFromFile(InputStream in) {
  return in.read();
}

// valid; works
public int readFromFile(InputStream in) throws …
iamthwee commented: solid +14
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I'm going to leave it as is for now, but track its usage, and please let me know how often you guys find yourself using it.

Dani, I would really suggest at least providing a tooltip for the green arrow, something like (Spellcheck + Preview) or provide a "Help" link to its right which shows what the different editor options do. I click on the green arrow a few days back but since I didn't have any spelling mistakes, I assumed it was just for toggling editor preview.

Octet commented: I thought the same thing, it was only after seeing this that I realised it was a spell checker as well. +0
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

This snippet without headers doesn't seem to have this problem. There is one more possiblity which I missed the first time: the OP might have actually posted the HTML escaped code snippet. I have posted a comment on that snippet thread; let's see what he has to say.

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

It functions more like an IDE than a textbox. You can tab to indent, shift+tab to go back a tab, etc. It's all color-coded so you can easily see where a link is, what is considered code, etc. None of that is possible with a regular textbox.

I believe if we keep a poll to decide between whether to have a spellchecker or whether to have the "tab"ing functionality, spellchecker would win. :)

I have access to moderator tools on both Daniweb and SO and I don't think editing on SO is any more difficult than editing on Daniweb.

That's because SO takes the approach of quickly and cleanly deleting every post that is formatted incorrectly

I'm afraid this isn't true. Spam posts are deleted and trivial/frequently asked/vague questions are closed. But if a post has good content but is formatted incorrectly because the OP doesn't know how to use Markdown or has messed up, the community takes care of formatting the post for the OP. If I'm not mistaken, there is a metric which keeps track of how many meaningful edits you have made but that's just part of the SO number game.

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

Have you tried the zip command?

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

so in a multithreaded program if i had my song class that was shared between two or more classes then they could possibly both have the ability to change song objects. then this could lead to the program not functioning correctly. If you have time and don't mind making an example I would love to see it.

It need not be a multi-threaded program. Mutation related bugs can slip in even for a single-threaded program though they are normally more painful and hard to find in case of a multi-threaded one.

As an example, let's say that you plan on providing a "replace" functionality to your users of the playlist class. So basically, they can pick an existing song from the playlist and replace it with a new one. If you resort to mutation (to save memory as they all say) and instead of creating a new song, try modifying the existing song, this is what happens:

MP3_Player ipod = null; // initialize with songs; assume
Song toRemoveSong = ipod.getSongByName("Hotel California");

// we need to maintain a list of removed songs
List<Song> removedSongs = new ArrayList<Song>();
removedSongs.add(exisingSong);

// In some other method; try replacing the song
Song oldSong = ipod.getSongByName("Hotel California");
oldSong.setTitle("Baby");
oldSong.setArtist("Justin Bieber");

// Show the songs user has removed from the ipod
showToUser(removedSongs);

In case you haven't noticed yet, we are hosed. Since Song is mutable, the list of removed songs now contains 'Baby' instead of 'Hotel California' and you have lost the song …

nova4005 commented: Thank you for the great examples +1
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I do have one thing to ask though just for clarification on point 4. I think I understand but you mean that I should lean more towards using the constructor than using the mutator methods?

Yes. So instead of:

Person p = new Person();
p.setName("sos");
p.setAge(666);

prefer

Person p = new Person("sos", 666);

To add to this, if you don't plan on changing the fields after the object is created, you can also mark them as final and be rest assured that there won't be any accidental assignment or mutation to these fields. It doesn't make a lot of difference in a single threaded program but become really important when you start using threads. Shared mutable state (i.e. sharing a Person object between two threads wherein the fields are mutate/can be set) can lead to headaches as the system grows in size. So for e.g. if you are asked to add a new song to the playlist and remove an existing one, instead of "mutating" or modifying the object you plan on removing, it's better to actually remove a given song object and add a new one. In short, stay away from unnecessary mutation! If you want to know more or need a detailed snippet to showcase the problem, just let me know and I'll write it out for you.

Does that come with the netbeans installation or is it a plugin that I can install seperately?

Some IDE's like Eclipse come …

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

A few more if you are game:

  • Use camel casing when naming methods/classes/variables etc. as opposed to snake case (e.g. MP3Player as opposed to MP3_Player)
  • Don't blindly provide getters and setters for every field in your class. For e.g. you already have addSong and removeSong methods in your code; why provide a getter for songList. This is made worse by the fact that since songList is mutable, I can add/remove songs without triggering your checks which is not a good thing. If you still have to provide a list of all the songs, wrap up your list in an immutable wrapper which the user can iterate but not mutate.
  • Think twice before adding methods; for e.g. why do you need a default constructor for MP3_Player?
  • Favor constructor initialization over setters
  • Be extra careful when validating user input. Currently you check for blank titles i.e. "". What happens if I pass in " "? Is that a valid title? If not, does your code catch that?
  • Try out testing frameworks like JUnit for testing/validating your code.
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Waiting for the java version of the API...When can i expect a java version?

Daniweb API is web based (or more technically a RESTful) API and as such doesn't require a language specific version of it. It's HTTP all the way. All you need to use the API in Java is a HTTP client library (like Apache HTTP Client), a JSON library like Jackson and you should be good to go. If you are still unclear about the concepts, search around for "java rest client" or something along those lines.

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

You need to think why a code is written before adding in code. When you write: hello helloworld = (hello) context.getBean("helloworld");, what are you expecting it to return back? How do you think Spring will get back the hello object for you?

Take a few minutes and read the error message carefully. The error basically means "the context XML file which you have loaded doesn't have a bean called 'helloworld'" which is correct. Now the question is how can we fix this error? You already have defined a bean in the XML file but it isn't named "helloworld". How do you think can we do away with this error? Can you think of a way of replacing or modifying the code such that your class Main works?

On a related note, always put your class in package and follow Java coding conventions. hello is not a good name for a class. Also put this and the Main class in some sort of a package like test.

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

You need to be either a sponsor, team colleague or part of the Daniweb team to be able to set custom titles.

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

The specification explicitly talks about little endian data and NUL (\0) terminated strings (like C programming language). You are better off using FileInputStream which reads raw bytes and handle them explicitly in your application. Java uses big endian so default method calls (readInt etc.) won't get you anywhere.

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

Looks good though there is a small issue. Normally the factory method/classes used for the flyweight pattern have the same signature as the constructor of the object which you want to cache. Your solution looks more like a static cache since there is no capability of creating new chemicals on the fly if they don't exist.

The client code should ideally use the factory as follows Chemical c = ChemicalFactory.getChemical("Sulfer", "S", 32.0);.

On a related note, if you already know the number of items you can have in all, prefer using an Enum with an helper class, which offers a bit more type safety.

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

That's a good question!

JUnit and Servlets (basically your web apps) are frameworks. What a framework does is it runs the code you write which adheres to some common guidelines (e.g. in the case of a JUnit test, you either extend the class with some JUnit class or decorate the methods with the @Test annotation).

As to how it happens, its done entirely via reflection in both the cases. JUnit has the concept of "runners" or basically classes which run the test code. When you right click on the file and say run as JUnit test case, the Eclipse JUnit plugin calls one of the runner classes (in case of Eclipse BlockJUnit4ClassRunner) with the fully qualified name of your class to be tested. After that, it's all reflection magic by creating an instance of your test class, grabbing the special JUnit methods and executing them in some sort of wrapper/controlled environment.

In case of web apps, you specify the servlet fully qualified name of the servlet class in the web.xml file. The servlet container takes this name, tries to load and instantiate the class dynamically and if it succeeds, casts the object an appropriate servlet type (e.g. HttpServlet). I know this is all hand-waving and the details might deviate but the general idea remains the same. The web container/servlet container is very much aware of all the applications you have deployed, the URL's it is supposed to handle, the mapping between a given URL and a servlet etc. Thus, when …

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

It's OK as long as you are consistent within a given code base though generally not recommended if it is meant to be consumed (used and read) by a wider audience (i.e. other Java developers). Also, in your case, you are better off with naming the variable as dead and the getter/accessor method named as isDead (if you have an accessor method that is).

IMO, just stick to the official Java coding convention and it should work out fine.

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

It isn't really that complicated IMO; just use jLine; it works out of the box on Windows (and I believe *nix too)

Try out this simple snippet after adding the JAR to classpath:

public class Test {

    public static void main(final String[] args) throws Exception {
        ConsoleReader reader = new ConsoleReader();
        Character mask = '*';
        String line = null;
        do {
            line = reader.readLine("Enter Password(blank pwd to exit)> ", mask);
            System.out.println("Got password: " + line);
        } while (line != null && line.length() > 0);
    }

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

, the other is a scripting language, which can only run front-end in a webbrowser.

This isn't true; look at Node.js. It provides all the API calls required to do I/O (network connections, read/write files etc.), integrate with other C/C++ API's out there (by writing node.js libraries which wrap them) etc. In short, a stand-alone Javascript implementation. Of course, it isn't the first; there are others like Rhino, an implementation of Javascript in Java.

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

I think you can get the best of your endorsement system by looking at the endorsements of those who you think are trustworthy/endorseworthy since there is a high chance they will endorse folks with some merit. But I agree, it's more of a personalized benchmark; you might disagree with what I agree with.

tux4life commented: I agree. +0
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The documentation told me that base 10 was assumed if you didn't pass in the second argument!!

Oh noes, there is no such thing specified in the specification. The MDN goes to great lengths to even mention this:

An integer that represents the radix of the above mentioned string. Always specify this parameter to eliminate reader confusion and to guarantee predictable behavior. Different implementations produce different results when a radix is not specified.

:)

EDIT: If you plan on always dealing with base 10 numbers, using the Number constructor is a safer option.

tux4life commented: :) +0
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Consider using enums for Suit and Rank instead of raw strings, much safer and saner approach IMO.

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

what are some basic things or steps you can advice..thanks

Start small and start quick with a rough design sketch in your head/paper. Don't be bogged down by the big picture. Always try to divide stuff into small bits and pieces. The first and foremost focus should be to get it working. How it is done depends a lot on your way of thinking: some start by identifying the primitive parts of the application and writing it piece by piece. You can have your own preference.

As your system evolves, be prepared to throw away your code if need be. The day you replace a 100 line code with a 20 line one (of course same functionality and more elegant) should be a good day for you. :)

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

It's not a typo, it's a slang term.

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

application/x-www-form-urlencoded (the content type when you do form submissions in browser) should also work out fine I think; the API is basically expecting POST data.

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

This news is a great step ahead I think. I'll take a look at this API when I reach home. In the meantime:

Not right now. (Gosh, should I say that in public?)

You can implement a rate-limiting feature similar to something used by Github I think. Each user (or some user group) can implement X API calls per day / per hour etc. Once that limit is reached, all further API calls return a denied HTTP status.

EDIT: Also, this opens up a distinct possiblity of a clean slate implementation of a true mobile compatible Daniweb.

tux4life commented: Good suggestion :) +0
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

There are some site wide issues going on (as already highlighted by other ongoing threads in the feedback forum). Hopefully it should be fixed in some time when Dani/Deceptikun are online.

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

Minor stuff aside, this snippet has other problems. UUID is unique because of all the bits it has. Substring of a random number itself isn't random. If you'll read the UUID specification (which I think the UUID class follows), the different range of bits in an UUID stands for different components. You can't pick them apart and expect them to be unique. My personal vote goes out to the nextLong method of the SecureRandom class. You get a long datatype back and it's crptographically strong.

On a related note:

The objective was to give a certain custom Object a unique identifier in order to allow me to store them in a hashmap

IdentityHashMap doesn't work for you? Also, for live objects, identityHashcode is also unique since it is basically the memory address of that object which has to be unique unless we end up re-using the address space (which happens something is garbage collected hence the warning that it works only for live objects).

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

Hi folks,

Winter 2012/2013 anime season will start in a few days! Here is a list of the anime which will air this coming season. As far as initial thoughts go, this season doesn't look that exciting. The anime which I'll be definitely following are:

I normally present a list of promising shows but this time around, reading the description isn't helping me a lot so I'll just leave it off to watching the first few episodes and then deciding for myself.

So, what's your list? Any promising anime I should look out for?

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

IIRC, this happens when Daniweb includes some content (javascript/images/widgets etc.) from an external domain which is not allowed or is blocked by your ISP. Corporate ISP's are notorious for blocking a lot of sites. So basically it starts loading some resource and perpetually hangs up because the host/domain is blocked by your work proxy. Not 100% sure but this might be one of the reasons.

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

I'll try to answer the points applicable to me:

What value do you get from helping people?

It sucks to be stuck on something when you are trying to learn stuff. This is when books don't help and the online resources are not enough. My aim here is to just help out people who deserve it so that they can learn stuff quickly and get into the thick of things rather than get frustrated and give up on something. Of course, doing this for each and everyone is not possible but I try. And anyways, who doesn't like to show off? ;)

Has DaniWeb helped you forward your career?

Yes; when helping out folks you end up trying a bunch of stuff yourself. This helps me learn new things which in turn makes me a better person at my workplace (well, at least technically).

Have DaniWeb community members evolved into quality online friends?

I would say yes. I'm not really a Twitter/Facebook type of person so I'm not in constant touch with others, but yes, I know a lot of good people here with whom I would definitely chat when I get time (new chat system, I'm looking at you!).

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

The class won't compile?!

Because you have already assigned null once to the field s. The correct way is to do:

public class Test {
  private final String s;
  public Test(final String s) {
    this.s = s;
  }
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

If you want a bounded queue (one with capacity) for producer consumer, use a LinkedBlockingQueue or ArrayBlockingQueue and its methods, put and take which automatically block/wake the corresponding thread.

For e.g. put on a full queue will block that particular producer whereas take on an empty queue will block that particular consumer. Perfect for your use case IMO.

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

The first piece of advice; catch stuff only if you plan on handling it. And by handling I don't mean printing stuff on the console and carrying on your merry way. One logical use case can be a retry-logic. If you plan on trying to connect to a host with a retry-counter, you would normally catch the connection exception, increase the failure count and try again.

Also, make sure you always close resources in the finally block since that's the only block which is guaranteed to be executed. So either you end up having try catch for each close method call or end up skipping closing a few resources. Since closing resources is a pretty repetitive task, a lot of folks end up using utility classes like the one posted below:

class Utils {

    private static final Logger log = Logger.getLogger(Utils.class.getName());

    /**
     * Close a list of AutoCloseable objects quietly. Works for pretty much all types of resources. But works only with
     * Java 1.7+
     * 
     * @param closeables
     */
    public static void closeQuietly(AutoCloseable... closeables) {
        for (final AutoCloseable resource : closeables) {
            try {
                if (resource != null)
                    resource.close();
            } catch (final Exception e) {
                log.log(Level.WARNING, "Exception when closing resource", e);
            }
        }
    }

    /**
     * Close a bunch of Closeable objects silently; doesn't work for DB resources like ResultSet, Connection etc.
     * 
     * @param closeables
     */
    public static void closeQuietly(Closeable... closeables) {
        for (final Closeable resource : closeables) {
            try {
                if (resource != null)
                    resource.close();
            } …
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Howdy folks,

Fall 2012 season has started airing! The final draft for the series to be aired can be found at the Neregate blog.

I'll be absolutely watching the following series:

The following look promising so I'll definitely try them out:

All in all, I think this season has to offer a lot of "looking good" anime. Let's see how it actually turns out.

So, what's caught your fancy? Don't be afraid of speaking up; I swear I won't call you an otaku. ;)

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

isn't there any way that you can know who is down-voting or up-voting your posts ? if yes, then how can i know that ? thanks ;)

No, there is no way by which a Daniweb member can know who is down/up voting his/her posts.

may be this feature can be added. ;)

Not happening unfortunately. In a distant past, the only way to show appreciation/disdain towards a post was "add reputation" feature which publicly showed the name of the person adding/deducting your reputation. As you can imagine, it resulted in up/down rep flame wars between individuals and groups. In short, it was quite a mess. Plus some folks are not comfortable with their name being showed when they like/dislike a post and prefer to remain anonymous. The public nature of the system drastically reduced the voting/rep activity on the site.

The current system is an attempt to get around those peculiar situations. If you want to publicly express your like/dislike, just use the add/remove reputation feature. If you wish to remain anonymous, use the up/down voting feature. Of course we are open to complaints wherein a given member is continuously down-voted on all his posts by a single member or is a target of an auto down-voting script.