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

Seriously this should be a website where people are allowed to make mistakes ESPECIALLY NEW MEMBERS

Yes, but it's our job to bring members on track when they make such mistakes. You should understand that you ignored rules which clearly say that site wide signatures need to be used instead of using URLs in your post. If you didn't understand the term (site wide signature), you could have easily posted a question and people would have gladly helped you out.

SO FOR SANJAY who gave me a negative feedback THANKYOU FOR BEING SO UPTIGHT DUDE CALM DOWN! I was just posting my appreciation for this site NO NEED TO HAVE A HEART ATTACK OVER A HYPHEN INITIAL AND HYPHEN ALRIGHT?

I was just doing my job, really. And the warning was not for using initials but having link in your post.

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

Nick did a good job of coming up with the approximate formula used when deriving rep:

This is how I figured it's sort of working; you get +1 power for:

  1. each year of membership
  2. every ~1000 posts
  3. every ~500 reppoints
  4. negative rep power is half your +power with floor-rounding

.

The entire thread here (Area 51).

Lusiphur commented: I know it doesn't work in feedback but, it's the thought that counts right? +0
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Just flag the same post again requesting it to be ignored, should do the job IMO.

Also, the flag bad post isn't in any way related to the age of the thread/post. If a member finds something inappropriate with a year old thread (spam/other violation), reporting it makes sense though practically speaking this isn't a regular occurrence. Spam posted in 1999 is still spam in 2010, if you know what I mean. :-)

Lusiphur commented: Ya, I know, feedback forum = no rep but still! +0
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> We are planning to make a commercial GUI based software (for both desktop and
> mobile) targeting individual users

IMO, Adobe AIR has the slickest desktop UI out there but suffers from the lack of mature libraries for almost anything when compared to Java/.NET. Personally, I find Swing applications to be kind of sluggish. If you decide to go the Java route, SWT/JFaces is something you should look into.

> Which one has best Rapid Application development tools?

Eclipse and Visual Studio are probably the best IDE's out there, the difference being, Visual Studio requires a license.

> What are licensing costs w.r.t development IDE, client tools/framework etc as well
> as royalty based costs associated with distribution of software

AFAICT, anything created using Java + open source tools/frameworks doesn't require you to have a license or pay any sort of royalty. You'd require a license to develop using Visual Studio but distributing applications created using Visual Studio doesn't require you to pay any sort of royalty; though I'd confirm this in the appropriate forum (C# forum) since I don't develop using Visual Studio.

If you are interested in developing using MS toolchain but feel deterred by the licensing costs, you might want to look at Mono and MonoDevelop.

> What would be the best database option available for such software

Database for what? Does you software require being connected to a centralized server for …

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

doGet method maps to the code executed when your servlet receives a "GET" HTTP request. doPost method maps to the code executed when your servlet receives a "POST" HTTP request. These methods are internally called by the `execute` method of your servlet (a lifecycle method) based on the HTTP method of the request received.

If you have specifically created a servlet which handles only POST requests (uploading etc.), you'd normally override the doPost method. Any other HTTP method used to access your servlet would result in a "method not supported" exception (well technically it isn't *any* other method but you can ignore the difference for the time being).

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

> So is it necessary to successful software engineering or just option?

Absolutely necessary if you are working with a dynamically typed language like Python, Ruby etc. where values have types, variables don't. In the absence of unit tests, aggressive re-factoring becomes risky due to the lack of compile time checks and you end up with breaking existing code if you are not careful.

Not really necessary when working with statically typed languages like Java which offer decent compile time type safety. Changing method signature, class name, method name etc. results in compile time errors. Changing logic still requires proper verification but there's nothing which a decent testing round can't uncover. Though I must admit the turnaround time for testing a new/changed functionality is pretty short when it comes to unit testing.

The greatest pitfall when advocating unit tests is that it ends up giving developers/managers a false sense of security. Unit tests are not magic; they end up testing code the way you have "written" it to be tested. Countless times I have seen code bases littered with "unit tests" which did nothing more then instantiating the class to be tested and invoking random methods here and there.

Discipline is of prime importance when it comes to writing unit tests. I strongly recommend junior team members/programmers/unit testers being mentored by someone who *knows* his stuff to avoid turning the entire application unit test code base into a big pile of useless ****. :-)

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

Hi ~s.o.s~,

i still have "Cannot forward after response has been committed" error, even i have changed the code accordingly. Can help me take a look and advise me what is wrong with my code? =( Thanks.

~s.o.s~,i really thank for your help.

<%
            if (request.getAttribute("login") == null) {
                RequestDispatcher dispatcher =
                        request.getRequestDispatcher("/login.jsp");
                dispatcher.forward(request, response);
            }
            if (request.getAttribute("cash") == null) {
                RequestDispatcher dispatcher =
                        request.getRequestDispatcher("/login.jsp");
                dispatcher.forward(request, response);
            }
%>

You still haven't made those changes; like already mentioned if both 'login' and 'cash' are not present, you end up doing a `forward` twice. Replace the second `if` with an `if..else` and it should work out fine.

Also, try rewriting your code. Put the forwarding logic in a Servlet and have three conditional checks instead of the two present right now. Create three JSP's; no_cash.jsp, no_login.jsp and normal.jsp. Inside the servlet, write something along the lines of:

protected void doGet(HttpServletRequest req, HttpServletResponse res) {
  if(noLogin) {
     // forward to no_login.jsp
  } else if(noCash) {
    // forward to no_cash.jsp
  } else {
    // forward to normal.jsp
  }
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Though I haven't used them, Apache PDFBox and iText seem promising.

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

As a servlet developer you need to make up your mind -- whether to do the processing in the servlet and use it for sending a response to the client OR add/update request/session/application scoped parameters and let some other managed component (another servlet/jsp page) handle the processing/response creation.

The HTTP servlet specification creates an abstraction over the HTTP request/response model. Once response is sent to the client, it can't be *revoked* and a new one be sent. When you say `out.println()`, you are effectively pushing the HTTP response to the client or more specifically "committing" the response (assuming that your output buffer is already full). After that, any attempts at `forwarding` your request to some other resource for processing gives an IllegalArgumentException.

Does your server log show any exception stack trace when you make your request?

javaAddict commented: You know your craft +6
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

>> String l = Doc +"\\"+ file;

The problem is with this line. Windows uses backslash (\) as the file separator whereas *nix uses forward slash (/) as the file separator. The simplest solution here would be to *not* manually create file names/path but use a method which automatically gives you a list of File objects in a directory.

File dir = new File(baseDirPath);
for(File f : dir.listFiles()) {
  if(!f.delete()) {
    System.out.println("Failed to delete file: " + f);
  }
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> Link colors have NEVER changed for read/unread threads.

If not the colors then maybe the style (bold and not-bold). I'm pretty sure that in previous versions it was really easy to identify read threads based on the link formatting. Now no matter the state of the thread, the link always maintains the same style/color.

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

I guess I'll take this opportunity to tell things which have been bothering me for quite some time after the upgrade:

  • The font family; it's bad IMO, to an extent that the font face ends up giving more importance to the surrounding bell-n-whistles and less importance to the content. Many here would agree with me that we have to *squint* our eyes to read the question. This is amplified by the smaller font used inside quotes having the same font family.
  • The color scheme used; I really don't have problem with purple but the way a post is represented (white background inside light gray) again ends up putting strain on the eyes.
  • Different colors for read/unread threads. Icons are nice but the link color *needs* to change. This is because it has been always this way. If I have to look at images to see which threads I've read/not read, it ends up being quite a bother.

Other than these things, I really don't see anything else which would be a big hindrance when browsing/using the site for a long period of time

jephthah commented: that sums up everything that still bothers me. +0
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> I just noticed that daniweb profiles are web searchable. I wasn't expecting this

Really?

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

Apologies, it's a typo there. I meant:
"Dani, please make it so that quotes are *NOT* hidden by default and clicking on the quote header hides the quote".

:)

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

This design doesn't suck - well not altogether - but it ain't good.

Maybe it isn't and that's why we have suggestions pouring in, trying to help out with the cause here. IMO, if everyone started taking "breaks" and everyone stated that they were "done with the site", there would be nothing left to improve here.

At least one is saying it here: http://www.daniweb.com/forums/post12...ml#post1219253

Yes, he does say that. Reading that post/thread really makes me sad. Not because a "trusty" Daniweb member decides not to post to the site. It's because I'm surprised how demanding/unrealistic people can get. Noticed the number of feedback threads created in the 'Feedback subforum' over the last 24 hours, not to mention the thousands of "suggestions" offered in each of them? Do people really expect all these suggestions be implemented ASAP esp with a single person (a small team?) doing all the changes?

So let me say this again, I'm not a big fan of the new design. Heck, even my posting activity has come down significantly. But I, being a "trusty" (hopefully) member of this forum, decide to wait and watch rather than roll my eyes and walk away...

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

Sorry to say, but that is about to change. Some of the trusty posters are leaving already.

Really? That's a pretty bold statement. Confused and irritated maybe. Leaving? Don't think so.

@Everyone
This is normally how new changes are rolled out on Daniweb. The new features which need to be introduced are made live, feedback is collected from regulars, changes are made to the site, rinse and repeat. I'm pretty sure that with the help of suggestions given by the regulars along with Dani working on them, things would be the way everyone likes it in a couple of weeks.

The new changes are a bit irritating but saying things like "this new design sucks" etc. instead of giving suggestions and waiting patiently for them to be resolved isn't fair IMO.

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

1. What is the best way to manage such project so that we won't collide?

Use a version control system. Having your code placed at a central repository which would then be used by collaborating developers is probably the best way to track of changes made to files and share code in a clean way without mailing each other 'zip' files. That being said, how you implement this in your project depends on a couple of things. Do you have problems with your code being publicly exposed/published?

If not, then head over to Google code which is basically a free project hosting solution provided by Google. You can to choose between two version control systems (VCS); SVN which is a centralized VCS and Mercurial which is a distributed VCS. Though the concept and adoption of the latter is gaining pace among the developer community I'd still recommend going with SVN since it seems to be version control of choice used all the "enterprisy" organizations out there. Learning SVN would would probably give you an upperhand over the other beginner programmers when it comes to trying out professional programming since it looks good on resume. Assuming you would be developing using Eclipse, there are plugins available for both the VCS's so it would definitely provide a pleasant experience when it comes to developing and committing your code.

If this *isn't* an open source project, you might have to shell out a bit and buy a code hosting …

peter_budo commented: Nicelly writen +13
kvprajapati commented: awesome! +9
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> i want to know that whether Calender.getInstance() method is
> threadsafe or not.

AFAIK, yes, it is. Thread safe concerns normally crop up when you have destructive updates happening to an object. Calendar.getInstance() is a static method and doesn't alter any static fields of the Calendar class and hence is thread safe.

A word of advice though; just because a method is labeled thread safe doesn't mean you can use the corresponding class and always have correctness in your application. A classic example is the Vector class which has its `get`, `set, `size` methods synchronized but still has the possibility of exhibiting incorrect behaviour when used in your *custom* scenario. E.g.

if(vector.size() > 0) {
  // some complicated processing
  Element e = vector.get(0); // can fail!
  // Since by the time the control reaches here,
  // some other thread might have already modified the vector.
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

How about:

"If I am helpful, pls give me reputation points. Thanks!" ;-)

jonsca commented: That violoates the principle: "The first rule of rep club is you never talk about rep club" +0
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The JDK implementation of PriorityQueue is backed by an array and hence ad-hoc deletions tend to be expensive (multiple invocations of System.arrayCopy etc). You can try your hand at writing a Linked list backed priority queue or use ConcurrentLinkedQueue though the added cost of synchronization might not be acceptable in your scenario. In any case, profiling is your friend here.

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

FTP supports a mget command which can be used for retrieving multiple files based on the passed in file name/pattern. Look into your FTP client documentation for such support.

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

It kind of seems clunky and complicated at best. A couple of questions:

  • What do you achieve by dynamically loading your DAO class?
  • Why is your DAO throwing business exceptions? I'm pretty sure I have at some point in time replied to your post in the JSP section and asked you not to do so.
  • Why progamatically create database tables? Table creation/data population scripts are much more logical unless you have some weird requirement in which case you might want to mention that.

Your data access layer should be as simple as possible, really. Having loads of exception handling, connection management logic isn't good. You have two ways of improving your JDBC code quality:

  • Either create a mini framework which manages connections/transactions for DAO's
  • Use an existing framework and be done with it
kvprajapati commented: N/A +9
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

This indeed is a sad and shocking news. I've known Dave for quite a long time; first as someone who helped me learn C and then as a fellow moderator/senior member. He was one of the awesomest contributors of the C/C++ forums.

He was always up for political discussions and often sent me PM's regarding his views on Indian politics and other political matters which influenced India. He was a wise man who always looked out to learn something new.

He was a IRC regular and talked a lot about his family, work and the forum in general. The fact that he never mentioned his illness to me or to anyone on IRC or forums proves how strong willed & thoughtful he was.

Whenever I think of Dave, the pic of his beautiful little daughter smiling alongside of him comes in front of me. May God give strength to his family to carry on and live a life which Dave always wished for.

Dave Sinkula, you will always be missed. Rest in peace.

Your friend,
sos

:(

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

Is there another possible method as i am not very confident with using JScript??

Keep the same name for both the buttons and let them have different values.

<form action="addAttractions.jsp" method="post">
        <% out.println(tr); %>  // Outputs table rows of given data
        <tr>
            <td>
                 <input type="image" name="button" value ="Update" src="Images/b_edit.png" alt="Submit button1">
                  <input type="image" name="button" value ="Delete" src="Images/b_delete.png" alt="Submit button2">
            </td>
        </tr>
     </form>

In your servlet code,

String action = request.getParameter("button");
if("Update".equals(action)) {
    System.out.println("Update clicked");
} else if("Delete".equals(action)) {
    System.out.println("Delete clicked");
}

Buuuut, there is a long standing bug in IE wherein the button value is not submitted, but rather the X and Y coordinates of the button are (LOL?). This thread describes the issue pretty well with a couple of workarounds.

Hope that helped. :)

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

I sent a pm with what this is regarding. Is there anyone I can contact who can remove or edit this?

We can't delete this thread as per the site rules/acceptable use policy. You asked for help, you got help. Deleting this thread would deprive others of the hard work done and the time spent by jcao219 in answering this thread.

Quoting the 'Acceptable use policy' of this site:

Additionally, DaniWeb LLC reserves full rights and privileges to information posted to anywhere within the daniweb.com domain by its members and staff. Any and all information posted on DaniWeb may not be copied or used elsewhere, in any way, shape, or form, either on the Internet or in print, without prior written permission from Dani Horowitz.

In case your instructor demands an explanation, you are more than welcome to re-direct him to this post.

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

With all due seriousness, the world time at your disposal... ;)

WaltP commented: That's a great link!! +0
jonsca commented: Is "due seriousness" like "due North"? +0
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

At least Hakuouki would be aired on the 4th as per Animecalendar. I do see a lot of potential in some of the series, so no, can't tell whether this will turn out to be a horrible season without digging in. :)

Sulley's Boo commented: subarashiiii! domo arigato, sos-san .. +0
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Updated: Here is a chart which has got almost all the dates nailed down along with the series which would definitely be aired.

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

The problem here is that instead of having the commons jar file in the WEB-INF/lib folder, you have a commons-lang folder. This doesn't work for the simple reason that it's the jar files in the WEB-INF/lib folder which are on the classpath and not the jar files which are present in any of the sub-directories of the WEB-INF/lib folder. Move just the commons-lang-2.5.jar file directly under the lib folder and it should work out to be fine.

talha06 commented: Thank you so much for your helps and patient. +1
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You seem to be confused as to the way generics work in Java. Here E is a type-parameter which is used during compile time checks; there is no `E' when it comes to your generated .class files. Search for "type erasure" in java generics for clarification.

stephen84s commented: Bingo +5
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> My questions is how to convert TIMESTAMP value to a Java Date
> or Calendar Object ?.....

It seems that the Timestamp here refers to the Unix timestamp (which is the number of seconds elapsed since January 1, 1970 (midnight UTC/GMT). This is in contrast with the way Java timestamp works which is considered to be the number of milliseconds elapsed since January 1, 1970 (midnight UTC/GMT). Multiplying the returned value with 1000 should do the trick here.

Also, ensure that you don't fall in the trap of truncation while multiplying those values.

Date d = new Date(1265207400 * 1000); //is different from
Date d = new Date(1265207400 * 1000L); // or
Date d = new Date(1265207400000);

In case you are still wondering why, in the first declaration the integer result of 1265207400 * 1000 which is 1966688416 and not 1265207400000 , is passed to the Date constructor leading to erroneous results.

> Thanks in Advance

HTH

zac_mathews commented: This was very usefull and very helpful... Thanks SOS +0
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I am a touch typist and my typing speed falls between 60-70 wpm with 100% accuracy (no spelling mistakes) which IMO is pretty decent. My speed/accuracy can be attributed to not using chat/l33t speak even when chatting. ;)

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

| has a special meaning when it comes to regular expressions, it's called the alternation symbol.

If you have something like "##|##|##".split("|") , it's the same as "##|##|##".split("") since a single pipe symbol is the same as saying "alternate between a blank string and another blank string" which is the same as a blank string.

You can either:

  • Escape this pipe character and tell the regex engine to treat is at a literal pipe character. Something like "string".split("\\|")
  • Use character classes, similar to the example posted above (i.e. [|] )
BestJewSinceJC commented: Haha! I knew that | = or, but couldn't recall it at the time. +4
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Whoa! dhanyavad!

You are welcome :)

No comprende.... If the page changes, I thought the cache would be overridden.

*Only* if the the server sends proper headers saying that the file XXX has changed; without that the browser has no way of knowing that something has changed. This is the very reason why Dani sometimes requests members to manually clear their caches after she rolls in a new version of library or images...

Database The page istelf was still the same. It was just the database contents that does not get stored in the cache that changed. Ja?

No, nothing related to database as such. From the looks of the screen-caps you posted, it seemed like a case of missing CSS(stylesheet) files.

As a rule of thumb, always CTRL + F5 when you see something unexpected; if it still persists, time to create a new thread. ;-)

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

The problem with your previous implementation was that the invocation of next() was inside a condition which shouldn't have been the case. Also, you can again avoid casts by declaring next as E next = null; .

Again, like I said, making the method accept a Collection is plain wrong since a Collection doesn't support the notion or is not aware of indexed/ordered access. Your custom list implementation should accept only a List which would make your class semantically correct.

Anyways, here is my stab at it:

public class LinkedListTest {

    public static void main(final String[] args) {
        testNormal();
        testEmpty();
        testNull();
    }

    private static void testNormal() {
        List<Integer> list = new ArrayList<Integer>();
        list.add(10);   list.add(20);  list.add(30);  list.add(40);
        NodeList<Integer> nodeList = new NodeList<Integer>();
        nodeList.add(1);
        nodeList.addAll(2, list);
        System.out.println(nodeList);
    }

    private static void testNull() {
        NodeList<Integer> nodeList = new NodeList<Integer>();
        nodeList.add(1);
        nodeList.addAll(2, null);
        System.out.println(nodeList);
    }

    private static void testEmpty() {
        List<Integer> list = new ArrayList<Integer>();
        NodeList<Integer> nodeList = new NodeList<Integer>();
        nodeList.add(1);
        nodeList.addAll(2, list);
        System.out.println(nodeList);
    }

}

class NodeList<E> extends LinkedList<E> {

    private static final long serialVersionUID = 1L;

    public boolean addAll(final int startIdx, final Collection<? extends E> collection) {
        if (collection == null || collection.isEmpty()) {
            return false;
        }

        final int size = collection.size();
        if (startIdx < 0 || startIdx > size - 1) {
            throw new IndexOutOfBoundsException(
                    "An out of bounds index specified: " + startIdx);
        }

        int i = 0;
        boolean collectionChanged = false;
        for (Iterator<? extends E> iter = collection.iterator(); iter.hasNext(); ++i) {
            E elem = iter.next();
            if …
BestJewSinceJC commented: Very helpful feedback +4
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> Hum ... never new we could do that

Yes you can, and there's more where it came from. :-)

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

> Okay. So how do I search for a multi-word string in the forums?

I prefer to use Google for my power-searching needs. For e.g., in your case a query like site:[url]www.daniweb.com[/url] "free online television" when entered in the google search field should give decent results. Try it out, works out prettty well for me at least.

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

> This has already lead down the path of a typical serkan thread.

Indeed and thread closed to prevent any more casualties...

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

You need to implement some sort of buffered reading/writing; the way your code is currently written(single character I/O) it makes way too many I/O calls which can be a real performance killer.

A better option IMO is to use the libraries out there which ease the task of zipping/unzipping; some well known ones are 7-Zip-JBinding and TrueZip.

kvprajapati commented: TrueZip! Pure java. +6
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I wish all the Indians out there a very Happy 61st Republic Day! :-)

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

Initialize allData or allDccs (I guess there is some sort of mix-up here) in the while loop and you should be good to go without having to clear the list.

Anyways, to clarify up the matter, there is only one list in your case which is pointed to or referred by two different references. So when you say you clear one of those lists, you are actually using one of those references to clear the only list you have and hence it is giving you issues.

KirkPatrick commented: Thank you for the help and explanation of why it was going wrong. It helps to understand how/why code isn't working the way I intended it to. Cheers bud +1
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> Firstly, an abstract class from definition contains atleast one abstract method

Really? ;-)

abstract class MyClass {}

I don't want to open a connection to the database, write the record and close the connection, since I have to implement that for the other three subclasses and it's a lot of repeating code.

Yes, you are right, that's a lot of repeating code plus creating and closing connections is an overhead. Consider using a connection pool as a Datasource instead of asking connections from DriverManager. To get around the problem of repeating code (getting the connection, closing statements, result sets and finally the connection) create a class similar to SimpleJdbcTemplate which handles all the repetitive boiler plate code.

To have the same interface for both writing to STDOUT and database, create a StudenDao which exposes the insertStudent method and create two implementations for the same. Something like:

public interface StudentDao {
  void insertStudent(Student student);
}

public class JdbcStudentDao extends SimpleJdbcTemplate implements StudentDao {
  public void insertStudent(Student student) {
    someHelperMethodOfTemplate(yourQuery, student);
  }
}

public class LoggingStudentDao implements StudentDao {
  public void insertStudent(Student student) {
    System.out.println("Student name: " + student.getName());    
  }
}

Of course there might be other better ways/patterns of doing the same; these are the easiest ones.

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

Given that Dani is pretty busy these days, I've created a new announcement in the Web Development section for the time being.

As far as the entire 'homework help' debate is concerned, I personally feel that the ones who lose out the most when posting ready solutions are the OP and the one who has posted the solution. I've been posting on site for 3+ years and have learnt to differentiate between lazy homework requests and genuine efforts put in by the OP. Helping someone arrive at a solution by guiding them takes much more effort and patience than posting code that solves the question at hand IMO.

The entire 'teach a man to fish' v/s the 'here ya go kiddo' debate in the end boils down to ones understanding/interpretation of the 'Homework help' rule though I'm personally in favour of the former.

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

> I tried manipulating the blob datatype by setting..

The way you are going about to do this won't work. You can't render an image on your markup without using the IMG tag just by grabbing the binary content. You'd need to create a separate servlet mapping which would read the contents of the image from the database and write it out to the servlet output stream. You'd then use it like:

<img src="/yourWebApp/yourServletPath/grabImage?id=yourImgName" />
public class MyController extends HttpServlet {
  public void doGet(HttpServletRequest req, HttpServletResponse res) {
    // check if the path contains 'grabImage'
    String id = request.getParameter("id");
    // read the binary content using the code present in your JSP
    byte[] data = readImage();
    response.getOutputStream().write(data);
    // perform misc cleanup
  }
}

> assuming i want the size of that image to be width=200,height=200 on
> display,how do i achieve this

Use some image manipulation library to do the same. Google if your friend.

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

> you need to then scroll all the way back to the top

Pressing the HOME key works wonders IMO. :-)

diafol commented: hohoho like it +0
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> but I'm still curious to know if there is a way, just in case I face this
> problem again

You can make your code work by passing in a list reference which already points to an existing List implementation. That way, even though you have a copy of the reference, it would in the end point to the same list which was passed. You'd need to change your Object de-serialization part of code to do an addAll() on the list passed by passing in the List read i.e.

if (prototype instanceof ArrayList) {
  list.addAll((ArrayList <Classe_Pessoa>)prototype);
}

You might want to add in a few null checks there though but yeah, that's how it can be done.

That being said, I'm still in favour of the method responsible for returning the data read in an appropriate container rather than the caller passing in a empty container to be filled by the method since your method puts undue responsibilities on the caller, something it isn't responsible for.

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

This is because you effectively pass a copy of reference and not the list when invoking the method. Read this.

Crushyerbones commented: Very interesting +2
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> Any advice on how I should create/define the document?

Here's a simple throw-away implementation in JDOM [requires jdom.jar of course]:

public static void main(String args[]) throws Exception {
   DocumentBuilder builder = DocumentBuilderFactory.newInstance()
         .newDocumentBuilder();
   DOMBuilder domBuilder = new DOMBuilder();
   Document jdomDoc = domBuilder.build(builder.parse(new File("src/home/projects/misc/Test.xml")));
   Iterator iter = jdomDoc.getRootElement().getChildren("JOB").iterator();
   while(iter.hasNext()) {
      Element jobElem = (Element)iter.next();
      if(jobElem.getChild("JOBNAME").getValue().equals("Second job")) {
         jobElem.getChild("INPUTFOLDER").setText("MY-NEW-LOCATION");
      }
   }
   XMLOutputter outputter = new XMLOutputter();
   outputter.output(jdomDoc, System.out);
}

In your case you can output or direct the XML to some other stream/file.

> But the quickest way to do your current task would probably be
> the regular methods such as Scanner and Regex

Given that I've dabbled with both XML processing API's and regular expressions, I disagree. I'd love to see a regular expression implementation of the above having the same sort of clarity and brevity. :-)

> rather than learn how to use JDOM.

I personally feel that one shouldn't shy away from using the best possible tool for the job even if it comes with a bit of learning curve. Experience has shown that implementing something in a round-a-bout way brings in too much pain and generally has a higher cost associated than learning the right tool and doing things right.

> There are some sort of web services xml bindings for java

You can very well use the XML processing libraries which implement the XML specifications without getting involved with web services i.e. XML processing != Web …

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

What's the string outputted by your echo statement? Can you look at the page source and paste the exact output your see in view source? Also, this might help.

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

> How I go about getting documentantion?

Any JDBC tutorial out there should be good enough to get you started. The only difference would be the way the SQL driver is loaded. This would be a good start.