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

The talk of vajinas[sic], strip clubs, mod infractions and tetris in a thread meant to *bring* Rashakil back does a bit of injustice to the "keep it on topic" and "daytime television" rules.

Locked to preserve the sanity of the remaining Daniweb members. KTHXBI.

Salem commented: <burns>Excellent</burns> +31
John A commented: Wut? There's sanity left? +21
Sulley's Boo commented: مشكور و ما تقصر +6
BestJewSinceJC commented: Rashakil for the loss. S.o.S for the win. +5
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I'm pretty sure there isn't much of value which could to added to this thread. Locking it to prevent more shaman interference seems like a sane decision.

For those who have come to this thread via a search engine and are starting out with C, I'd recommend reading the Starting C thread for a list of compilers/IDE.

Salem commented: thanks! +30
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

[a new post since I can't seem to edit the original one]

> Users learn from both snippets and tutorials.

Here you're speaking from the end users' perspective and not from the site owners' POV.

> I guess this is the sort of thing im talking about. [link]

How is spam handled on that site? What if I just do a copy-paste of someone elses' work and paste there? Are tutorials reviewed before they are made available to public? Is any sort of review done, ever, on that site? How long does it take for the tutorial to be reviewed and accepted? How credible is the reviewing committee?

Nick Evan commented: editing is the newest problem... I was afraid I was the only one and had doubts about my mental health :) +17
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> I was wondering why do we need constructors with arguments?

  • Creation of an object based on an existing one [though this can be done the `Cloneable' way, constructor based approach is also pretty flexible]
  • Creation of an object with known state [bind the ServerSocket to port XXX]
  • Prevent creation of objects with invalid initial state [by making the no-arg constructor as private. E.g. you wouldn't want a Policy object in your financial system to have a blank state; a Policy business object if created *always* has an initial state in the form of a policy number and other mandatory attributes. Ditto with Streams in Java and so on]
verruckt24 commented: Full marks !!! Explains (concisely) everything. +4
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> Why should I do this(in bold)? :

Because we require the hex equivalent a generated byte and not the integer this byte gets up-casted to. When converting to hex string, we would want our toHexString() method work on an integer which represents the sequence of bytes generated by md5 and not the integer which the byte value gets automatically upcasted to.

For e.g. if the first byte generated by the md5 algorithm in your case (with input "abhi") has a binary pattern "11010111", we would want the hex equivalent of an integer having the same bit pattern i.e. "00000000000000000000000011010111". But the integer which results from the auto-conversion of "11010111" is of the form "11111111111111111111111111010111". Hence you need to AND the byte in question with 0XFF [00000000000000000000000011111111] to make sure all the higher order bits other than the byte in question are reset to 0.

> Isnt it the incorrect output?

Read the python documentation, hexdigest() is the method you should be looking for.

abhi_elementx commented: It's very informative +2
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

When do you think the compile time error 'symbol not found comes up'? What does your text book say about such errors? The example you posted seems a pretty bold one for someone who has just started out with Java.

Anyways, the error message means that the compiler doesn't know about the token 'DateFormat'; `import' the class in question and you should be good to go.

redmaverick commented: Thanks for helping me out! +1
Salem commented: Kudos for bothering to trawl through zero-indent code. +29
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> what is wrong with being "Narue obsessed"?

Nothing is wrong in being obsessed with 'XXX'; just make sure you don't end up causing inconvenience and chaos with your *obsession*[which you just did by posting this thread in C++ forum, making it an off-topic thread].

stephen84s commented: Yep this obsession had gone over the line last time also +8
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Your question is a pretty generic one and can be roughly translated to "how would I go about developing web apps using JSP and Servlets?" in which case you should:
- Start off with the JEE 5 tutorial/documentation
- Read the sticky at the top of this forum for a sample project
- Buy some good books
- Re-post if you have specific problems.

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

> Please Explain. Where i have to change the code?

Try changing your markup; your HTML page doesn't understand your *servlet project* and hence you need to specify the extra "/test" before your servlet name.

> So where i have to include DB Connection code?

In your DAO classes.

> i have reffered many books but i didnt get the proper
> knowledge... Help me please.....

Refer the sticky thread at the top of this forum along with the JEE 5 documentation for some concrete examples.

stephen84s commented: Ah... So is it finally the return of the king ??? :P +7
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> -- is supposed to be replaced with an escape sequence when it
> appears in html code.

No it isn't.

stephen84s commented: I guess you better start quoting others' messages rather than you trade mark ">" sign :P +7
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The 2009 Spring Preview is here!

There are around 30 anime this time as opposed to around 23 in the previous season. As always, I'll try my best to watch everything, though Romance, Comedy and Action anime will be my first preference. :-)

Anime FTW!

javaAddict commented: For showing to the community the joy of Anime +5
Assad_2 commented: mostly, i do not get into that much anime, but recently i have managed to spare time for anime and found another type of comics as manga series +0
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

NaN. Read the section on "How NaN is created", step through your code a single method at a time and it should be pretty easy. Use a debugger; a slick one which comes with Eclipse or a primitive command line debugger like "jdb" should do the job.

Salem commented: NaN - more than just an elderly female relative :) +29
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> hell

Yeah, I guess that's what all the kool kids say these days. :-)

Ezzaral commented: hehe :D +17
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Since this is yet another 'gimme a project' thread with no real value, locked.

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

> nobody here expects every poster's English to be without flaws,
> but since English is not my 2nd or 3rd language (4th, actually)

Just because you can do it doesn't mean everyone can; each person has a different learning curve, level of perception etc. etc.

> I agree, some of my posts can be rude, but considering the
> amount of topics here with the classical "how to create .exe files
> from projects"

Disagreements are a part of forum discussions but name calling and sarcasm in the guise of correcting is something the rules don't permit. Also a wrong answer doesn't automatically qualify a post as being the bulls eye for sarcasm/negativity.

> but the sollution here seemed a bit like using a pitch fork to eat a
> bowl of spaghetti:

Then try to make him understand how to actually eat a bowl of spaghetti instead of stuffing the pitchfork down his throat, rendering him unable to eat anything his entire life.

> so yes, I do reply then with a comment that might seem as
> 'putting him down', since the soft approach doesn't really hand
> out the most refreshing wake-up call.

As an example, just because I hate someone doesn't make killing that person a logical choice. In the same manner, just because I feel something is a lost cause doesn't make breaking the rules a logical choice.

> I …

verruckt24 commented: I'm the kinda person who rather hates persons like the mods etc., but dunno there's something in the way you explain anything, that we feel we ought to obey and say 'Yes we'll do it'. Keep it up. +2
stephen84s commented: I hate you, you manage to persuade me almost everytime. +5
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> to prove my stance being correct here

Let me say this once again; the stance of posting sarcastic/hostile comments is never the correct one. Normally hostile attitude adopted towards a forum member is rewarded with an infraction; something I try avoid giving at all costs. Maybe this stance is causing other people/forum members to adopt an easy going attitude regarding moderators / forum rules?

And regarding the tone adopted by the poster, I have had similar experiences with people having English as their second/third language; the thing they try to convey ends up being different than what they end up writing.

Like almost every forum rules out there states, if you think you have nothing more to add other than flaming the poster, please avoid making that post. Rather than bringing the poster on the right track, it might have the effect of turning a perfectly fine discussion into a flame war.

stephen84s commented: Hey ~s.o.s~ you dint mention whether the mod hat was on or off :P +5
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

<mod-hat-off-mode>

I am *really* concerned with this recent stance taken by the regulars when dealing with posts which given out wrong information. It feels really bad when I see replies/comments along the lines of:

roseindia, are you kidding me???? One awful place they love to show-off most terrible solution

useless, irrelevant and dare someone call it even "information"

Useless information

That is the worst advice ever. To encourage someone to go all this trouble, when they already have a jar file that can be run. You are practically destroying the hole concept of writing the program in java.

so, genious, how many of your favourite sites did you convert to an .exe lately?

Great, just great, all I see is pointed words dripping with sarcasm. I'll tell you what you just did. Your comments didn't enable him to learn, they just discouraged him helping out people in the future with the fear that he would again be criticized.

So I ask you all, were you this smart/good to go with Java when you started as a beginner, would it have been wrong on your part to refer to roseindia when it was the first tutorial which came up from a web search, were you all smart enough to realize that what roseindia gives out is bad on all counts? Isn't this just *collective* knowledge you gained by being told by others / visiting the forums?

Does this poster have that kind of history of ignoring advice …

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

"Apathetic Harbinger of Sorrow"

That's it; I am not buying the book...

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

> but when I start the client nothing happens

Put a few debugging statements to monitor the entire conversation and post where exactly your program hangs. For e.g. print out a debugging statement to the console when the server receives a client request [i.e. after accept()] and so on. Alternatively, if you are using a good IDE, it should be pretty easy to trace the entire client server communication using the in built debugging capabilities.

Also make sure that when you are using buffered streams, don't forget to flush them after you are done with all the writing since a write on the buffered stream doesn't necessarily mean the data is written to the underlying stream.

tuse commented: thanks! +2
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

IMO Scanner is much more than just another I/O class with a pretty interface/API; it has advanced parsing capabilities which attempts to remove the utility class most programmers create to process the strings read in by a normal reader. It is pretty much capable of reading and performing complicated processing on strings irrespective of the source [Strings, InputStreams, Readers]. The feature of skipping/locating patterns based on regular expressions is powerful in itself.

On the other hand, the API specifies that the BufferedReader class *should* provide buffering capabilities, something not mandated when implementing a Scanner .

To conclude it all, I still end up using BufferedReader and my custom string processor when reading and processing textual data. Nothing against Scanner mind you, just historical reasons. :-)

javaAddict commented: That's the comment I was looking for +5
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> Where 'this' as mentioned above refers to the current object. Since
> static members do not belong to any particular object/instance as
> such, for them 'this' does not make any sense.

...but is still valid though is ignored. It is completely legal to invoke a static method using a reference though misleading at best.

> So, when you write calcFV() without mentioning any class/object
> name before it, java assumes that you are referring to the same
> class' method/variable and changes the call to this.calcFV() .

Not always true since if the method by the name calcFV() is not present in the class hierarchy, invocation of a static method by the same name is attempted [in which case there is no `this'] or a compilation error with no such method exists is spit out.

> Now towards the explanantion of your error. In Java there is a
> 'this' variable that stores a reference to the current object.

Or put in a more detailed manner, a reference to the instance currently executing the given method [the method which is present on the top of the callstack of the currently executing Thread].

> So when you call a non-static member variable/method from a static
> method, the 'this' variable cannot be used for dereferencing as
> mentioned above the JVM has no way of knowing which class'
> method/variable you are referring to

javaAddict commented: I liked the: 'Expecting NPE' comment. Didn't know it was possible +5
verruckt24 commented: Got to know loads of things. +1
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> i just thought you guys would of liked a challenge lol

I have got enough challenges in my daily life, I guess I'll just pass. :-)

But don't give up hope, who knows, masijade might just end up dropping in a jar file here with a "meh" look on his face. ;-)

caps_lock commented: thankyou for the hope! +1
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> int generator1 = generator.nextInt(20)+1/2;

Operator precedence anyone?

> /*
> * To change this template, choose Tools | Templates
> * and open the template in the editor.
> */

I am surprised how someone can churn out such an unformatted code even after using an IDE / advanced text editor.

> class Math12 { /* */ }
> class Math5 { /* */ }
> class Math7 { /* */ }

The very fact that multiple classes are created which do the same thing is a clear indication of design problems with the application. Consider customizing the class instance by having constructors/factory methods.

...and many other things.

If your friend really wants to learn, tell him to start some serious reading. A lot of beginner resources are mentioned in the sticky; starting with the Java beginner tutorials ain't that bad an idea.

stephen84s commented: You must have really put in some effort to read all that <Ugh> code +5
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Though I don't do standalone application development using Swing, a few obvious comments.

> Class.forName("com.mysql.jdbc.Driver").newInstance(); .

You don't need to do this for every invocation. As soon as the Driver class is loaded, it registers itself with the DriverManager and that's it; no more Class.forName() required. Also, you don't need to create a new instance, just doing Class.forName() is sufficient.

> String computer = ""; .

Try to avoid this. String computer = null; is good to go.

> getConnection("jdbc:mysql://IP_ADDRESS:3306/DB", "USERNAME", "PASSWORD"); .

Don't use magic numbers/literals in your program. Either load these configurable parameters via an external resource [properties file] or at least move them to a separate class/interface as constants and refer them throughout your application.

> public void Refresher() throws SQLException .

Follow Java coding conventions; don't use uppercase characters for method names. It is a bad programming practice to expose checked exceptions to your client[given that the method is public]. Since a SQLException is almost always unrecoverable, catch it and either rethrow it wrapped in your own application specific Exception class or just log the exception for debugging/troubleshooting/analysis purposes.

You never release your database resources! You need to close the ResultSet , Statement and Connection object. Read the JDBC tutorials for more information.

public void some() {
  Connection conn = null;
  PreparedStatement pStmt = null;
  ResultSet rs = null;
  try {
    try {
      //grab connection
      // use statement and resultset
    } finally {
      if(rs != null) …
Ezzaral commented: All good suggestions. +16
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

*Ahem*, time to bring this thing on topic.

> i have to submit project in java....next month.....
> please help me.....

As per the rules laid down, we provide help only to those who put in some effort to solve their problems; handing out free code is not encouraged here. Give your project a go, post the problems you face and then someone might help you out on this.

masijade commented: Well, at least someone's trying to rescue this thread. Sorry 'bout that. ;-) +11
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The check for email == undefined is superfluous since a value of text form field, if it exists will never be `undefined' or `null' but always a empty string if nothing was entered. You should rather check the return value of getElementById() so that you don't end up trying to access the `value' property of something which doesn't exist. Also the above validation can be easily bypassed by entering just whitespaces. Maybe a trim is in order?

function validate() {
  var e = document.getElementById('emailId');
  if(!e) return false;
  var txt = trim(e.value); // here trim() is a custom function
  if(txt === '') {
    alert('Please enter an email id.');
    return false;
  }
  return true;
}

./sos

kanaku commented: he owned me +2
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> every serializable class needs a static final long "serialVersionUID"
> field

Yes, but static fields as a rule are not serialized by default. serialVersionUID is a special static field which is an indication to the serialization mechanism that 'persist the given instance with this version'. Even if a serialVersionUID is not provided, the serialization mechanism generates one based on the class structure / object hash code. Hence it would be a bit misleading stating that static fields are persisted when talking about serialVersionUID.

As long as no changes are made to the class, there is as such no problem ser/deser an object to persistent storage and retrieving from one with a default generated serialVersionUID. The problem arises when you make structural changes to the class which should in no way be treated as a different version [e.g. adding a method which has got nothing to do with ser/deser state of a class instance]. In this case, the serialization fails if a serialVersionUID field was not provided when defining the class.

So to cut long story short, don't think of serialVersionUID as a *static* variable stored to a persistent storage but as an indication to the serialization mechanism to *not* generate a default version number but use the one provided. To support this theory, every field persisted shows up in the serialized file i.e. if an object having instance variables "gogo" and "gaga" are persisted, the serialization file would show "gogo" and "gaga" with some other …

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

Whenever possible, you should always use the W3C
'document.getElements...' methods rather than collections such as
document.links, .forms or .images

links is a standard property of the document DOM element. It would be interesting to know the reasons of preferring the long winded and probably expensive document.getElementsByTagName() route.

@xander85:
AFAICR, there is a pure CSS solution which perfectly fits your scenario. I can't think of a better solution than letting the rendering engine do all the heavy lifting for you rather than you doing it yourself. The CSS solution has the advantage of working even when Javascript is disabled. Maybe something like:

li a {
  background-color: #999;
}
li a:hover {
  background-color: #333;
}
xander85 commented: I should have thought of that, THANKS! +2
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> one byte of storage for each character

The char data type is a single 16-bit Unicode character. It has a minimum value of '\u0000' (or 0) and a maximum value of '\uffff' (or 65,535 inclusive). Read me.

Why is it that you are required to come up with such a hack just to extract some data? Where is the data coming from? Doesn't every field have some fixed width? Maybe explaining a bit about what you are trying to achieve here rather than how you are trying to achieve it might fetch you some good answers.

And like I have previously mentioned, don't go on confusing bytes and characters; a string is just a sequence of unicode characters. So if you have a string "abc010101xyz", the "0" there is just a character, not an integer, not a binary digit. Just come up with a specification of how your data will be formatted and process the string as a sequence of unicode characters rather than bytes and bits.

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

You ain't doing it right. Maybe this would help.

srs_grp commented: It was really helpful!! +1
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Saying that 'XXX is not possible in Java' is pretty misleading IMO.

Is I/O and Networking possible in Java? You might say yes, there are packages like java.io.* and java.net.* for it. But is it really possible in *java*? Both I/O and Networking libraries which are part of the standard libraries at their core make JNI calls and are platform specific since the way I/O is performed is OS/platform specific. So as long as you have the proper JNI code in place along with dynamic libraries for your target platforms, almost anything is possible in Java. The same argument applies to 'Java only works at Application/Transport layer'.

But to answer the question, yes, a ping utiilty can't be written using the standard Java libraries, since AFAIK, Java doesn't allow creation of raw sockets which are needed to send ICMP packets.

Ping requires ICMP packets. These packets can only be created via a socket of the SOCK_RAW type. Currently, Java only allows SOCK_STREAM (TCP) and SOCK_DGRAM (UDP) sockets. It seems unlikely that this will be added very soon, since many Unix versions only allow SOCK_RAW sockets to be created by root, and winsock does not address ICMP packets (win32 includes an unsupported and undocumented ICMP.DLL).

stephen84s commented: Informative, Discovered another new thing from your post +4
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The 2009 Winter Preview is here!

Though I would be shameful enough watching each one them, eagerly awaited would be:

  • Akikan [since I am a harem/romance lover at heart]
  • Asu no Yoichi!
  • Birdy the Mighty Decode:02
  • Tower of Druaga ~Sword of Uruk~

...and the best of them all "Zoku Natsume Yuujinchou".

John A commented: Alright! +17
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> He stated that both methods are bad programming practices.

No, it isn't; don't fall into such debates as anyone who tries to convince you such is just selling snake oil. If it really were that bad, you wouldn't have found Sun's internal implementation of most of the library classes to be cluttered with them.

IMO, not all things are bad in an absolute sense; there are just good and bad ways of using the same thing.

Ezzaral commented: Exactly what I thought when I read that. +16
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

It would be appreciated if you used the actual links instead of referring them via some redirection service; read this. Many firewalls out there block any request made via the redirection services, McAfee being one of them. BTW, even my firewall/anti-virus software blocks TinyURL links.

Daniweb has a feature which is available in both quick reply and advanced reply mode known as `Insert link' which can be used if you have a problem with long and ugly URLs.

stephen84s commented: Dint know Tiny URLS could cause BIG problems like those. +4
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

If you plan on viewing the output on Eclipses's console, it shouldn't be that big a problem. Try following the advice in this post.

But if you are stuck with windows console, then there isn't a reliable / sure shot way of getting it to work. Many have suggested setting the code page to 65001 though I am not very sure whether it works in all cases.

Let me know if the above suggested fixes work in your case. Best of luck for your project; hoping to see it on sourceforge. ;-)

puneetkay commented: Superb! Thanks for help! +2
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> But, sometimes, I just don't feel like taking the effort to try
> talking them out of it.

Yes, even I get that sort of feeling but seeing that VernonDozier is a Daniweb regular, I took my chances. ;-)

> that calling getRed () really slowed the program down and that
> there was a lot of overhead with it, but that's not true, is it?

No, it isn't, really. If you are still concerned about calling the same method again and again, instead of having your class maintain the state or cache the `red' value, shove the responsibility to the invoked method instead.

private void mutate() {
  int red = color.getRed();
  // some complicated, multi step calculation using `red'
  color.setRed(red);
}

And talking of terms like overhead for a program without any concrete profiling data whatsoever is wrong IMO.

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

In Java, everything is passed by value; in case of primitive types, a copy of the value is created and then passed as an argument to the method invoked.

private void mutateItNot(int v) {
  v = 10; // no effect on the original integer value
          // this `v' is just a copy of the `int' being passed
}

In case of references, a copy of the reference variable is created and then passed as an argument to the invoked method. Think of this as a remote control used to regulate the functioning of a T.V. When a reference type is passed to the method, a copy of it i.e. a copy of the remote is created which in the end is used to manipulate the same T.V. You can regulate the T.V. with this cloned remote in the same way as you would do with the original but destroying this remote has no effect on the original.

private void mutateItNot(SomeThing s) {
  // use the reference to manipulate the object it points to
  // [assuming we are not talking about immutable classes here]
  s.setField(someValue); 
  s = null; // the clone is now made to point to nothing
            // with absolutely no effect on the original
}

> I'm also storing the red, green, blue, alpha values as integer
> attributes in those classes because I am using them a lot

Why? Ease of use? Performance? This is no sane reason to duplicate data; your class instance …

stephen84s commented: Earlier had created a mess answering a similar question, this was very well put. +4
VernonDozier commented: Good explanation +10
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

It's not about being thankful; as long as someone benefits/learns something from the answers posted, it's always an effort worth spent. I have very little time and lot of boards to manage so most of my replies are curt and short; maybe that made you think I am dismissing your problem as trivial.

My level of expectation was high because at universities they don't given these kinds of problems to complete beginners hence the knowledge of `break' was at least expected from you.

> I'm just trying to think of where i acted like a "spoiled brat"

By calling someone who tries to help you out a `crank'?

stultuske commented: I guess trying is the first step to success, but some will never learn +3
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> but i do get the feeling that i am being a bother, if you don't
> wanna help me, fine

If you would have bothered to read the all replies given to your post, you would have noticed that it contains all that you need to complete this assignment of yours. If you don't understand things, you need to search them up and then post if you still have doubts; acting like a spoiled brat is no excuse.

> I'm in first year computer science and this is the first language
> i've learned

So? All I did was to ask you search up something; was it that difficult/troublesome?

> excuse me for not knowing some stuff, and asking for help,
> in a help forum.

People are definitely excused here for not knowing stuff but behavior like yours is certainly not. Replies like yours make us feel that our valuable time was wasted on something which has no returns to the Software Development community in general.

P.S.: Though this is a help forum, people here are not under any obligation to reply to threads; all the replies you received were from people who spend their valuable time trying to help others out. You should be thankful.

Ezzaral commented: Well, you've certainly tried to help him here. +15
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

One tiny question do you think exchanging %20 with dashes help with SEO?
Have a fantastic day.

Most of the search engines out there treat dashes as spaces when indexing sites/urls. Hence a search for "order of phoenix" might just show you http://somesite.com/order-of-phoenix but not http://someothersite.com/order_of_phoenix

That being said, I ain't no expert on SEO, it's just something I heard a while back which I thought I should share. More information here.

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

I just couldn't wait to share this masterpiece with you; The IT Contract from Hell

Hope it makes you all go LOL! ;-)

John A commented: Heh. +17
Narue commented: Good story. +31
Nick Evan commented: Great! +12
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

AFAICT, when in search for a blogging service, people normally look for the ones which provide complete freedom in terms of blog posts. They might have blog posts related to their day to day happenings or on technical topics. Since Daniweb blogs, AFAIK, don't allow non-technical content and people normally are too lazy to maintain two blogs, hence the outcome.

Also, it depends a lot on the ecosystem of the community. Daniweb is mostly frequented by school / university kids looking for homework help or people trying to solve hardware configuration issues i.e. the ratio contributors to consumers is pretty low.

Some other reasons might be a lot of things going in life to bother with blogging or just plain old laziness [like me].

My personal choice for blog posts is something related to programming or some latest development in the software scenario rather than lowdown on the next version of MS Vista; YMMV.

Dave Sinkula commented: /me nods. +17
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

What I was saying is that I don't understand most of that terminology, so the point alone has no impact. I hope I wasn't rude - I wasn't trying to be.

It would be difficult to explain the real use of reflection without throwing in a lot of terminology. Maybe reading this article will help you understand how reflection changes the way we think of object construction/instantiation and how the concept of reflection benefits the real world software development.

Ezzaral commented: Good reference. +15
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The thing they are doing is nothing special. To summarize it:
- User makes a selection from the primary SELECT box, MAKE in your case.
- An asynchronous request is made using the XHR [XML HTTP Request] Object i.e. an AJAX call.
- The request URI encapsulates all the information required for fetching the data for the secondary SELECT box, MODEL in your case.
- The request looks something along the lines of /models/?make=selectedMake
- Now, the representation returned by the server depends on how your application architecture is structured. Like I explained in my previous post, it can be a delimiter separated value, a JSON response or an XML response. As far as that site is concerned, I guess they are dealing with a delimiter separated response, something along the lines of: make1=qty1;make2=qty2;make3=qty3 .
- If using JSON, the above response can be structured as: {make1: qty1, make2: qty2, make3: qty3} .
- The advantage when dealing with JSON response is that it can be directly consumed by your client application by simply evaling the text returned [though eval is dangerous for real applications; use a Javascript JSON library]

var obj = eval(response);
for(var key in obj) {
  alert(key + " -> " + obj[key]); // make1 -> qty1 etc.
}

- The logic for interpreting the request and constructing a response obviously would be implemented in the server side language of your choice. A working knowledge of the same is …

OmniX commented: Thanks for the detailed breakdown! +1
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

As far as I know, exceptions that are not subclasses of runtime exception or error should be caught (handled).

When a file exception occurs, it should be caught because its a subclass of exception class, but how can it be recovered? If file is not found,it sounds silly to recover it when the program has to read file to run,I think the program should be terminated.

} catch (IOException e) {
            e.printStackTrace();
            System.exit(0);
} finally {
        if(in != null)
           in.close();
}

I preferred to exit in catch block,what should be done in such a situation?

Making IOException and SQLException as checked exceptions is regarded as one of the blunders of the Java standard library design. Many might argue that having checked exceptions in itself is a big PITA but that's a story for some other day.

Anyways, just make sure you don't propagate error codes anywhere in your application design; it's one of the worst design decisions to make esp when using a language like Java which has exceptions built in.

You have two options here:
- Either let the method throw the same IOException which occurs and let the invoking method handle the case. This seems to be a bad choice since the calling method now has to handle an exception it shouldn't have been bothered with in the first place.
- Create your own RuntimeException class which fits ecosystem of your application and wraps around the IOException thrown. This exception should be thrown when an …

jasimp commented: well said +9
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The script in case of a SCRIPT element may be defined inside the contents of the SCRIPT element or in an external file. The only difference here is that an additional request is made in the case of an external script file. Hence you can treat your script as though it was embedded in the document even when it comes from an external source.

You have a few options; either pass in the `id' / `name' of the form elements whose values you need to access to the Javascript function or just access them directly from your function assuming that the form elements with the given `name' / `id' are always present.

<input type="text" name="txtOne" id="txtOne">
<input type="text" name="txtTwo" id="txtTwo">
<input type="button" value="Calculate" onclick="getIncomeTax('txtOne', 'txtTwo');">

<!-- OR -->

<input type="text" name="txtOne" id="txtOne">
<input type="text" name="txtTwo" id="txtTwo">
<input type="button" value="Calculate" onclick="getIncomeTax(this.form);">

function getIncomeTax(frm) {
  var e1 = frm.elements['txtOne'];
  var e2 = frm.elements['txtTwo'];
  var iTax = doSomething(e1.value, e2.value);
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Enough of this name calling already, please. It has been observed that many of the Geek's Lounge threads on debatable topics like Politics are taking a nasty turn which comes in the form of name calling, giving out negative reputation etc.

Let's keep this discussion a healthy one which everyone can enjoy reading; any more fights and this thread is a goner.

Ezzaral commented: Good call. +13
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Don't use scriptlets; use JSP's only for view purposes. Use JSTL along with servlet.

> whenever i retrieve that data in my jsp page, it only shows this
> Ljava.lang.String@123EGa something similar to this..

This is because you are trying to print a String array and the above just happens to how toString of an array looks like.

Here you can find some sample J2EE applications along with the J2EE design patterns free book which you can use to read more about Data Access Object pattern.

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

>The problem is, I am not the author of the original and as such have not clue as to what
> methods the classes have and in which class.

Then how do you propose on adding additional functionality as mentioned in your first post?

Ezzaral commented: That's exactly what I was wondering. +13
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Post a compilable piece of code; what you posted isn't even remotely a valid Java program.

In Java, multi-dimensional arrays are represented as array of array. This allows you to ignore the second dimension when defining a two dimensional array. Generically speaking, this concept allows you to ignore all the dimensions except the first one. Also in case of a two dimensional array, the first slot of your array will hold a reference to another array and so on.

A simple example:

public class ArrayTest {

  public static void main(final String[] args) {
    arrayTest();
  }

  private static void arrayTest() {

    int[][] arrTwo = new int[3][];
    for(int i = arrTwo.length - 1; i >= 0; --i) {
      // arrTwo[i] is null since we ignored the second dimension
      // when declaring arrTwo
      System.out.println("arrTwo[" + i + "] -> " + arrTwo[i]);
    }
    System.out.println("\n\n");

    // When an array is defined, its slots hold the default value for the
    // type for which it is defined. Hence in case of an int array it
    // would be 0 while in the case of a String array it would be `null'.
    
    int[][] arrOne = new int[3][3];
    for(int i = arrOne.length - 1; i >= 0; --i) {
      // arrOne[i] is an array having length 3
      int[] tmp = arrOne[i];
      System.out.println("arrOne[" + i + "] -> " + tmp);
      for(int j = tmp.length - 1; j >= 0; --j) {
        System.out.println("arrOne[" + i + "][" + j + "] -> " + tmp[j]); …
jasimp commented: nice example +9
javaAddict commented: good explanation +4